diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/charts/physims/Chart.yaml b/charts/physims/Chart.yaml new file mode 100644 index 0000000000..bef28aac27 --- /dev/null +++ b/charts/physims/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-physim +description: A Helm chart for physical simulators network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulators + - RAN + - 4G + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/dlsim/Chart.yaml b/charts/physims/charts/dlsim/Chart.yaml new file mode 100644 index 0000000000..de7f5958b2 --- /dev/null +++ b/charts/physims/charts/dlsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-dlsim +description: A Helm subchart for dlsim network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - dlsim + - RAN + - 4G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/dlsim/templates/NOTES.txt b/charts/physims/charts/dlsim/templates/NOTES.txt new file mode 100644 index 0000000000..75b79e3dd4 --- /dev/null +++ b/charts/physims/charts/dlsim/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-dlsim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-dlsim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-dlsim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-dlsim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/dlsim/templates/_helpers.tpl b/charts/physims/charts/dlsim/templates/_helpers.tpl new file mode 100644 index 0000000000..7ae142b671 --- /dev/null +++ b/charts/physims/charts/dlsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-dlsim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-dlsim.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-dlsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-dlsim.labels" -}} +helm.sh/chart: {{ include "oai-dlsim.chart" . }} +{{ include "oai-dlsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-dlsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-dlsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-dlsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-dlsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/dlsim/templates/deployment.yaml b/charts/physims/charts/dlsim/templates/deployment.yaml new file mode 100644 index 0000000000..9cbdd383b3 --- /dev/null +++ b/charts/physims/charts/dlsim/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-dlsim.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-dlsim.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-dlsim.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-dlsim + # volumeMounts: + # - mountPath: /opt/oai-dlsim/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015100" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/dlsim/templates/service.yaml b/charts/physims/charts/dlsim/templates/service.yaml new file mode 100644 index 0000000000..6aeb0dbf53 --- /dev/null +++ b/charts/physims/charts/dlsim/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-dlsim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-dlsim + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-dlsim.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/dlsim/values.yaml b/charts/physims/charts/dlsim/values.yaml new file mode 100644 index 0000000000..c0142b50ae --- /dev/null +++ b/charts/physims/charts/dlsim/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-dlsim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-dlsim-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/ldpctest/Chart.yaml b/charts/physims/charts/ldpctest/Chart.yaml new file mode 100644 index 0000000000..667bd3d8aa --- /dev/null +++ b/charts/physims/charts/ldpctest/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-ldpctest +description: A Helm subchart for ldpctest network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - ldpctest + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/ldpctest/templates/NOTES.txt b/charts/physims/charts/ldpctest/templates/NOTES.txt new file mode 100644 index 0000000000..bda83c2f9e --- /dev/null +++ b/charts/physims/charts/ldpctest/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-ldpctest.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-ldpctest.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-ldpctest.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-ldpctest.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/ldpctest/templates/_helpers.tpl b/charts/physims/charts/ldpctest/templates/_helpers.tpl new file mode 100644 index 0000000000..018eaa5af5 --- /dev/null +++ b/charts/physims/charts/ldpctest/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-ldpctest.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-ldpctest.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-ldpctest.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-ldpctest.labels" -}} +helm.sh/chart: {{ include "oai-ldpctest.chart" . }} +{{ include "oai-ldpctest.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-ldpctest.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-ldpctest.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-ldpctest.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-ldpctest.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/ldpctest/templates/deployment.yaml b/charts/physims/charts/ldpctest/templates/deployment.yaml new file mode 100644 index 0000000000..ef30d9c08a --- /dev/null +++ b/charts/physims/charts/ldpctest/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-ldpctest.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-ldpctest.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-ldpctest.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-ldpctest + # volumeMounts: + # - mountPath: /opt/oai-ldpctest/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015102" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/ldpctest/templates/service.yaml b/charts/physims/charts/ldpctest/templates/service.yaml new file mode 100644 index 0000000000..eb0db8ce00 --- /dev/null +++ b/charts/physims/charts/ldpctest/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-ldpctest.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-ldpctest + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-ldpctest.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/ldpctest/values.yaml b/charts/physims/charts/ldpctest/values.yaml new file mode 100644 index 0000000000..91eab91af5 --- /dev/null +++ b/charts/physims/charts/ldpctest/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-ldpctest. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-ldpctest-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/nr-dlschsim/Chart.yaml b/charts/physims/charts/nr-dlschsim/Chart.yaml new file mode 100644 index 0000000000..3837f0cd2b --- /dev/null +++ b/charts/physims/charts/nr-dlschsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-dlschsim +description: A Helm subchart for nr-dlschsim network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - nr-dlschsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-dlschsim/templates/NOTES.txt b/charts/physims/charts/nr-dlschsim/templates/NOTES.txt new file mode 100644 index 0000000000..1f88d64976 --- /dev/null +++ b/charts/physims/charts/nr-dlschsim/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-nr-dlschsim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-nr-dlschsim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-nr-dlschsim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-nr-dlschsim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/nr-dlschsim/templates/_helpers.tpl b/charts/physims/charts/nr-dlschsim/templates/_helpers.tpl new file mode 100644 index 0000000000..6b6a5181e9 --- /dev/null +++ b/charts/physims/charts/nr-dlschsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-dlschsim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-nr-dlschsim.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-nr-dlschsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-dlschsim.labels" -}} +helm.sh/chart: {{ include "oai-nr-dlschsim.chart" . }} +{{ include "oai-nr-dlschsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-dlschsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-dlschsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-dlschsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-dlschsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-dlschsim/templates/deployment.yaml b/charts/physims/charts/nr-dlschsim/templates/deployment.yaml new file mode 100644 index 0000000000..06f01a0f0b --- /dev/null +++ b/charts/physims/charts/nr-dlschsim/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-dlschsim.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-nr-dlschsim.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-nr-dlschsim.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-nr-dlschsim + # volumeMounts: + # - mountPath: /opt/oai-nr-dlschsim/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015106" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/nr-dlschsim/templates/service.yaml b/charts/physims/charts/nr-dlschsim/templates/service.yaml new file mode 100644 index 0000000000..0dd065c9e0 --- /dev/null +++ b/charts/physims/charts/nr-dlschsim/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-dlschsim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-nr-dlschsim + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-nr-dlschsim.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/nr-dlschsim/values.yaml b/charts/physims/charts/nr-dlschsim/values.yaml new file mode 100644 index 0000000000..e96541102c --- /dev/null +++ b/charts/physims/charts/nr-dlschsim/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-nr-dlschsim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-nr-dlschsim-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/nr-dlsim/Chart.yaml b/charts/physims/charts/nr-dlsim/Chart.yaml new file mode 100644 index 0000000000..2ec4b7eabd --- /dev/null +++ b/charts/physims/charts/nr-dlsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-dlsim +description: A Helm subchart for nr-dlsim network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - nr-dlsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-dlsim/templates/NOTES.txt b/charts/physims/charts/nr-dlsim/templates/NOTES.txt new file mode 100644 index 0000000000..79027454cf --- /dev/null +++ b/charts/physims/charts/nr-dlsim/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-nr-dlsim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-nr-dlsim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-nr-dlsim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-nr-dlsim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/nr-dlsim/templates/_helpers.tpl b/charts/physims/charts/nr-dlsim/templates/_helpers.tpl new file mode 100644 index 0000000000..1dd7fbd3fd --- /dev/null +++ b/charts/physims/charts/nr-dlsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-dlsim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-nr-dlsim.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-nr-dlsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-dlsim.labels" -}} +helm.sh/chart: {{ include "oai-nr-dlsim.chart" . }} +{{ include "oai-nr-dlsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-dlsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-dlsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-dlsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-dlsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-dlsim/templates/deployment.yaml b/charts/physims/charts/nr-dlsim/templates/deployment.yaml new file mode 100644 index 0000000000..4c38664e61 --- /dev/null +++ b/charts/physims/charts/nr-dlsim/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-dlsim.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-nr-dlsim.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-nr-dlsim.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-nr-dlsim + # volumeMounts: + # - mountPath: /opt/oai-nr-dlsim/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015105" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/nr-dlsim/templates/service.yaml b/charts/physims/charts/nr-dlsim/templates/service.yaml new file mode 100644 index 0000000000..c58433f3b2 --- /dev/null +++ b/charts/physims/charts/nr-dlsim/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-dlsim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-nr-dlsim + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-nr-dlsim.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/nr-dlsim/values.yaml b/charts/physims/charts/nr-dlsim/values.yaml new file mode 100644 index 0000000000..c86fc96cff --- /dev/null +++ b/charts/physims/charts/nr-dlsim/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-nr-dlsim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-nr-dlsim-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/nr-pbchsim/Chart.yaml b/charts/physims/charts/nr-pbchsim/Chart.yaml new file mode 100644 index 0000000000..6d8359598d --- /dev/null +++ b/charts/physims/charts/nr-pbchsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-pbchsim +description: A Helm subchart for nr-pbchsim network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - nr-pbchsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-pbchsim/templates/NOTES.txt b/charts/physims/charts/nr-pbchsim/templates/NOTES.txt new file mode 100644 index 0000000000..cee233d4f3 --- /dev/null +++ b/charts/physims/charts/nr-pbchsim/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-nr-pbchsim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-nr-pbchsim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-nr-pbchsim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-nr-pbchsim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/nr-pbchsim/templates/_helpers.tpl b/charts/physims/charts/nr-pbchsim/templates/_helpers.tpl new file mode 100644 index 0000000000..0e31033343 --- /dev/null +++ b/charts/physims/charts/nr-pbchsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-pbchsim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-nr-pbchsim.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-nr-pbchsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-pbchsim.labels" -}} +helm.sh/chart: {{ include "oai-nr-pbchsim.chart" . }} +{{ include "oai-nr-pbchsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-pbchsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-pbchsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-pbchsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-pbchsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-pbchsim/templates/deployment.yaml b/charts/physims/charts/nr-pbchsim/templates/deployment.yaml new file mode 100644 index 0000000000..551785abc0 --- /dev/null +++ b/charts/physims/charts/nr-pbchsim/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-pbchsim.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-nr-pbchsim.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-nr-pbchsim.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-nr-pbchsim + # volumeMounts: + # - mountPath: /opt/oai-nr-pbchsim/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015104" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/nr-pbchsim/templates/service.yaml b/charts/physims/charts/nr-pbchsim/templates/service.yaml new file mode 100644 index 0000000000..35faf3c33d --- /dev/null +++ b/charts/physims/charts/nr-pbchsim/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-pbchsim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-nr-pbchsim + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-nr-pbchsim.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/nr-pbchsim/values.yaml b/charts/physims/charts/nr-pbchsim/values.yaml new file mode 100644 index 0000000000..62d89f9632 --- /dev/null +++ b/charts/physims/charts/nr-pbchsim/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-nr-pbchsim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-nr-pbchsim-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/nr-prachsim/Chart.yaml b/charts/physims/charts/nr-prachsim/Chart.yaml new file mode 100644 index 0000000000..8c88587a7f --- /dev/null +++ b/charts/physims/charts/nr-prachsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-prachsim +description: A Helm subchart for nr-prachsim network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - nr-prachsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-prachsim/templates/NOTES.txt b/charts/physims/charts/nr-prachsim/templates/NOTES.txt new file mode 100644 index 0000000000..376694e7e4 --- /dev/null +++ b/charts/physims/charts/nr-prachsim/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-nr-prachsim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-nr-prachsim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-nr-prachsim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-nr-prachsim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/nr-prachsim/templates/_helpers.tpl b/charts/physims/charts/nr-prachsim/templates/_helpers.tpl new file mode 100644 index 0000000000..6362c72b2a --- /dev/null +++ b/charts/physims/charts/nr-prachsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-prachsim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-nr-prachsim.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-nr-prachsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-prachsim.labels" -}} +helm.sh/chart: {{ include "oai-nr-prachsim.chart" . }} +{{ include "oai-nr-prachsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-prachsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-prachsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-prachsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-prachsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-prachsim/templates/deployment.yaml b/charts/physims/charts/nr-prachsim/templates/deployment.yaml new file mode 100644 index 0000000000..52bc030c45 --- /dev/null +++ b/charts/physims/charts/nr-prachsim/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-prachsim.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-nr-prachsim.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-nr-prachsim.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-nr-prachsim + # volumeMounts: + # - mountPath: /opt/oai-nr-prachsim/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015112" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/nr-prachsim/templates/service.yaml b/charts/physims/charts/nr-prachsim/templates/service.yaml new file mode 100644 index 0000000000..71bfe7b9fe --- /dev/null +++ b/charts/physims/charts/nr-prachsim/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-prachsim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-nr-prachsim + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-nr-prachsim.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/nr-prachsim/values.yaml b/charts/physims/charts/nr-prachsim/values.yaml new file mode 100644 index 0000000000..3ea9787f7a --- /dev/null +++ b/charts/physims/charts/nr-prachsim/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-nr-prachsim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-nr-prachsim-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/nr-pucchsim/Chart.yaml b/charts/physims/charts/nr-pucchsim/Chart.yaml new file mode 100644 index 0000000000..bb0033175f --- /dev/null +++ b/charts/physims/charts/nr-pucchsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-pucchsim +description: A Helm subchart for nr-pucchsim network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - nr-pucchsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-pucchsim/templates/NOTES.txt b/charts/physims/charts/nr-pucchsim/templates/NOTES.txt new file mode 100644 index 0000000000..7c2cfa9155 --- /dev/null +++ b/charts/physims/charts/nr-pucchsim/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-nr-pucchsim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-nr-pucchsim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-nr-pucchsim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-nr-pucchsim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/nr-pucchsim/templates/_helpers.tpl b/charts/physims/charts/nr-pucchsim/templates/_helpers.tpl new file mode 100644 index 0000000000..210ba26db2 --- /dev/null +++ b/charts/physims/charts/nr-pucchsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-pucchsim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-nr-pucchsim.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-nr-pucchsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-pucchsim.labels" -}} +helm.sh/chart: {{ include "oai-nr-pucchsim.chart" . }} +{{ include "oai-nr-pucchsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-pucchsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-pucchsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-pucchsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-pucchsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-pucchsim/templates/deployment.yaml b/charts/physims/charts/nr-pucchsim/templates/deployment.yaml new file mode 100644 index 0000000000..d783991e0b --- /dev/null +++ b/charts/physims/charts/nr-pucchsim/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-pucchsim.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-nr-pucchsim.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-nr-pucchsim.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-nr-pucchsim + # volumeMounts: + # - mountPath: /opt/oai-nr-pucchsim/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015109" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/nr-pucchsim/templates/service.yaml b/charts/physims/charts/nr-pucchsim/templates/service.yaml new file mode 100644 index 0000000000..9e8760e76b --- /dev/null +++ b/charts/physims/charts/nr-pucchsim/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-pucchsim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-nr-pucchsim + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-nr-pucchsim.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/nr-pucchsim/values.yaml b/charts/physims/charts/nr-pucchsim/values.yaml new file mode 100644 index 0000000000..cf50c0bd3c --- /dev/null +++ b/charts/physims/charts/nr-pucchsim/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-nr-pucchsim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-nr-pucchsim-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/nr-ulschsim/Chart.yaml b/charts/physims/charts/nr-ulschsim/Chart.yaml new file mode 100644 index 0000000000..e2525f0032 --- /dev/null +++ b/charts/physims/charts/nr-ulschsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-ulschsim +description: A Helm subchart for nr-ulschsim network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - nr-ulschsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-ulschsim/templates/NOTES.txt b/charts/physims/charts/nr-ulschsim/templates/NOTES.txt new file mode 100644 index 0000000000..65566932cd --- /dev/null +++ b/charts/physims/charts/nr-ulschsim/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-nr-ulschsim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-nr-ulschsim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-nr-ulschsim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-nr-ulschsim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/nr-ulschsim/templates/_helpers.tpl b/charts/physims/charts/nr-ulschsim/templates/_helpers.tpl new file mode 100644 index 0000000000..9aa13a81f0 --- /dev/null +++ b/charts/physims/charts/nr-ulschsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-ulschsim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-nr-ulschsim.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-nr-ulschsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-ulschsim.labels" -}} +helm.sh/chart: {{ include "oai-nr-ulschsim.chart" . }} +{{ include "oai-nr-ulschsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-ulschsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-ulschsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-ulschsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-ulschsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-ulschsim/templates/deployment.yaml b/charts/physims/charts/nr-ulschsim/templates/deployment.yaml new file mode 100644 index 0000000000..56fb0de5b8 --- /dev/null +++ b/charts/physims/charts/nr-ulschsim/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-ulschsim.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-nr-ulschsim.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-nr-ulschsim.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-nr-ulschsim + # volumeMounts: + # - mountPath: /opt/oai-nr-ulschsim/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015108" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/nr-ulschsim/templates/service.yaml b/charts/physims/charts/nr-ulschsim/templates/service.yaml new file mode 100644 index 0000000000..d34882700e --- /dev/null +++ b/charts/physims/charts/nr-ulschsim/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-ulschsim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-nr-ulschsim + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-nr-ulschsim.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/nr-ulschsim/values.yaml b/charts/physims/charts/nr-ulschsim/values.yaml new file mode 100644 index 0000000000..420b154596 --- /dev/null +++ b/charts/physims/charts/nr-ulschsim/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-nr-ulschsim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-nr-ulschsim-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/nr-ulsim/Chart.yaml b/charts/physims/charts/nr-ulsim/Chart.yaml new file mode 100644 index 0000000000..ede87ea7e4 --- /dev/null +++ b/charts/physims/charts/nr-ulsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-ulsim +description: A Helm subchart for nr-ulsim network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - nr-ulsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-ulsim/templates/NOTES.txt b/charts/physims/charts/nr-ulsim/templates/NOTES.txt new file mode 100644 index 0000000000..6865eeaedf --- /dev/null +++ b/charts/physims/charts/nr-ulsim/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-nr-ulsim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-nr-ulsim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-nr-ulsim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-nr-ulsim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/nr-ulsim/templates/_helpers.tpl b/charts/physims/charts/nr-ulsim/templates/_helpers.tpl new file mode 100644 index 0000000000..90f0bd0e36 --- /dev/null +++ b/charts/physims/charts/nr-ulsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-ulsim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-nr-ulsim.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-nr-ulsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-ulsim.labels" -}} +helm.sh/chart: {{ include "oai-nr-ulsim.chart" . }} +{{ include "oai-nr-ulsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-ulsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-ulsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-ulsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-ulsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-ulsim/templates/deployment.yaml b/charts/physims/charts/nr-ulsim/templates/deployment.yaml new file mode 100644 index 0000000000..c0fa5ceb3b --- /dev/null +++ b/charts/physims/charts/nr-ulsim/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-ulsim.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-nr-ulsim.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-nr-ulsim.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-nr-ulsim + # volumeMounts: + # - mountPath: /opt/oai-nr-ulsim/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015111" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/nr-ulsim/templates/service.yaml b/charts/physims/charts/nr-ulsim/templates/service.yaml new file mode 100644 index 0000000000..95f198d1b1 --- /dev/null +++ b/charts/physims/charts/nr-ulsim/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-nr-ulsim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-nr-ulsim + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-nr-ulsim.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/nr-ulsim/values.yaml b/charts/physims/charts/nr-ulsim/values.yaml new file mode 100644 index 0000000000..7eb8e33fcb --- /dev/null +++ b/charts/physims/charts/nr-ulsim/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-nr-ulsim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-nr-ulsim-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/polartest/Chart.yaml b/charts/physims/charts/polartest/Chart.yaml new file mode 100644 index 0000000000..ae5f5ca263 --- /dev/null +++ b/charts/physims/charts/polartest/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-polartest +description: A Helm subchart for polartest network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - polartest + - RAN + - 4G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/polartest/templates/NOTES.txt b/charts/physims/charts/polartest/templates/NOTES.txt new file mode 100644 index 0000000000..9c2c978de0 --- /dev/null +++ b/charts/physims/charts/polartest/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-polartest.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-polartest.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-polartest.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-polartest.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/polartest/templates/_helpers.tpl b/charts/physims/charts/polartest/templates/_helpers.tpl new file mode 100644 index 0000000000..ce81dbe525 --- /dev/null +++ b/charts/physims/charts/polartest/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-polartest.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-polartest.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-polartest.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-polartest.labels" -}} +helm.sh/chart: {{ include "oai-polartest.chart" . }} +{{ include "oai-polartest.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-polartest.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-polartest.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-polartest.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-polartest.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/polartest/templates/deployment.yaml b/charts/physims/charts/polartest/templates/deployment.yaml new file mode 100644 index 0000000000..01a6efc815 --- /dev/null +++ b/charts/physims/charts/polartest/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-polartest.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-polartest.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-polartest.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-polartest + # volumeMounts: + # - mountPath: /opt/oai-polartest/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015103" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/polartest/templates/service.yaml b/charts/physims/charts/polartest/templates/service.yaml new file mode 100644 index 0000000000..40abb6769e --- /dev/null +++ b/charts/physims/charts/polartest/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-polartest.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-polartest + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-polartest.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/polartest/values.yaml b/charts/physims/charts/polartest/values.yaml new file mode 100644 index 0000000000..496dc8afba --- /dev/null +++ b/charts/physims/charts/polartest/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-polartest. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-polartest-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/smallblocktest/Chart.yaml b/charts/physims/charts/smallblocktest/Chart.yaml new file mode 100644 index 0000000000..74092783ae --- /dev/null +++ b/charts/physims/charts/smallblocktest/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-smallblocktest +description: A Helm subchart for smallblocktest network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - smallblocktest + - RAN + - 4G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/smallblocktest/templates/NOTES.txt b/charts/physims/charts/smallblocktest/templates/NOTES.txt new file mode 100644 index 0000000000..c593dbfe22 --- /dev/null +++ b/charts/physims/charts/smallblocktest/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-smallblocktest.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-smallblocktest.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-smallblocktest.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-smallblocktest.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/smallblocktest/templates/_helpers.tpl b/charts/physims/charts/smallblocktest/templates/_helpers.tpl new file mode 100644 index 0000000000..a3c264b33e --- /dev/null +++ b/charts/physims/charts/smallblocktest/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-smallblocktest.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-smallblocktest.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-smallblocktest.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-smallblocktest.labels" -}} +helm.sh/chart: {{ include "oai-smallblocktest.chart" . }} +{{ include "oai-smallblocktest.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-smallblocktest.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-smallblocktest.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-smallblocktest.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-smallblocktest.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/smallblocktest/templates/deployment.yaml b/charts/physims/charts/smallblocktest/templates/deployment.yaml new file mode 100644 index 0000000000..3439c2597e --- /dev/null +++ b/charts/physims/charts/smallblocktest/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-smallblocktest.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-smallblocktest.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-smallblocktest.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-smallblock + # volumeMounts: + # - mountPath: /opt/oai-smallblocktest/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015107" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/smallblocktest/templates/service.yaml b/charts/physims/charts/smallblocktest/templates/service.yaml new file mode 100644 index 0000000000..d51bf21ce4 --- /dev/null +++ b/charts/physims/charts/smallblocktest/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-smallblocktest.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-smallblocktest + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-smallblocktest.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/smallblocktest/values.yaml b/charts/physims/charts/smallblocktest/values.yaml new file mode 100644 index 0000000000..9dd791265f --- /dev/null +++ b/charts/physims/charts/smallblocktest/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-smallblocktest. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-smallblocktest-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/charts/ulsim/Chart.yaml b/charts/physims/charts/ulsim/Chart.yaml new file mode 100644 index 0000000000..2311d729b4 --- /dev/null +++ b/charts/physims/charts/ulsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-ulsim +description: A Helm subchart for ulsim network function + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.1 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v1 + +keywords: + - Physical Simulator + - ulsim + - RAN + - 4G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/ulsim/templates/NOTES.txt b/charts/physims/charts/ulsim/templates/NOTES.txt new file mode 100644 index 0000000000..91ab3ce0b7 --- /dev/null +++ b/charts/physims/charts/ulsim/templates/NOTES.txt @@ -0,0 +1,15 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-ulsim.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-ulsim.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-ulsim.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-ulsim.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 +{{- end }} diff --git a/charts/physims/charts/ulsim/templates/_helpers.tpl b/charts/physims/charts/ulsim/templates/_helpers.tpl new file mode 100644 index 0000000000..67b6500479 --- /dev/null +++ b/charts/physims/charts/ulsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-ulsim.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "oai-ulsim.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "oai-ulsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-ulsim.labels" -}} +helm.sh/chart: {{ include "oai-ulsim.chart" . }} +{{ include "oai-ulsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-ulsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-ulsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-ulsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-ulsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/ulsim/templates/deployment.yaml b/charts/physims/charts/ulsim/templates/deployment.yaml new file mode 100644 index 0000000000..e8c90dabc1 --- /dev/null +++ b/charts/physims/charts/ulsim/templates/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-ulsim.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "oai-ulsim.selectorLabels" . | nindent 6 }} + strategy: + type: Recreate + template: + metadata: + labels: + {{- include "oai-ulsim.selectorLabels" . | nindent 8 }} + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + ports: + - containerPort: 80 + name: oai-ulsim + # volumeMounts: + # - mountPath: /opt/oai-ulsim/certs + # name: certs + command: ["/bin/sh", "-c"] + args: + - > + export OPENAIR_DIR=/opt/oai-physim && + cd cmake_targets/autotests && + ./run_exec_autotests.bash -g "015101" -q -np -b && + echo "FINISHED" && + sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 diff --git a/charts/physims/charts/ulsim/templates/service.yaml b/charts/physims/charts/ulsim/templates/service.yaml new file mode 100644 index 0000000000..dcc37d6299 --- /dev/null +++ b/charts/physims/charts/ulsim/templates/service.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }} + labels: + {{- include "oai-ulsim.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} +{{- if contains "ClusterIP" .Values.service.type }} + clusterIP: None +{{- end }} + ports: + - name: oai-ulsim + # Port accessible outside cluster + port: {{ .Values.service.port }} + # Port to forward to inside the pod + targetPort: {{ .Values.service.Port }} + protocol: TCP + selector: + {{- include "oai-ulsim.selectorLabels" . | nindent 4 }} diff --git a/charts/physims/charts/ulsim/values.yaml b/charts/physims/charts/ulsim/values.yaml new file mode 100644 index 0000000000..f5110989d8 --- /dev/null +++ b/charts/physims/charts/ulsim/values.yaml @@ -0,0 +1,63 @@ +# Default values for oai-ulsim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +namespace: "oaicicd-ran-tmp" + +image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: temp + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "oai-ulsim-sa" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: true + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/templates/rbac.yaml b/charts/physims/templates/rbac.yaml new file mode 100644 index 0000000000..35f956a203 --- /dev/null +++ b/charts/physims/templates/rbac.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: {{ .Chart.Name }}-{{ .Values.global.namespace }}-rbac +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin +subjects: +- kind: ServiceAccount + name: {{ .Values.global.serviceAccountName }} + namespace: {{ .Values.global.namespace }} diff --git a/charts/physims/templates/serviceaccount.yaml b/charts/physims/templates/serviceaccount.yaml new file mode 100644 index 0000000000..21d094ad38 --- /dev/null +++ b/charts/physims/templates/serviceaccount.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Values.global.serviceAccountName }} diff --git a/charts/physims/values.yaml b/charts/physims/values.yaml new file mode 100644 index 0000000000..b348e822bb --- /dev/null +++ b/charts/physims/values.yaml @@ -0,0 +1,84 @@ +# Default values for oai-physim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +global: + serviceAccountName: oai-physim-sa + namespace: "oaicicd-ran-tmp" + image: + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-physim + version: TAG + +## Declaring values specific to coressponding physim to overwrite + +dlsim: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +ulsim: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +ldpctest: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +polartest: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +nr-pbchsim: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +nr-dlsim: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +nr-dlschsim: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +smallblocktest: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +nr-ulschsim: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +nr-pucchsim: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +nr-ulsim: + replicaCount: 1 + service: + type: ClusterIP + port: 80 + +nr-prachsim: + replicaCount: 1 + service: + type: ClusterIP + port: 80 diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index fbf9ba8f4b..a4d7a4bf92 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -27,6 +27,9 @@ def nodeExecutor = params.nodeExecutor def doMandatoryTests = false def doFullTestsuite = false +// +def gitCommitAuthorEmailAddr + pipeline { agent { label nodeExecutor @@ -152,21 +155,64 @@ pipeline { } } } + stage ("CppCheck Analysis") { + steps { + script { + triggerSlaveJob ('RAN-cppcheck', 'CppCheck Analysis') + } + } + post { + always { + script { + finalizeSlaveJob('RAN-cppcheck') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } + } + } + stage ("Image Test Processes") { + parallel { + stage ("Physical Simulators") { + when { expression {doMandatoryTests} } + steps { + script { + triggerSlaveJob ('RAN-PhySim-Cluster', 'Test-Physim-Cluster') + } + } + post { + always { + script { + finalizeSlaveJob('RAN-PhySim-Cluster') + } + } + failure { + script { + currentBuild.result = 'FAILURE' + } + } + } + } } } } post { always { script { + def eSubject = JOB_NAME + ' - Build # ' + BUILD_ID + ' - ' + currentBuild.result + '!' + def eBody = "Hi,\n\n" + eBody += "Here are attached HTML report files for " + JOB_NAME + " - Build # " + BUILD_ID + " - " + currentBuild.result + "!\n\n" + eBody += "Regards,\n" + eBody += "OAI CI Team" emailext attachmentsPattern: '*results*.html', - body: '''Hi, - -Here are attached HTML report files for $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS! - -Regards, -OAI CI Team''', + body: eBody, replyTo: 'no-reply@openairinterface.org', - subject: '$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!', + subject: eSubject, to: gitCommitAuthorEmailAddr if (fileExists('.git/CI_COMMIT_MSG')) { diff --git a/ci-scripts/Jenkinsfile-git-dashboard b/ci-scripts/Jenkinsfile-git-dashboard new file mode 100644 index 0000000000..6ebd46bc76 --- /dev/null +++ b/ci-scripts/Jenkinsfile-git-dashboard @@ -0,0 +1,45 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + + +pipeline { + agent { + label pythonExecutor + } + stages { + stage ("gDashboard") { + steps { + script { + //retrieve MR data from gitlab and export to gSheet + sh returnStdout: true, script: 'python3 ci-scripts/ran_dashboard.py' + } + } + } + } +} + + diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index de49275b7e..d5c526acb3 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -196,16 +196,6 @@ pipeline { } } - stage ("Start VM -- phy-sim") { - steps { - lock (vmResource) { - timeout (time: 5, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" - } - } - } - } - stage ("Start VM -- enb-ethernet") { steps { lock (vmResource) { @@ -224,33 +214,14 @@ pipeline { } } } - } + } - stage ("Start VM -- cppcheck") { - steps { - lock (vmResource) { - timeout (time: 7, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" - } - } - } - } - stage ("Variant Builds") { parallel { - stage ("Analysis with cppcheck") { - steps { - gitlabCommitStatus(name: "Analysis with cppcheck") { - timeout (time: 30, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" - } - } - } - } stage ("Build basic simulator") { steps { gitlabCommitStatus(name: "Build basic-sim") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -259,7 +230,7 @@ pipeline { stage ("Build 5G gNB-USRP") { steps { gitlabCommitStatus(name: "Build gNB-USRP") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -268,25 +239,16 @@ pipeline { stage ("Build 5G NR-UE-USRP") { steps { gitlabCommitStatus(name: "Build nr-UE-USRP") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant nr-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } } - stage ("Build physical simulators") { - steps { - gitlabCommitStatus(name: "Build phy-sim") { - timeout (time: 30, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" - } - } - } - } stage ("Build eNB-ethernet") { steps { gitlabCommitStatus(name: "Build eNB-ethernet") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -297,7 +259,7 @@ pipeline { // This is typically the last one to finish. lock (vmResource) { gitlabCommitStatus(name: "Build UE-ethernet") { - timeout (time: 30, unit: 'MINUTES') { + timeout (time: 45, unit: 'MINUTES') { sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } @@ -315,9 +277,9 @@ pipeline { script { dir ('archives') { if (fileExists('red_hat')) { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" + sh "zip -r -qq vm_build_logs.zip basic_sim enb_eth ue_eth gnb_usrp nr_ue_usrp red_hat" } else { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth gnb_usrp nr_ue_usrp" + sh "zip -r -qq vm_build_logs.zip basic_sim enb_eth ue_eth gnb_usrp nr_ue_usrp" } } if(fileExists('archives/vm_build_logs.zip')) { @@ -325,16 +287,6 @@ pipeline { } if ("MERGE".equals(env.gitlabActionType)) { sh "./ci-scripts/oai-ci-vm-tool report-build --workspace $WORKSPACE --git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}" - // If the merge request has introduced more CPPCHECK errors or warnings, notifications in GitLab - if (fileExists('oai_cppcheck_added_errors.txt')) { - def ret=readFile('./oai_cppcheck_added_errors.txt').trim(); - if ("0".equals(ret)) { - echo "No added cppcheck warnings/errors in this merge request" - } else { - def message = "OAI " + JOB_NAME + " build (" + BUILD_ID + "): Some modified files in Merge Request MAY have INTRODUCED up to " + ret + " CPPCHECK errors/warnings" - addGitLabMRComment comment: message - } - } // If the merge request has introduced compilation warnings, notifications in GitLab sh "./ci-scripts/checkAddedWarnings.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}" def res=readFile('./oai_warning_files.txt').trim(); @@ -361,26 +313,6 @@ pipeline { parallel { stage ("VM-based tests") { stages { - stage ("Test physical simulators") { - when { - expression {doMandatoryTests} - } - steps { - lock (vmResource) { - script { - timeout (time: 90, unit: 'MINUTES') { - try { - gitlabCommitStatus(name: "Test phy-sim") { - sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" - } - } catch (Exception e) { - currentBuild.result = 'FAILURE' - } - } - } - } - } - } stage ("Build Flexran Controller") { when { expression {doFlexranCtrlTest && doMandatoryTests} @@ -745,7 +677,7 @@ pipeline { script { if (doMandatoryTests) { dir ('archives') { - sh "if [ -d basic_sim/test ] || [ -d phy_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" + sh "if [ -d basic_sim/test ] || [ -d rf_sim/test ] || [ -d l2_sim/test ]; then zip -r -qq vm_tests_logs.zip */test ; fi" } if(fileExists('archives/vm_tests_logs.zip')) { archiveArtifacts artifacts: 'archives/vm_tests_logs.zip' diff --git a/ci-scripts/Jenkinsfile-physim-deploy b/ci-scripts/Jenkinsfile-physim-deploy new file mode 100644 index 0000000000..eac572e6cd --- /dev/null +++ b/ci-scripts/Jenkinsfile-physim-deploy @@ -0,0 +1,233 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Location of the executor node +def pythonExecutor = params.pythonExecutor + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the resource +def ciEpcResource = params.epcResource + +// Global Parameters. Normally they should be populated when the master job +// triggers the slave job with parameters +def eNB_Repository +def eNB_Branch +def eNB_CommitID +def eNB_AllowMergeRequestProcess = false +def eNB_TargetBranch + +// Flags +def scmEvent = false +def upstreamEvent = false + +//------------------------------------------------------------------------------- +// Pipeline start +pipeline { + agent { + label pythonExecutor + } + options { + disableConcurrentBuilds() + timestamps() + ansiColor('xterm') + lock(ciEpcResource) + } + + stages { + stage ('Verify Parameters') { + steps { + script { + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + + JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"' + JOB_TIMESTAMP = JOB_TIMESTAMP.trim() + + def allParametersPresent = true + + // It is already to late to check it + if (params.pythonExecutor != null) { + echo "eNB CI executor node : ${pythonExecutor}" + } + // If not present picking a default Stage Name + if (params.pipelineTestStageName == null) { + // picking default + testStageName = 'Template Test Stage' + } + + if (params.smartphonesResource == null) { + allParametersPresent = false + } + if (params.eNB_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB_Credentials == null) { + allParametersPresent = false + } + // the following 4 parameters should be pushed by the master trigger + // if not present, take the job GIT variables (used for developing) + if (params.eNB_Repository == null) { + eNB_Repository = env.GIT_URL + } else { + eNB_Repository = params.eNB_Repository + } + echo "eNB_Repository : ${eNB_Repository}" + if (params.eNB_Branch == null) { + eNB_Branch = env.GIT_BRANCH + } else { + eNB_Branch = params.eNB_Branch + } + echo "eNB_Branch : ${eNB_Branch}" + if (params.eNB_CommitID == null) { + eNB_CommitID = env.GIT_COMMIT + } else { + eNB_CommitID = params.eNB_CommitID + } + echo "eNB_CommitID : ${eNB_CommitID}" + if (params.eNB_mergeRequest != null) { + eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { + if (params.eNB_TargetBranch != null) { + eNB_TargetBranch = params.eNB_TargetBranch + } else { + eNB_TargetBranch = 'develop' + } + echo "eNB_TargetBranch : ${eNB_TargetBranch}" + } + } + + if (params.EPC_IPAddress == null) { + allParametersPresent = false + } + if (params.EPC_Type == null) { + allParametersPresent = false + } + if (params.EPC_SourceCodePath == null) { + allParametersPresent = false + } + if (params.EPC_Credentials == null) { + allParametersPresent = false + } + + if (params.ADB_IPAddress == null) { + allParametersPresent = false + } + if (params.ADB_Credentials == null) { + allParametersPresent = false + } + if (params.OC_Credentials == null) { + allParametersPresent = false + } + if (params.OC_ProjectName == null) { + allParametersPresent = false + } + if (allParametersPresent) { + echo "All parameters are present" + if (eNB_AllowMergeRequestProcess) { + sh "git fetch" + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" + } else { + sh "git fetch" + sh "git checkout -f ${eNB_CommitID}" + } + } else { + echo "Some parameters are missing" + sh "./ci-scripts/fail.sh" + } + } + } + } + + stage ("Deploy and Test") { + steps { + script { + dir ('ci-scripts') { + echo "\u2705 \u001B[32m${testStageName}\u001B[0m" + // If not present picking a default XML file + if (params.pythonTestXmlFile == null) { + // picking default + testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml' + echo "Test XML file(default): ${testXMLFile}" + mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " " + } else { + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } + } + } + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password'] + ]) { + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + try { + sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName}" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } + } + } + sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" + } + } + } + } + } + stage ("Log Collection") { + steps { + script { + dir ('ci-scripts') { + // Zipping all archived log files + sh "zip -r -qq physim_deploytest_logs_${env.BUILD_ID}.zip physim_test_logs_*/*" + sh "rm -rf physim_test_logs_*/" + if (fileExists("physim_deploytest_logs_${env.BUILD_ID}.zip")) { + archiveArtifacts artifacts: "physim_deploytest_logs_${env.BUILD_ID}.zip" + } + if (fileExists("test_results.html")) { + sh "mv test_results.html test_results-${env.JOB_NAME}.html" + sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: ${BUILD_ID}#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" + archiveArtifacts artifacts: "test_results-${env.JOB_NAME}.html" + } + } + } + } + } + } +} diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long new file mode 100644 index 0000000000..fb7f3738d2 --- /dev/null +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long @@ -0,0 +1,304 @@ +#!/bin/groovy +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +// Template Jenkins Declarative Pipeline script to run Test w/ RF HW + +// Location of the python executor node shall be in the same subnet as the others servers +def pythonExecutor = params.pythonExecutor + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the phone resource +def ciSmartPhonesResource1 = params.SmartPhonesResource1 +def ciSmartPhonesResource2 = params.SmartPhonesResource2 + +// Global Parameters. Populated when the master job +// triggers the slave job with parameters +def eNB_Repository = "https://gitlab.eurecom.fr/oai/openairinterface5g.git" +def eNB_Branch = "develop" +def eNB_CommitID +def eNB_AllowMergeRequestProcess = false +def eNB_TargetBranch = "develop" +def eNB_MR = "develop" + +pipeline { + agent { + label pythonExecutor + } + options { + disableConcurrentBuilds() + ansiColor('xterm') + lock(extra: [[resource: ciSmartPhonesResource2]], resource: ciSmartPhonesResource1) + } + stages { + stage("Build Init") { + steps { + script { + //retrieve latest commit ID from branch + latest_commit_from_branch= sh returnStdout: true, script: 'git log -1 origin/${eNB_Branch} | grep commit' + echo "Branch ${eNB_Branch}" + echo "${latest_commit_from_branch}" + tmp=latest_commit_from_branch.split() + echo "${tmp}" + eNB_CommitID = tmp[1] + echo "eNB_CommitID ${eNB_CommitID}" + // update the build name and description + buildName "${params.eNB_MR}" + buildDescription "Commit : ${eNB_CommitID}" + } + } + } + stage ("Verify Parameters") { + steps { + script { + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + def allParametersPresent = true + + // It is already to late to check it + if (params.pythonExecutor != null) { + echo "eNB CI executor node : ${pythonExecutor}" + } + // If not present picking a default Stage Name + if (params.pipelineTestStageName == null) { + // picking default + testStageName = 'Template Test Stage' + } + + if (params.SmartPhonesResource1 == null) { + allParametersPresent = false + } + if (params.SmartPhonesResource2 == null) { + allParametersPresent = false + } + // 1st eNB parameters + if (params.eNB_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB_Credentials == null) { + allParametersPresent = false + } + // 2nd eNB parameters + if (params.eNB1_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB1_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB1_Credentials == null) { + allParametersPresent = false + } + // 3rd eNB parameters + if (params.eNB2_IPAddress == null) { + allParametersPresent = false + } + if (params.eNB2_SourceCodePath == null) { + allParametersPresent = false + } + if (params.eNB2_Credentials == null) { + allParametersPresent = false + } + // the following 4 parameters should be pushed by the master trigger + // if not present, take the job GIT variables (used for developing) + if (params.eNB_Repository == null) { + eNB_Repository = env.GIT_URL + } else { + eNB_Repository = params.eNB_Repository + } + echo "eNB_Repository : ${eNB_Repository}" + if (params.eNB_Branch == null) { + eNB_Branch = env.GIT_BRANCH + } else { + eNB_Branch = params.eNB_Branch + } + echo "eNB_Branch : ${eNB_Branch}" + //if (params.eNB_CommitID == null) { + // eNB_CommitID = env.GIT_COMMIT + //} else { + // eNB_CommitID = params.eNB_CommitID + //} + echo "eNB_CommitID : ${eNB_CommitID}" + if (params.eNB_AllowMergeRequestProcess!= null) { + eNB_AllowMergeRequestProcess = params.eNB_AllowMergeRequestProcess + if (eNB_AllowMergeRequestProcess) { + if (params.eNB_TargetBranch != null) { + eNB_TargetBranch = params.eNB_TargetBranch + } else { + eNB_TargetBranch = 'develop' + } + echo "eNB_TargetBranch : ${eNB_TargetBranch}" + } + } + + if (params.EPC_IPAddress == null) { + allParametersPresent = false + } + if (params.EPC_Type == null) { + allParametersPresent = false + } + if (params.EPC_SourceCodePath == null) { + allParametersPresent = false + } + if (params.EPC_Credentials == null) { + allParametersPresent = false + } + + if (params.ADB_IPAddress == null) { + allParametersPresent = false + } + if (params.ADB_Credentials == null) { + allParametersPresent = false + } + + if (allParametersPresent) { + echo "All parameters are present" + if (eNB_AllowMergeRequestProcess) { + sh "git fetch" + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" + } else { + sh "git fetch" + sh "git checkout -f ${eNB_CommitID}" + } + } else { + echo "Some parameters are missing" + sh "./ci-scripts/fail.sh" + } + } + } + } + stage ("Build and Test") { + steps { + script { + dir ('ci-scripts') { + echo "\u2705 \u001B[32m${testStageName}\u001B[0m" + // If not present picking a default XML file + if (params.pythonTestXmlFile == null) { + // picking default + testXMLFile = 'xml_files/enb_usrpB210_band7_50PRB.xml' + echo "Test XML file(default): ${testXMLFile}" + mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " " + } else { + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } + } + } + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB1_Credentials}", usernameVariable: 'eNB1_Username', passwordVariable: 'eNB1_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB2_Credentials}", usernameVariable: 'eNB2_Username', passwordVariable: 'eNB2_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'] + ]) { + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + try { + sh "python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } + } + } + sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" + } + } + } + } + } + stage('Log Collection') { + parallel { + stage('Log Collection (eNB - Build)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] + ]) { + echo '\u2705 \u001B[32mLog Collection (eNB - Build)\u001B[0m' + sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (eNB - Build)\u001B[0m' + sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("build.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "build.log.${env.BUILD_ID}.zip" + } + } + } + } + stage('Log Collection (eNB - Run)') { + steps { + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] + ]) { + echo '\u2705 \u001B[32mLog Collection (eNB - Run)\u001B[0m' + sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" + + echo '\u2705 \u001B[32mLog Transfer (eNB - Run)\u001B[0m' + sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true" + } + script { + if(fileExists("enb.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "enb.log.${env.BUILD_ID}.zip" + } + if(fileExists("ci-scripts/test_results.html")) { + sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html" + sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: ${BUILD_ID}#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" + archiveArtifacts "test_results-${JOB_NAME}.html" + } + } + } + } + } + } + } + + post { + always { + script { + if (params.pipelineZipsConsoleLog != null) { + if (params.pipelineZipsConsoleLog) { + echo "Archiving Jenkins console log" + sh "wget --no-check-certificate --no-proxy ${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}/consoleText -O consoleText.log || true" + sh "zip -m consoleText.log.${env.BUILD_ID}.zip consoleText.log || true" + if(fileExists("consoleText.log.${env.BUILD_ID}.zip")) { + archiveArtifacts "consoleText.log.${env.BUILD_ID}.zip" + } + } + } + } + } + } +} diff --git a/ci-scripts/Jenkinsfile-trig-nsa b/ci-scripts/Jenkinsfile-trig-nsa index 3dd5ce3b50..b9172225ca 100644 --- a/ci-scripts/Jenkinsfile-trig-nsa +++ b/ci-scripts/Jenkinsfile-trig-nsa @@ -37,7 +37,7 @@ pipeline { steps { script { //retrieve MR that are opened nd with tag READY_TO_BE_MERGED - MR_LIST= sh returnStdout: true, script: 'curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100&labels=READY_TO_BE_MERGED" | jq ".[].iid" || true ' + MR_LIST= sh returnStdout: true, script: 'curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100&labels=NSA" | jq ".[].iid" || true ' echo "List of selected MR:\n${MR_LIST}" def MR_ARRAY = MR_LIST.split('\n') //for every selected MR, retrieve the branch name and the latest commit @@ -48,7 +48,7 @@ pipeline { COMMIT_ID=COMMIT_ID.trim() echo "Testing NSA on : ${MR} ${SRC_BRANCH} ${COMMIT_ID}" //calling NSA sub job - build job: "RAN-CI-NSA-B210", wait : false, propagate : false, parameters: [ + build job: "RAN-CI-NSA-B210-N310-ModuleUE", wait : false, propagate : false, parameters: [ string(name: 'eNB_MR', value: String.valueOf(MR)), string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)), string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)), diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index 248e873cdd..0ed12bfc08 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -41,7 +41,7 @@ import constants as CONST #----------------------------------------------------------- -def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): +def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): py_param_file_present = False @@ -80,6 +80,8 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranRepository=matchReg.group(1) ldpc.ranRepository=matchReg.group(1) CONTAINERS.ranRepository=matchReg.group(1) + SCA.ranRepository=matchReg.group(1) + PHYSIM.ranRepository=matchReg.group(1) elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE) @@ -92,6 +94,8 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.ranAllowMerge=True HTML.ranAllowMerge=True CONTAINERS.ranAllowMerge=True + SCA.ranAllowMerge=True + PHYSIM.ranAllowMerge=True elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE) @@ -102,6 +106,8 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranBranch=matchReg.group(1) ldpc.ranBranch=matchReg.group(1) CONTAINERS.ranBranch=matchReg.group(1) + SCA.ranBranch=matchReg.group(1) + PHYSIM.ranBranch=matchReg.group(1) elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE) @@ -112,6 +118,8 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranCommitID=matchReg.group(1) ldpc.ranCommitID=matchReg.group(1) CONTAINERS.ranCommitID=matchReg.group(1) + SCA.ranCommitID=matchReg.group(1) + PHYSIM.ranCommitID=matchReg.group(1) elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE) @@ -122,12 +130,16 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): HTML.ranTargetBranch=matchReg.group(1) ldpc.ranTargetBranch=matchReg.group(1) CONTAINERS.ranTargetBranch=matchReg.group(1) + SCA.ranTargetBranch=matchReg.group(1) + PHYSIM.ranTargetBranch=matchReg.group(1) elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.eNBIPAddress=matchReg.group(1) ldpc.eNBIpAddr=matchReg.group(1) CONTAINERS.eNBIPAddress=matchReg.group(1) + SCA.eNBIPAddress=matchReg.group(1) + PHYSIM.eNBIPAddress=matchReg.group(1) elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1IPAddress=matchReg.group(1) @@ -142,6 +154,8 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.eNBUserName=matchReg.group(1) ldpc.eNBUserName=matchReg.group(1) CONTAINERS.eNBUserName=matchReg.group(1) + SCA.eNBUserName=matchReg.group(1) + PHYSIM.eNBUserName=matchReg.group(1) elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1UserName=matchReg.group(1) @@ -156,6 +170,8 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.eNBPassword=matchReg.group(1) ldpc.eNBPassWord=matchReg.group(1) CONTAINERS.eNBPassword=matchReg.group(1) + SCA.eNBPassword=matchReg.group(1) + PHYSIM.eNBPassword=matchReg.group(1) elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1Password=matchReg.group(1) @@ -170,6 +186,8 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): RAN.eNBSourceCodePath=matchReg.group(1) ldpc.eNBSourceCodePath=matchReg.group(1) CONTAINERS.eNBSourceCodePath=matchReg.group(1) + SCA.eNBSourceCodePath=matchReg.group(1) + PHYSIM.eNBSourceCodePath=matchReg.group(1) elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1SourceCodePath=matchReg.group(1) @@ -239,6 +257,15 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP): finalStatus = matchReg.group(1) if ((finalStatus == 'true') or (finalStatus == 'True')): CiTestObj.finalStatus = True + elif re.match('^\-\-OCUserName=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-OCUserName=(.+)$', myArgv, re.IGNORECASE) + PHYSIM.OCUserName = matchReg.group(1) + elif re.match('^\-\-OCPassword=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-OCPassword=(.+)$', myArgv, re.IGNORECASE) + PHYSIM.OCPassword = matchReg.group(1) + elif re.match('^\-\-OCProjectName=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-OCProjectName=(.+)$', myArgv, re.IGNORECASE) + PHYSIM.OCProjectName = matchReg.group(1) else: HELP.GenericHelp(CONST.Version) sys.exit('Invalid Parameter: ' + myArgv) diff --git a/ci-scripts/auto_start_gnb.sh b/ci-scripts/auto_start_gnb.sh new file mode 100644 index 0000000000..86ffc66d18 --- /dev/null +++ b/ci-scripts/auto_start_gnb.sh @@ -0,0 +1,7 @@ +#!/bin/bash +while true +do + echo "gNB will be started automatically..." + sleep 1 + sudo .././cmake_targets/ran_build/build/nr-softmodem -E -O ../targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +done diff --git a/ci-scripts/buildOnRH.sh b/ci-scripts/buildOnRH.sh deleted file mode 100755 index eaff097c88..0000000000 --- a/ci-scripts/buildOnRH.sh +++ /dev/null @@ -1,216 +0,0 @@ -#!/bin/bash -#/* -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ - -function usage { - echo "OAI RedHat Build Check script" - echo " Original Author: Raphael Defosseux" - - echo "" - echo "Usage:" - echo "------" - echo " buildOnRH.sh [OPTIONS]" - echo "" - echo "Options:" - echo "--------" - echo " --job-name #### OR -jn ####" - echo " Specify the name of the Jenkins job." - echo "" - echo " --build-id #### OR -id ####" - echo " Specify the build ID of the Jenkins job." - echo "" - echo " --workspace #### OR -ws ####" - echo " Specify the workspace." - echo "" - echo " --remote-host #### OR -rh ####" - echo " Specify the RedHat remote server." - echo "" - echo " --remote-user-name #### OR -ru ####" - echo " Specify the RedHat remote server username." - echo "" - echo " --remote-password #### OR -rp ####" - echo " Specify the RedHat remote server password." - echo "" - echo " --remote-path #### OR -ra ####" - echo " Specify the RedHat remote server path to work on." - echo "" -} - -if [ $# -lt 1 ] || [ $# -gt 14 ] -then - echo "Syntax Error: not the correct number of arguments" - echo "" - usage - exit 1 -fi - -RH_HOST=XX -RH_USER=XX -RH_PASSWD=XX -RH_PATH=XX -JOB_NAME=XX -BUILD_ID=XX - -while [[ $# -gt 0 ]] -do -key="$1" - -case $key in - -h|--help) - shift - usage - exit 0 - ;; - -jn|--job-name) - JOB_NAME="$2" - shift - shift - ;; - -id|--build-id) - BUILD_ID="$2" - shift - shift - ;; - -ws|--workspace) - JENKINS_WKSP="$2" - shift - shift - ;; - -rh|--remote-host) - RH_HOST="$2" - shift - shift - ;; - -ru|--remote-user-name) - RH_USER="$2" - shift - shift - ;; - -rp|--remote-password) - RH_PASSWD="$2" - shift - shift - ;; - -ra|--remote-path) - RH_PATH="$2" - shift - shift - ;; - *) - echo "Syntax Error: unknown option: $key" - echo "" - usage - exit 1 -esac -done - -if [ ! -f $JENKINS_WKSP/localZip.zip ] -then - echo "Missing localZip.zip file!" - exit 1 -fi - -if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] || [ "$RH_HOST" == "XX" ] || [ "$RH_USER" == "XX" ] || [ "$RH_PASSWD" == "XX" ] || [ "$RH_PATH" == "XX" ] -then - echo "Missing options" - usage - exit 1 -fi - -echo "############################################################" -echo "Copying GIT repo into RedHat Server" -echo "############################################################" -echo "rm -Rf ${RH_PATH}" >> rh-cmd.txt -echo "mkdir -p ${RH_PATH}" >> rh-cmd.txt - -sshpass -p ${RH_PASSWD} ssh -o 'StrictHostKeyChecking no' ${RH_USER}@${RH_HOST} < rh-cmd.txt -rm -f rh-cmd.txt - -echo "############################################################" -echo "Running install and build script on RedHat Server" -echo "############################################################" -sshpass -p ${RH_PASSWD} scp -o 'StrictHostKeyChecking no' $JENKINS_WKSP/localZip.zip ${RH_USER}@${RH_HOST}:${RH_PATH} - -echo "cd ${RH_PATH}" > rh-cmd.txt -echo "unzip -qq localZip.zip" >> rh-cmd.txt -echo "source oaienv" >> rh-cmd.txt -echo "cd cmake_targets" >> rh-cmd.txt -echo "mkdir -p log" >> rh-cmd.txt -echo "./build_oai -I -w USRP --eNB > log/install-build.txt 2>&1" >> rh-cmd.txt -sshpass -p ${RH_PASSWD} ssh -o 'StrictHostKeyChecking no' ${RH_USER}@${RH_HOST} < rh-cmd.txt - -rm -f rh-cmd.txt - -echo "############################################################" -echo "Creating a tmp folder to store results and artifacts" -echo "############################################################" -if [ ! -d $JENKINS_WKSP/archives ] -then - mkdir -p $JENKINS_WKSP/archives -fi - -ARCHIVES_LOC=$JENKINS_WKSP/archives/red_hat -if [ ! -d $ARCHIVES_LOC ] -then - mkdir -p $ARCHIVES_LOC -fi - -sshpass -p ${RH_PASSWD} scp -o 'StrictHostKeyChecking no' ${RH_USER}@${RH_HOST}:${RH_PATH}/cmake_targets/log/*.txt $ARCHIVES_LOC - -echo "############################################################" -echo "Checking build status" -echo "############################################################" - -LOG_PATTERN=.Rel15.txt -NB_PATTERN_FILES=7 - -LOG_FILES=`ls $ARCHIVES_LOC/*.txt` -STATUS=0 -NB_FOUND_FILES=0 - -for FULLFILE in $LOG_FILES -do - if [[ $FULLFILE == *"$LOG_PATTERN"* ]] - then - filename=$(basename -- "$FULLFILE") - PASS_PATTERN=`echo $filename | sed -e "s#$LOG_PATTERN##"` - LOCAL_STAT=`egrep -c "Built target $PASS_PATTERN" $FULLFILE` - if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi - NB_FOUND_FILES=$((NB_FOUND_FILES + 1)) - fi -done - -if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ] -then - echo "Expecting $NB_PATTERN_FILES log files and found $NB_FOUND_FILES" - STATUS=-1 -fi - -echo "COMMAND: build_oai -I -w USRP --eNB" > $ARCHIVES_LOC/build_final_status.log -if [ $STATUS -eq 0 ] -then - echo "BUILD_OK" >> $ARCHIVES_LOC/build_final_status.log - echo "STATUS seems OK" -else - echo "BUILD_KO" >> $ARCHIVES_LOC/build_final_status.log - echo "STATUS failed?" -fi -exit $STATUS diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh index 2b1a5e0c71..f4cf3931dd 100755 --- a/ci-scripts/buildOnVM.sh +++ b/ci-scripts/buildOnVM.sh @@ -62,7 +62,7 @@ function build_on_vm { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/build_fr1_template.yaml b/ci-scripts/build_fr1_template.yaml index 2a8f9cc6a0..02e49bc4b5 100755 --- a/ci-scripts/build_fr1_template.yaml +++ b/ci-scripts/build_fr1_template.yaml @@ -1,15 +1,15 @@ ranRepository : https://gitlab.eurecom.fr/oai/openairinterface5g.git -ranBranch : BRANCH_NAME -ranCommitID : COMMIT_ID -ranAllowMerge : 'true' +ranBranch : integration_2021_wk13_a +ranCommitID : 104aa7eed5d6702c1b9da663414079ef698da206 +ranAllowMerge : 'yes' ranTargetBranch : develop steps: - InitiateHtml,none - TesteNB,xml_files/fr1_multi_node_build.xml - TesteNB,xml_files/fr1_epc_start.xml - - TesteNB,xml_files/fr1_ran_ue_base.xml #ue toggle, nodes initialize, ue toggle, ping, nodes terminate + - TesteNB,xml_files/fr1_nsa_base_next.xml #ue toggle, nodes initialize, ue toggle, ping, nodes terminate - TesteNB,xml_files/fr1_epc_closure.xml diff --git a/ci-scripts/ci_ctl_qtel.py b/ci-scripts/ci_ctl_qtel.py new file mode 100644 index 0000000000..3785d7ee89 --- /dev/null +++ b/ci-scripts/ci_ctl_qtel.py @@ -0,0 +1,86 @@ +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# +# Required Python Version +# Python 3.x +# +#--------------------------------------------------------------------- + +#usage example: +#sudo python3 ci_ctl_qtel.py /dev/ttyUSB2 wup +#sudo python3 ci_ctl_qtel.py /dev/ttyUSB2 detach + + +import sys +import time +import serial + + +class qtel_ctl: + #--------------- + #private methods + #--------------- + def __init__(self, usb_port_at): + self.QUECTEL_USB_PORT_AT = usb_port_at #ex : '/dev/ttyUSB2' + self.modem = serial.Serial(self.QUECTEL_USB_PORT_AT, timeout=1) + self.cmd_dict= {"wup": self.wup,"detach":self.detach}#dictionary of function pointers + + def __set_modem_state(self,ser,state): + self.__send_command(ser,"AT+CFUN={}\r".format(state)) + + def __send_command(self,ser,com): + ser.write(com.encode()) + time.sleep(0.1) + ret=[] + while ser.inWaiting()>0: + print("waiting") + msg=ser.readline() + msg=msg.decode("utf-8") + msg=msg.replace("\r","") + msg=msg.replace("\n","") + print(msg) + if msg!="": + ret.append(msg) + else: + print("msg empty") + return ret + + #-------------- + #public methods + #-------------- + def wup(self):#sending AT+CFUN=0, then AT+CFUN=1 + self.__set_modem_state(self.modem,'0') + time.sleep(3) + self.__set_modem_state(self.modem,'1') + + def detach(self):#sending AT+CFUN=0 + self.__set_modem_state(self.modem,'0') + + + + +if __name__ == "__main__": + #argv[1] : usb port + #argv[2] : qtel command (see function pointers dict "wup", "detach" etc ...) + command = sys.argv[2] + Module=qtel_ctl(sys.argv[1]) + #calling the function to be applied + Module.cmd_dict[command]() diff --git a/ci-scripts/ci_ueinfra.yaml b/ci-scripts/ci_ueinfra.yaml new file mode 100644 index 0000000000..c778b1cad3 --- /dev/null +++ b/ci-scripts/ci_ueinfra.yaml @@ -0,0 +1,32 @@ +idefix: + ID: idefix + State : enabled + Kind : quectel + Process : + Name : quectel-CM + Cmd : /home/oaicicd/quectel-CM/quectel-CM -s oai.ipv4 -4 + WakeupScript : ci_ctl_qtel.py /dev/ttyUSB2 wup + DetachScript : ci_ctl_qtel.py /dev/ttyUSB2 detach + PLMN : 22201 + UENetwork : enxb22a941dbf00 + HostIPAddress : 192.168.18.188 + HostUsername : oaicicd + HostPassword : oaicicd + HostSourceCodePath : none +dummy: + ID: '' + State : '' + Kind : '' + Process : + Name : '' + Cmd : '' + WakeupScript : '' + DetachScript : '' + PLMN : 22201 + UENetwork : wwan0 + HostIPAddress : 192.168.18.188 + HostUsername : oaicicd + HostPassword : oaicicd + HostSourceCodePath : none + + diff --git a/ci-scripts/cls_ci_ueinfra.py b/ci-scripts/cls_ci_ueinfra.py new file mode 100644 index 0000000000..0326a92a4f --- /dev/null +++ b/ci-scripts/cls_ci_ueinfra.py @@ -0,0 +1,57 @@ +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# +# Required Python Version +# Python 3.x +# +#--------------------------------------------------------------------- + +#to use isfile +import os +import sys +import logging +#to create a SSH object locally in the methods +import sshconnection +#time.sleep +import time +#to load ue infrastructure dictionary +import yaml + +class InfraUE: + def __init__(self): + self.ci_ue_infra ={} + + +#-----------------$ +#PUBLIC Methods$ +#-----------------$ + + #This method reads the yaml file describing the multi-UE infrastructure + #and stores the infra permanently in the related class attribute self.ci_ue_infra + def Get_UE_Infra(self,ue_infra_filename): + f_yaml=ue_infra_filename + with open(f_yaml,'r') as file: + logging.debug('Loading UE infrastructure from file '+f_yaml) + #load it permanently in the class attribute + self.ci_ue_infra = yaml.load(file,Loader=yaml.FullLoader) + + + diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 0debe42468..dff0838d49 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -83,10 +83,12 @@ class Containerize(): self.flexranCtrlDeployed = False self.flexranCtrlIpAddress = '' self.cli = '' + self.cliBuildOptions = '' self.dockerfileprefix = '' self.host = '' self.allImagesSize = {} self.collectInfo = {} + #----------------------------------------------------------- # Container management functions #----------------------------------------------------------- @@ -124,9 +126,11 @@ class Containerize(): if self.host == 'Ubuntu': self.cli = 'docker' self.dockerfileprefix = '.ubuntu18' + self.cliBuildOptions = '--no-cache' elif self.host == 'Red Hat': self.cli = 'sudo podman' self.dockerfileprefix = '.rhel8.2' + self.cliBuildOptions = '--no-cache --disable-compression' imageNames = [] result = re.search('eNB', self.imageKind) @@ -144,6 +148,8 @@ class Containerize(): imageNames.append(('oai-gnb', 'gNB')) imageNames.append(('oai-lte-ue', 'lteUE')) imageNames.append(('oai-nr-ue', 'nrUE')) + if self.host == 'Red Hat': + imageNames.append(('oai-physim', 'phySim')) if len(imageNames) == 0: imageNames.append(('oai-enb', 'eNB')) @@ -156,7 +162,7 @@ class Containerize(): # on RedHat/CentOS .git extension is mandatory result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) if result is not None: - full_ran_repo_name = self.ranRepository + full_ran_repo_name = self.ranRepository.replace('git/', 'git') else: full_ran_repo_name = self.ranRepository + '.git' mySSH.command('mkdir -p ' + lSourcePath, '\$', 5) @@ -170,7 +176,7 @@ class Containerize(): mySSH.command('mkdir -p cmake_targets/log', '\$', 5) # if the commit ID is provided use it to point to it if self.ranCommitID != '': - mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5) + mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30) # if the branch is not develop, then it is a merge request and we need to do # the potential merge. Note that merge conflicts should already been checked earlier imageTag = 'develop' @@ -201,7 +207,7 @@ class Containerize(): # Build the shared image only on Push Events (not on Merge Requests) if (not self.ranAllowMerge): - mySSH.command(self.cli + ' build --target ' + sharedimage + ' --tag ' + sharedimage + ':' + sharedTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) + mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + sharedimage + ' --tag ' + sharedimage + ':' + sharedTag + ' --file docker/Dockerfile.ran' + self.dockerfileprefix + ' --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" . > cmake_targets/log/ran-build.log 2>&1', '\$', 1600) # First verify if the shared image was properly created. status = True mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + sharedimage + ':' + sharedTag, '\$', 5) @@ -249,7 +255,7 @@ class Containerize(): # the archived Dockerfiles have "ran-build:latest" as base image # we need to update them with proper tag mySSH.command('sed -i -e "s#' + sharedimage + ':latest#' + sharedimage + ':' + sharedTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) - mySSH.command(self.cli + ' build --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) + mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) # split the log mySSH.command('mkdir -p cmake_targets/log/' + image, '\$', 5) mySSH.command('python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/' + image + '.log', '\$', 5) @@ -330,6 +336,31 @@ class Containerize(): errorandwarnings['warnings'] = warningsNo errorandwarnings['status'] = status files[fil] = errorandwarnings + # Let analyze the target image creation part + if os.path.isfile('build_log_{}/{}.log'.format(self.testCase_id,image)): + errorandwarnings = {} + with open('build_log_{}/{}.log'.format(self.testCase_id,image), mode='r') as inputfile: + startOfTargetImageCreation = False + buildStatus = False + for line in inputfile: + result = re.search('FROM .* [aA][sS] ' + image + '$', str(line)) + if result is not None: + startOfTargetImageCreation = True + if startOfTargetImageCreation: + result = re.search('Successfully tagged ' + image + ':', str(line)) + if result is not None: + buildStatus = True + result = re.search('COMMIT ' + image + ':', str(line)) + if result is not None: + buildStatus = True + inputfile.close() + if buildStatus: + errorandwarnings['errors'] = 0 + else: + errorandwarnings['errors'] = 1 + errorandwarnings['warnings'] = 0 + errorandwarnings['status'] = buildStatus + files['Target Image Creation'] = errorandwarnings self.collectInfo[image] = files if status: diff --git a/ci-scripts/cls_module_ue.py b/ci-scripts/cls_module_ue.py new file mode 100644 index 0000000000..abfa8c1106 --- /dev/null +++ b/ci-scripts/cls_module_ue.py @@ -0,0 +1,132 @@ +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# +# Required Python Version +# Python 3.x +# +#--------------------------------------------------------------------- + +#to use isfile +import os +import sys +import logging +#to create a SSH object locally in the methods +import sshconnection +#time.sleep +import time + + +import re +import subprocess + + + +class Module_UE: + + def __init__(self,Module): + #create attributes as in the Module dictionary + for k, v in Module.items(): + setattr(self, k, v) + self.UEIPAddress = "" + #dictionary linking command names and related module scripts + self.cmd_dict= {"wup": self.WakeupScript,"detach":self.DetachScript}#dictionary of function scripts + + + +#-----------------$ +#PUBLIC Methods$ +#-----------------$ + + #this method checks if the specified Process is running on the server hosting the module + #if not it will be started + def CheckCMProcess(self): + HOST=self.HostIPAddress + COMMAND="ps aux | grep " + self.Process['Name'] + " | grep -v grep " + logging.debug(COMMAND) + ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + result = ssh.stdout.readlines() + if len(result)!=0: + logging.debug(self.Process['Name'] + " process found") + return True + else:#start process and check again + logging.debug(self.Process['Name'] + " process NOT found") + #starting the process + logging.debug('Starting ' + self.Process['Name']) + mySSH = sshconnection.SSHConnection() + mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) + mySSH.command('echo ' + self.HostPassword + ' | sudo -S ' + self.Process['Cmd'] + ' &','\$',5) + mySSH.close() + #checking the process + HOST=self.HostIPAddress + COMMAND="ps aux | grep " + self.Process['Name'] + " | grep -v grep " + logging.debug(COMMAND) + ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + result = ssh.stdout.readlines() + if len(result)!=0: + logging.debug(self.Process['Name'] + " process found") + return True + else: + logging.debug(self.Process['Name'] + " process NOT found") + return False + + #Generic command function, using function pointers dictionary + def Command(self,cmd): + mySSH = sshconnection.SSHConnection() + mySSH.open(self.HostIPAddress, self.HostUsername, self.HostPassword) + mySSH.command('echo ' + self.HostPassword + ' | sudo -S python3 ' + self.cmd_dict[cmd],'\$',10) + time.sleep(5) + logging.debug("Module "+ cmd) + mySSH.close() + + + #this method retrieves the Module IP address (not the Host IP address) + def GetModuleIPAddress(self): + HOST=self.HostIPAddress + response= [] + tentative = 10 + while (len(response)==0) and (tentative>0): + COMMAND="ip a show dev " + self.UENetwork + " | grep inet | grep " + self.UENetwork + logging.debug(COMMAND) + ssh = subprocess.Popen(["ssh", "%s" % HOST, COMMAND],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + response = ssh.stdout.readlines() + tentative-=1 + time.sleep(10) + if (tentative==0) and (len(response)==0): + logging.debug('\u001B[1;37;41m Module IP Address Not Found! Time expired \u001B[0m') + return -1 + else: #check response + result = re.search('inet (?P[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)', response[0].decode("utf-8") ) + if result is not None: + if result.group('moduleipaddress') is not None: + self.UEIPAddress = result.group('moduleipaddress') + logging.debug('\u001B[1mUE Module IP Address is ' + self.UEIPAddress + '\u001B[0m') + return 0 + else: + logging.debug('\u001B[1;37;41m Module IP Address Not Found! \u001B[0m') + return -1 + else: + logging.debug('\u001B[1;37;41m Module IP Address Not Found! \u001B[0m') + return -1 + + + + + diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 7da829b7f7..7202e7c881 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -54,7 +54,8 @@ import helpreadme as HELP import constants as CONST import sshconnection - +import cls_module_ue +import cls_ci_ueinfra #class defining the multi Ue infrastrucure #----------------------------------------------------------- @@ -129,6 +130,7 @@ class OaiCiTest(): self.iperf_packetloss_threshold = '' self.iperf_profile = '' self.iperf_options = '' + self.iperf_direction = '' self.nbMaxUEtoAttach = -1 self.UEDevices = [] self.UEDevicesStatus = [] @@ -157,6 +159,7 @@ class OaiCiTest(): self.clean_repository = True self.air_interface='' self.expectedNbOfConnectedUEs = 0 + self.ue_id = '' #used for module identification def BuildOAIUE(self,HTML): @@ -174,7 +177,7 @@ class OaiCiTest(): ue_prefix = '' result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) if result is not None: - full_ran_repo_name = self.ranRepository + full_ran_repo_name = self.ranRepository.replace('git/', 'git') else: full_ran_repo_name = self.ranRepository + '.git' SSH.command('mkdir -p ' + self.UESourceCodePath, '\$', 5) @@ -217,7 +220,7 @@ class OaiCiTest(): # if the commit ID is provided use it to point to it if self.ranCommitID != '': - SSH.command('git checkout -f ' + self.ranCommitID, '\$', 5) + SSH.command('git checkout -f ' + self.ranCommitID, '\$', 30) # if the branch is not develop, then it is a merge request and we need to do # the potential merge. Note that merge conflicts should already been checked earlier if self.ranAllowMerge: @@ -364,29 +367,44 @@ class OaiCiTest(): except: os.kill(os.getppid(),signal.SIGUSR1) - def InitializeUE(self,HTML,COTS_UE): - if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - multi_jobs = [] - i = 0 - for device_id in self.UEDevices: - p = Process(target = self.InitializeUE_common, args = (device_id,i,COTS_UE,)) - p.daemon = True - p.start() - multi_jobs.append(p) - i += 1 - for job in multi_jobs: - job.join() - HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) - - + def InitializeUE(self,HTML,RAN,EPC, COTS_UE, InfraUE): + if self.ue_id=='':#no ID specified, then it is a COTS controlled by ADB + if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter') + multi_jobs = [] + i = 0 + for device_id in self.UEDevices: + p = Process(target = self.InitializeUE_common, args = (device_id,i,COTS_UE,)) + p.daemon = True + p.start() + multi_jobs.append(p) + i += 1 + for job in multi_jobs: + job.join() + HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + else: #if an ID is specified, it is a module from the yaml infrastructure file + #RH + Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id]) + is_module=Module_UE.CheckCMProcess() + if is_module: + Module_UE.Command("wup") + status=Module_UE.GetModuleIPAddress() + if status==0: + HTML.CreateHtmlTestRow(Module_UE.UEIPAddress, 'OK', CONST.ALL_PROCESSES_OK) + logging.debug('UE IP addresss : '+ Module_UE.UEIPAddress) + else: #status==-1 failed to retrieve IP address + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.UE_IP_ADDRESS_ISSUE) + self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) + return def InitializeOAIUE(self,HTML,RAN,EPC,COTS_UE): if self.UEIPAddress == '' or self.UEUserName == '' or self.UEPassword == '' or self.UESourceCodePath == '': HELP.GenericHelp(CONST.Version) sys.exit('Insufficient Parameter') + + if self.air_interface == 'lte-uesoftmodem': result = re.search('--no-L2-connect', str(self.Initialize_OAI_UE_args)) if result is None: @@ -403,13 +421,13 @@ class OaiCiTest(): SSH = sshconnection.SSHConnection() SSH.open(self.UEIPAddress, self.UEUserName, self.UEPassword) # b2xx_fx3_utils reset procedure - SSH.command('echo ' + self.UEPassword + ' | sudo -S uhd_find_devices', '\$', 60) + SSH.command('echo ' + self.UEPassword + ' | sudo -S uhd_find_devices', '\$', 90) result = re.search('type: b200', SSH.getBefore()) if result is not None: logging.debug('Found a B2xx device --> resetting it') SSH.command('echo ' + self.UEPassword + ' | sudo -S b2xx_fx3_utils --reset-device', '\$', 10) # Reloading FGPA bin firmware - SSH.command('echo ' + self.UEPassword + ' | sudo -S uhd_find_devices', '\$', 60) + SSH.command('echo ' + self.UEPassword + ' | sudo -S uhd_find_devices', '\$', 90) result = re.search('type: n3xx', str(SSH.getBefore())) if result is not None: logging.debug('Found a N3xx device --> resetting it') @@ -945,30 +963,31 @@ class OaiCiTest(): os.kill(os.getppid(),signal.SIGUSR1) def AttachUE(self,HTML,RAN,EPC,COTS_UE): - if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - check_eNB = True - check_OAI_UE = False - pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) - if (pStatus < 0): - HTML.CreateHtmlTestRow('N/A', 'KO', pStatus) - self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) - return - multi_jobs = [] - status_queue = SimpleQueue() - lock = Lock() - nb_ue_to_connect = 0 - for device_id in self.UEDevices: - if (self.nbMaxUEtoAttach == -1) or (nb_ue_to_connect < self.nbMaxUEtoAttach): - self.UEDevicesStatus[nb_ue_to_connect] = CONST.UE_STATUS_ATTACHING - p = Process(target = self.AttachUE_common, args = (device_id, status_queue, lock,nb_ue_to_connect,COTS_UE,)) - p.daemon = True - p.start() - multi_jobs.append(p) - nb_ue_to_connect = nb_ue_to_connect + 1 - for job in multi_jobs: - job.join() + if self.ue_id=='':#no ID specified, then it is a COTS controlled by ADB + if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter') + check_eNB = True + check_OAI_UE = False + pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) + if (pStatus < 0): + HTML.CreateHtmlTestRow('N/A', 'KO', pStatus) + self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) + return + multi_jobs = [] + status_queue = SimpleQueue() + lock = Lock() + nb_ue_to_connect = 0 + for device_id in self.UEDevices: + if (self.nbMaxUEtoAttach == -1) or (nb_ue_to_connect < self.nbMaxUEtoAttach): + self.UEDevicesStatus[nb_ue_to_connect] = CONST.UE_STATUS_ATTACHING + p = Process(target = self.AttachUE_common, args = (device_id, status_queue, lock,nb_ue_to_connect,COTS_UE,)) + p.daemon = True + p.start() + multi_jobs.append(p) + nb_ue_to_connect = nb_ue_to_connect + 1 + for job in multi_jobs: + job.join() if (status_queue.empty()): HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK) @@ -1025,37 +1044,44 @@ class OaiCiTest(): except: os.kill(os.getppid(),signal.SIGUSR1) - def DetachUE(self,HTML,RAN,EPC,COTS_UE): - if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': - HELP.GenericHelp(CONST.Version) - sys.exit('Insufficient Parameter') - check_eNB = True - check_OAI_UE = False - pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) - if (pStatus < 0): - HTML.CreateHtmlTestRow('N/A', 'KO', pStatus) - self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) - return - multi_jobs = [] - cnt = 0 - for device_id in self.UEDevices: - self.UEDevicesStatus[cnt] = CONST.UE_STATUS_DETACHING - p = Process(target = self.DetachUE_common, args = (device_id,cnt,COTS_UE,)) - p.daemon = True - p.start() - multi_jobs.append(p) - cnt += 1 - for job in multi_jobs: - job.join() - HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) - result = re.search('T_stdout', str(RAN.Initialize_eNB_args)) - if result is not None: - logging.debug('Waiting 5 seconds to fill up record file') - time.sleep(5) - cnt = 0 - while cnt < len(self.UEDevices): - self.UEDevicesStatus[cnt] = CONST.UE_STATUS_DETACHED - cnt += 1 + def DetachUE(self,HTML,RAN,EPC,COTS_UE,InfraUE): + if self.ue_id=='':#no ID specified, then it is a COTS controlled by ADB + if self.ADBIPAddress == '' or self.ADBUserName == '' or self.ADBPassword == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter') + check_eNB = True + check_OAI_UE = False + pStatus = self.CheckProcessExist(check_eNB, check_OAI_UE,RAN,EPC) + if (pStatus < 0): + HTML.CreateHtmlTestRow('N/A', 'KO', pStatus) + self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) + return + multi_jobs = [] + cnt = 0 + for device_id in self.UEDevices: + self.UEDevicesStatus[cnt] = CONST.UE_STATUS_DETACHING + p = Process(target = self.DetachUE_common, args = (device_id,cnt,COTS_UE,)) + p.daemon = True + p.start() + multi_jobs.append(p) + cnt += 1 + for job in multi_jobs: + job.join() + HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + result = re.search('T_stdout', str(RAN.Initialize_eNB_args)) + if result is not None: + logging.debug('Waiting 5 seconds to fill up record file') + time.sleep(5) + cnt = 0 + while cnt < len(self.UEDevices): + self.UEDevicesStatus[cnt] = CONST.UE_STATUS_DETACHED + cnt += 1 + else:#if an ID is specified, it is a module from the yaml infrastructure file + Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id]) + Module_UE.Command("detach") + HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + + def RebootUE_common(self, device_id): try: @@ -1437,14 +1463,20 @@ class OaiCiTest(): statusQueue.put(message) lock.release() - def Ping_common(self, lock, UE_IPAddress, device_id, statusQueue,EPC): + def Ping_common(self, lock, UE_IPAddress, device_id, statusQueue,EPC, Module_UE): try: SSH = sshconnection.SSHConnection() # Launch ping on the EPC side (true for ltebox and old open-air-cn) # But for OAI-Rel14-CUPS, we launch from python executor launchFromEpc = True + launchFromModule = False if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE): launchFromEpc = False + #if module, ping from module to EPC + if self.ue_id!='': + launchFromEpc = False + launchfromModule = True + ping_time = re.findall("-c (\d+)",str(self.ping_args)) if launchFromEpc: @@ -1462,21 +1494,34 @@ class OaiCiTest(): #copy the ping log file to have it locally for analysis (ping stats) SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath + '/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '.') else: - #ping log file is on the python executor - cmd = 'ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 > ping_' + self.testCase_id + '_' + device_id + '.log' - message = cmd + '\n' - logging.debug(cmd) - ret = subprocess.run(cmd, shell=True) - ping_status = ret.returncode - #copy the ping log file to an other folder for log collection (source and destination are EPC) - SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'ping_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts') - #copy the ping log file to have it locally for analysis (ping stats) - logging.debug(EPC.SourceCodePath + 'ping_' + self.testCase_id + '_' + device_id + '.log') - SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath +'/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '.') + if launchfromModule == False: + #ping log file is on the python executor + cmd = 'ping ' + self.ping_args + ' ' + UE_IPAddress + ' 2>&1 > ping_' + self.testCase_id + '_' + device_id + '.log' + message = cmd + '\n' + logging.debug(cmd) + ret = subprocess.run(cmd, shell=True) + ping_status = ret.returncode + #copy the ping log file to an other folder for log collection (source and destination are EPC) + SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'ping_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts') + #copy the ping log file to have it locally for analysis (ping stats) + logging.debug(EPC.SourceCodePath + 'ping_' + self.testCase_id + '_' + device_id + '.log') + SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath +'/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '.') + + SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) + #cat is executed on EPC + SSH.command('cat ' + EPC.SourceCodePath + '/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) + else: #launch from Module + SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) + #ping from module NIC rather than IP address to make sure round trip is over the air + cmd = 'ping -I ' + Module_UE.UENetwork + ' ' + self.ping_args + ' ' + EPC.IPAddress + ' 2>&1 > ping_' + self.testCase_id + '_' + self.ue_id + '.log' + SSH.command(cmd,'\$',int(ping_time[0])*1.5) + #copy the ping log file to have it locally for analysis (ping stats) + SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, 'ping_' + self.testCase_id + '_' + self.ue_id + '.log', '.') + + #cat is executed locally + SSH.command('cat ping_' + self.testCase_id + '_' + self.ue_id + '.log', '\$', 5) + ping_status=0 - SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) - #cat is executed on EPC - SSH.command('cat ' + EPC.SourceCodePath + '/scripts/ping_' + self.testCase_id + '_' + device_id + '.log', '\$', 5) # TIMEOUT CASE if ping_status < 0: message = 'Ping with UE (' + str(UE_IPAddress) + ') crashed due to TIMEOUT!' @@ -1660,7 +1705,7 @@ class OaiCiTest(): except: os.kill(os.getppid(),signal.SIGUSR1) - def Ping(self,HTML,RAN,EPC,COTS_UE): + def Ping(self,HTML,RAN,EPC,COTS_UE, InfraUE): result = re.search('noS1', str(RAN.Initialize_eNB_args)) if result is not None: self.PingNoS1(HTML,RAN,EPC,COTS_UE) @@ -1678,18 +1723,30 @@ class OaiCiTest(): HTML.CreateHtmlTestRow(self.ping_args, 'KO', pStatus) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) return - ueIpStatus = self.GetAllUEIPAddresses() - if (ueIpStatus < 0): - HTML.CreateHtmlTestRow(self.ping_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE) - self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) - return + + if self.ue_id=="": + Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra['dummy']) #RH, temporary, we need a dummy Module_UE object to pass to Ping_common + ueIpStatus = self.GetAllUEIPAddresses() + if (ueIpStatus < 0): + HTML.CreateHtmlTestRow(self.ping_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE) + self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) + return + else: + self.UEIPAddresses=[] + Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id]) + Module_UE.GetModuleIPAddress() + self.UEIPAddresses.append(Module_UE.UEIPAddress) + logging.debug(self.UEIPAddresses) multi_jobs = [] i = 0 lock = Lock() status_queue = SimpleQueue() for UE_IPAddress in self.UEIPAddresses: - device_id = self.UEDevices[i] - p = Process(target = self.Ping_common, args = (lock,UE_IPAddress,device_id,status_queue,EPC,)) + if self.ue_id=="": + device_id = self.UEDevices[i] + else: + device_id = Module_UE.ID + "-" + Module_UE.Kind + p = Process(target = self.Ping_common, args = (lock,UE_IPAddress,device_id,status_queue,EPC,Module_UE,)) p.daemon = True p.start() multi_jobs.append(p) @@ -1864,8 +1921,8 @@ class OaiCiTest(): else: return -2 - def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options): - if (not os.path.isfile('iperf_server_' + self.testCase_id + '_' + device_id + '.log')): + def Iperf_analyzeV2Server(self, lock, UE_IPAddress, device_id, statusQueue, iperf_real_options, filename,type): + if (not os.path.isfile(filename)): self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Could not analyze from server log') return # Computing the requested bandwidth in float @@ -1890,14 +1947,18 @@ class OaiCiTest(): req_bandwidth = '%.1f Gbits/sec' % req_bw req_bw = req_bw * 1000000000 - server_file = open('iperf_server_' + self.testCase_id + '_' + device_id + '.log', 'r') + server_file = open(filename, 'r') br_sum = 0.0 ji_sum = 0.0 pl_sum = 0 ps_sum = 0 row_idx = 0 for line in server_file.readlines(): - result = re.search('(?P[0-9\.]+ [KMG]bits\/sec) +(?P[0-9\.]+ ms) +(?P[0-9]+)/ +(?P[0-9]+)', str(line)) + if type==0: + result = re.search('(?P[0-9\.]+ [KMG]bits\/sec) +(?P[0-9\.]+ ms) +(?P[0-9]+)/ +(?P[0-9]+)', str(line)) + else: + result = re.search('^\[ \d\].+ +(?P[0-9\.]+ [KMG]bits\/sec) +(?P[0-9\.]+ ms) +(?P[0-9]+)\/(?P[0-9]+)', str(line)) + if result is not None: bitrate = result.group('bitrate') jitter = result.group('jitter') @@ -2127,12 +2188,65 @@ class OaiCiTest(): SSH.command('docker cp prod-trf-gen:/iperf-2.0.5/iperf_server_' + self.testCase_id + '_' + device_id + '.log ' + EPC.SourceCodePath + '/scripts', '\$', 5) SSH.close() SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, EPC.SourceCodePath+ '/scripts/iperf_server_' + self.testCase_id + '_' + device_id + '.log', '.') - self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options) + filename='iperf_server_' + self.testCase_id + '_' + device_id + '.log' + self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options,filename,0) # in case of OAI-UE if (device_id == 'OAI-UE'): SSH.copyin(self.UEIPAddress, self.UEUserName, self.UEPassword, self.UESourceCodePath + '/cmake_targets/iperf_' + self.testCase_id + '_' + device_id + '.log', '.') SSH.copyout(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_' + self.testCase_id + '_' + device_id + '.log', EPC.SourceCodePath + '/scripts') + + def Iperf_Module(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue,EPC, Module_UE): + SSH = sshconnection.SSHConnection() + iperf_time = self.Iperf_ComputeTime() + if self.iperf_direction=="DL": + logging.debug("Iperf for Module in DL mode detected") + #server side UE + SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) + cmd = 'rm iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' + SSH.command(cmd,'\$',5) + cmd = 'echo $USER; nohup /opt/iperf-2.0.10/iperf -s -B ' + UE_IPAddress + ' -u 2>&1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' + SSH.command(cmd,'\$',5) + #client side EPC + SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) + cmd = 'rm iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' + SSH.command(cmd,'\$',5) + cmd = 'iperf -c ' + UE_IPAddress + ' ' + self.iperf_args + ' 2>&1 > iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' + SSH.command(cmd,'\$',int(iperf_time)*5.0) + #copy the 2 resulting files locally + SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log', '.') + SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log', '.') + #send for analysis + filename='iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' + self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,filename,1) + + elif self.iperf_direction=="UL":#does not work at the moment + logging.debug("Iperf for Module in UL mode detected") + #server side EPC + SSH.open(EPC.IPAddress, EPC.UserName, EPC.Password) + cmd = 'rm iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' + SSH.command(cmd,'\$',5) + cmd = 'echo $USER; nohup iperf -s -i 1 -u 2>&1 > iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log' + SSH.command(cmd,'\$',5) + + #client side UE + SSH.open(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword) + cmd = 'rm iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' + SSH.command(cmd,'\$',5) + SSH.command('/opt/iperf-2.0.10/iperf -c 192.172.0.1 ' + self.iperf_args + ' 2>&1 > iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log', '\$', int(iperf_time)*5.0) + + #copy the 2 resulting files locally + SSH.copyin(Module_UE.HostIPAddress, Module_UE.HostUsername, Module_UE.HostPassword, 'iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log', '.') + SSH.copyin(EPC.IPAddress, EPC.UserName, EPC.Password, 'iperf_server_' + self.testCase_id + '_' + self.ue_id + '.log', '.') + #send for analysis + filename='iperf_client_' + self.testCase_id + '_' + self.ue_id + '.log' + self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, self.iperf_args,filename,1) + else : + logging.debug("Incorrect or missing IPERF direction in XML") + + SSH.close() + return + def Iperf_common(self, lock, UE_IPAddress, device_id, idx, ue_num, statusQueue,EPC): try: SSH = sshconnection.SSHConnection() @@ -2229,8 +2343,13 @@ class OaiCiTest(): # Launch the IPERF client on the EPC side for DL (true for ltebox and old open-air-cn # But for OAI-Rel14-CUPS, we launch from python executor launchFromEpc = True + launchFromModule = False if re.match('OAI-Rel14-CUPS', EPC.Type, re.IGNORECASE): launchFromEpc = False + #if module + if self.ue_id!='' and self.iperf : + launchFromEpc = False + launchfromModule = True # When using a docker-based deployment, IPERF client shall be launched from trf container launchFromTrfContainer = False if re.match('OAI-Rel14-Docker', EPC.Type, re.IGNORECASE): @@ -2334,7 +2453,8 @@ class OaiCiTest(): subprocess.run(cmd, shell=True) except: pass - self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options) + filename='iperf_server_' + self.testCase_id + '_' + device_id + '.log' + self.Iperf_analyzeV2Server(lock, UE_IPAddress, device_id, statusQueue, modified_options,filename,0) # in case of OAI UE: if (device_id == 'OAI-UE'): @@ -2422,7 +2542,8 @@ class OaiCiTest(): if (os.path.isfile('iperf_server_' + self.testCase_id + '.log')): os.remove('iperf_server_' + self.testCase_id + '.log') SSH.copyin(iServerIPAddr, iServerUser, iServerPasswd, '/tmp/tmp_iperf_server_' + self.testCase_id + '.log', 'iperf_server_' + self.testCase_id + '_OAI-UE.log') - self.Iperf_analyzeV2Server(lock, '10.0.1.2', 'OAI-UE', status_queue, modified_options) + filename='iperf_server_' + self.testCase_id + '_OAI-UE.log' + self.Iperf_analyzeV2Server(lock, '10.0.1.2', 'OAI-UE', status_queue, modified_options,filename,0) # copying on the EPC server for logCollection if (clientStatus == -1): @@ -2457,7 +2578,7 @@ class OaiCiTest(): HTML.CreateHtmlTestRowQueue(self.iperf_args, 'KO', len(self.UEDevices), html_queue) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) - def Iperf(self,HTML,RAN,EPC,COTS_UE): + def Iperf(self,HTML,RAN,EPC,COTS_UE, InfraUE): result = re.search('noS1', str(RAN.Initialize_eNB_args)) if result is not None: self.IperfNoS1(HTML,RAN,EPC,COTS_UE) @@ -2475,12 +2596,21 @@ class OaiCiTest(): HTML.CreateHtmlTestRow(self.iperf_args, 'KO', pStatus) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) return - ueIpStatus = self.GetAllUEIPAddresses() - if (ueIpStatus < 0): - logging.debug('going here') - HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE) - self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) - return + + if self.ue_id=="":#is not a module, follow legacy code + ueIpStatus = self.GetAllUEIPAddresses() + if (ueIpStatus < 0): + HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.UE_IP_ADDRESS_ISSUE) + self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC) + return + else: #is a module + self.UEIPAddresses=[] + Module_UE = cls_module_ue.Module_UE(InfraUE.ci_ue_infra[self.ue_id]) + Module_UE.GetModuleIPAddress() + self.UEIPAddresses.append(Module_UE.UEIPAddress) + + + self.dummyIperfVersion = '2.0.10' #cmd = 'iperf --version' @@ -2498,9 +2628,15 @@ class OaiCiTest(): ue_num = len(self.UEIPAddresses) lock = Lock() status_queue = SimpleQueue() + logging.debug(self.UEIPAddresses) for UE_IPAddress in self.UEIPAddresses: device_id = self.UEDevices[i] - p = Process(target = self.Iperf_common, args = (lock,UE_IPAddress,device_id,i,ue_num,status_queue,EPC,)) + #special quick and dirty treatment for modules, iperf to be restructured + if self.ue_id!="": #is module + device_id = Module_UE.ID + "-" + Module_UE.Kind + p = Process(target = self.Iperf_Module ,args = (lock, UE_IPAddress, device_id, i, ue_num, status_queue, EPC, Module_UE,)) + else: #legacy code + p = Process(target = self.Iperf_common, args = (lock, UE_IPAddress, device_id, i, ue_num, status_queue, EPC, )) p.daemon = True p.start() multi_jobs.append(p) @@ -3273,7 +3409,7 @@ class OaiCiTest(): UhdVersion = result.group('uhd_version') logging.debug('UHD Version is: ' + UhdVersion) HTML.UhdVersion[idx]=UhdVersion - SSH.command('echo ' + Password + ' | sudo -S uhd_find_devices', '\$', 60) + SSH.command('echo ' + Password + ' | sudo -S uhd_find_devices', '\$', 90) usrp_boards = re.findall('product: ([0-9A-Za-z]+)\\\\r\\\\n', SSH.getBefore()) count = 0 for board in usrp_boards: diff --git a/ci-scripts/cls_physim.py b/ci-scripts/cls_physim.py index 4ca36b8cf0..e825b2f7bd 100644 --- a/ci-scripts/cls_physim.py +++ b/ci-scripts/cls_physim.py @@ -1,191 +1,191 @@ -# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more -# * contributor license agreements. See the NOTICE file distributed with -# * this work for additional information regarding copyright ownership. -# * The OpenAirInterface Software Alliance licenses this file to You under -# * the OAI Public License, Version 1.1 (the "License"); you may not use this file -# * except in compliance with the License. -# * You may obtain a copy of the License at -# * -# * http://www.openairinterface.org/?page_id=698 -# * -# * Unless required by applicable law or agreed to in writing, software -# * distributed under the License is distributed on an "AS IS" BASIS, -# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# * See the License for the specific language governing permissions and -# * limitations under the License. -# *------------------------------------------------------------------------------- -# * For more information about the OpenAirInterface (OAI) Software Alliance: -# * contact@openairinterface.org -# */ -#--------------------------------------------------------------------- -# Python for CI of OAI-eNB + COTS-UE -# -# Required Python Version -# Python 3.x -# -# Required Python Package -# pexpect -#--------------------------------------------------------------------- - -#to use logging.info() -import logging -#to create a SSH object locally in the methods -import sshconnection -#to update the HTML object -import html -from multiprocessing import SimpleQueue -#for log folder maintenance -import os - -class PhySim: - def __init__(self): - self.buildargs = "" - self.runargs = "" - self.eNBIpAddr = "" - self.eNBUserName = "" - self.eNBPassWord = "" - self.eNBSourceCodePath = "" - self.ranRepository = "" - self.ranBranch = "" - self.ranCommitID= "" - self.ranAllowMerge= "" - self.ranTargetBranch= "" - self.exitStatus=0 - self.forced_workspace_cleanup=False - #private attributes - self.__workSpacePath='' - self.__buildLogFile='compile_phy_sim.log' - self.__runLogFile='' - self.__runResults=[] - self.__runLogPath='phy_sim_logs' - - -#----------------- -#PRIVATE Methods -#----------------- - - def __CheckResults_PhySim(self,HTML,CONST,testcase_id): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) - #retrieve run log file and store it locally$ - mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__runLogFile, '.') - mySSH.close() - #parse results looking for Encoding and Decoding mean values - self.__runResults=[] - with open(self.__runLogFile) as f: - for line in f: - if 'mean' in line: - self.__runResults.append(line) - #the values are appended for each mean value (2), so we take these 2 values from the list - info=self.__runResults[0]+self.__runResults[1] - - #once parsed move the local logfile to its folder for tidiness - os.system('mv '+self.__runLogFile+' '+ self.__runLogPath+'/.') - - #updating the HTML with results - html_cell = '
' + info  + '
' - html_queue=SimpleQueue() - html_queue.put(html_cell) - HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', 1, html_queue) - return HTML - - - def __CheckBuild_PhySim(self, HTML, CONST): - self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/' - mySSH = sshconnection.SSHConnection() - mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) - #retrieve compile log file and store it locally - mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__buildLogFile, '.') - #delete older run log file - mySSH.command('rm ' + self.__workSpacePath+self.__runLogFile, '\$', 5) - mySSH.close() - #check build result from local compile log file - buildStatus=False - with open(self.__buildLogFile) as f: - #nr_prachsim is the last compile step - if 'nr_prachsim compiled' in f.read(): - buildStatus=True - #update HTML based on build status - if buildStatus: - HTML.CreateHtmlTestRow(self.buildargs, 'OK', CONST.ALL_PROCESSES_OK, 'LDPC') - self.exitStatus=0 - else: - logging.error('\u001B[1m Building Physical Simulators Failed\u001B[0m') - HTML.CreateHtmlTestRow(self.buildargs, 'KO', CONST.ALL_PROCESSES_OK, 'LDPC') - HTML.CreateHtmlTabFooter(False) - #exitStatus=1 will do a sys.exit in main - self.exitStatus=1 - return HTML - - -#-----------------$ -#PUBLIC Methods$ -#-----------------$ - - def Build_PhySim(self,htmlObj,constObj): - mySSH = sshconnection.SSHConnection() - mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) - - #create working dir - mySSH.command('mkdir -p ' + self.eNBSourceCodePath, '\$', 5) - mySSH.command('cd ' + self.eNBSourceCodePath, '\$', 5) - - if not self.ranRepository.lower().endswith('.git'): - self.ranRepository+='.git' - - #git clone - mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + self.ranRepository + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) - #git config - mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) - mySSH.command('git config user.name "OAI Jenkins"', '\$', 5) - - #git clean depending on self.forced_workspace_cleanup captured in xml - if self.forced_workspace_cleanup==True: - logging.info('Cleaning workspace ...') - mySSH.command('echo ' + self.eNBPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) - else: - logging.info('Workspace cleaning was disabled') - - # if the commit ID is provided, use it to point to it - if self.ranCommitID != '': - mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5) - # if the branch is not develop, then it is a merge request and we need to do - # the potential merge. Note that merge conflicts should have already been checked earlier - if (self.ranAllowMerge): - if self.ranTargetBranch == '': - if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): - mySSH.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) - else: - logging.info('Merging with the target branch: ' + self.ranTargetBranch) - mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) - - #build - mySSH.command('source oaienv', '\$', 5) - mySSH.command('cd cmake_targets', '\$', 5) - mySSH.command('mkdir -p log', '\$', 5) - mySSH.command('chmod 777 log', '\$', 5) - mySSH.command('stdbuf -o0 ./build_oai ' + self.buildargs + ' 2>&1 | stdbuf -o0 tee ' + self.__buildLogFile, 'Bypassing the Tests|build have failed', 1500) - - mySSH.close() - #check build status and update HTML object - lHTML = html.HTMLManagement() - lHTML=self.__CheckBuild_PhySim(htmlObj,constObj) - return lHTML - - - def Run_PhySim(self,htmlObj,constObj,testcase_id): - #create run logs folder locally - os.system('mkdir -p ./'+self.__runLogPath) - #log file is tc_.log remotely - self.__runLogFile='physim_'+str(testcase_id)+'.log' - #open a session for test run - mySSH = sshconnection.SSHConnection() - mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) - mySSH.command('cd '+self.__workSpacePath,'\$',5) - #run and redirect the results to a log file - mySSH.command(self.__workSpacePath+'phy_simulators/build/ldpctest ' + self.runargs + ' >> '+self.__runLogFile, '\$', 30) - mySSH.close() - #return updated HTML to main - lHTML = html.HTMLManagement() - lHTML=self.__CheckResults_PhySim(htmlObj,constObj,testcase_id) - return lHTML +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# Python for CI of OAI-eNB + COTS-UE +# +# Required Python Version +# Python 3.x +# +# Required Python Package +# pexpect +#--------------------------------------------------------------------- + +#to use logging.info() +import logging +#to create a SSH object locally in the methods +import sshconnection +#to update the HTML object +import html +from multiprocessing import SimpleQueue +#for log folder maintenance +import os + +class PhySim: + def __init__(self): + self.buildargs = "" + self.runargs = "" + self.eNBIpAddr = "" + self.eNBUserName = "" + self.eNBPassWord = "" + self.eNBSourceCodePath = "" + self.ranRepository = "" + self.ranBranch = "" + self.ranCommitID= "" + self.ranAllowMerge= "" + self.ranTargetBranch= "" + self.exitStatus=0 + self.forced_workspace_cleanup=False + #private attributes + self.__workSpacePath='' + self.__buildLogFile='compile_phy_sim.log' + self.__runLogFile='' + self.__runResults=[] + self.__runLogPath='phy_sim_logs' + + +#----------------- +#PRIVATE Methods +#----------------- + + def __CheckResults_PhySim(self,HTML,CONST,testcase_id): + mySSH = sshconnection.SSHConnection() + mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) + #retrieve run log file and store it locally$ + mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__runLogFile, '.') + mySSH.close() + #parse results looking for Encoding and Decoding mean values + self.__runResults=[] + with open(self.__runLogFile) as f: + for line in f: + if 'mean' in line: + self.__runResults.append(line) + #the values are appended for each mean value (2), so we take these 2 values from the list + info=self.__runResults[0]+self.__runResults[1] + + #once parsed move the local logfile to its folder for tidiness + os.system('mv '+self.__runLogFile+' '+ self.__runLogPath+'/.') + + #updating the HTML with results + html_cell = '
' + info  + '
' + html_queue=SimpleQueue() + html_queue.put(html_cell) + HTML.CreateHtmlTestRowQueue(self.runargs, 'OK', 1, html_queue) + return HTML + + + def __CheckBuild_PhySim(self, HTML, CONST): + self.__workSpacePath=self.eNBSourceCodePath+'/cmake_targets/' + mySSH = sshconnection.SSHConnection() + mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) + #retrieve compile log file and store it locally + mySSH.copyin(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord, self.__workSpacePath+self.__buildLogFile, '.') + #delete older run log file + mySSH.command('rm ' + self.__workSpacePath+self.__runLogFile, '\$', 5) + mySSH.close() + #check build result from local compile log file + buildStatus=False + with open(self.__buildLogFile) as f: + #nr_prachsim is the last compile step + if 'nr_prachsim compiled' in f.read(): + buildStatus=True + #update HTML based on build status + if buildStatus: + HTML.CreateHtmlTestRow(self.buildargs, 'OK', CONST.ALL_PROCESSES_OK, 'LDPC') + self.exitStatus=0 + else: + logging.error('\u001B[1m Building Physical Simulators Failed\u001B[0m') + HTML.CreateHtmlTestRow(self.buildargs, 'KO', CONST.ALL_PROCESSES_OK, 'LDPC') + HTML.CreateHtmlTabFooter(False) + #exitStatus=1 will do a sys.exit in main + self.exitStatus=1 + return HTML + + +#-----------------$ +#PUBLIC Methods$ +#-----------------$ + + def Build_PhySim(self,htmlObj,constObj): + mySSH = sshconnection.SSHConnection() + mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) + + #create working dir + mySSH.command('mkdir -p ' + self.eNBSourceCodePath, '\$', 5) + mySSH.command('cd ' + self.eNBSourceCodePath, '\$', 5) + + if not self.ranRepository.lower().endswith('.git'): + self.ranRepository+='.git' + + #git clone + mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + self.ranRepository + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) + #git config + mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + mySSH.command('git config user.name "OAI Jenkins"', '\$', 5) + + #git clean depending on self.forced_workspace_cleanup captured in xml + if self.forced_workspace_cleanup==True: + logging.info('Cleaning workspace ...') + mySSH.command('echo ' + self.eNBPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) + else: + logging.info('Workspace cleaning was disabled') + + # if the commit ID is provided, use it to point to it + if self.ranCommitID != '': + mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30) + # if the branch is not develop, then it is a merge request and we need to do + # the potential merge. Note that merge conflicts should have already been checked earlier + if (self.ranAllowMerge): + if self.ranTargetBranch == '': + if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): + mySSH.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.info('Merging with the target branch: ' + self.ranTargetBranch) + mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + + #build + mySSH.command('source oaienv', '\$', 5) + mySSH.command('cd cmake_targets', '\$', 5) + mySSH.command('mkdir -p log', '\$', 5) + mySSH.command('chmod 777 log', '\$', 5) + mySSH.command('stdbuf -o0 ./build_oai ' + self.buildargs + ' 2>&1 | stdbuf -o0 tee ' + self.__buildLogFile, 'Bypassing the Tests|build have failed', 1500) + + mySSH.close() + #check build status and update HTML object + lHTML = html.HTMLManagement() + lHTML=self.__CheckBuild_PhySim(htmlObj,constObj) + return lHTML + + + def Run_PhySim(self,htmlObj,constObj,testcase_id): + #create run logs folder locally + os.system('mkdir -p ./'+self.__runLogPath) + #log file is tc_.log remotely + self.__runLogFile='physim_'+str(testcase_id)+'.log' + #open a session for test run + mySSH = sshconnection.SSHConnection() + mySSH.open(self.eNBIpAddr, self.eNBUserName, self.eNBPassWord) + mySSH.command('cd '+self.__workSpacePath,'\$',5) + #run and redirect the results to a log file + mySSH.command(self.__workSpacePath+'phy_simulators/build/ldpctest ' + self.runargs + ' >> '+self.__runLogFile, '\$', 30) + mySSH.close() + #return updated HTML to main + lHTML = html.HTMLManagement() + lHTML=self.__CheckResults_PhySim(htmlObj,constObj,testcase_id) + return lHTML diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py new file mode 100644 index 0000000000..1c82526831 --- /dev/null +++ b/ci-scripts/cls_physim1.py @@ -0,0 +1,337 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# Python for CI of OAI-eNB + COTS-UE +# +# Required Python Version +# Python 3.x +# +# Required Python Package +# pexpect +#--------------------------------------------------------------------- + +#----------------------------------------------------------- +# Import +#----------------------------------------------------------- +import logging +import sshconnection as SSH +import html +import os +import re +import time +import sys +import constants as CONST +import helpreadme as HELP + +class PhySim: + def __init__(self): + self.eNBIpAddr = "" + self.eNBUserName = "" + self.eNBPassword = "" + self.OCUserName = "" + self.OCPassword = "" + self.OCProjectName = "" + self.eNBSourceCodePath = "" + self.ranRepository = "" + self.ranBranch = "" + self.ranCommitID= "" + self.ranAllowMerge= False + self.ranTargetBranch= "" + self.testResult = {} + self.testCount = [0,0,0] + self.testSummary = {} + self.testStatus = False + +#-----------------$ +#PUBLIC Methods$ +#-----------------$ + + def Deploy_PhySim(self, HTML, RAN): + if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter') + lIpAddr = self.eNBIPAddress + lUserName = self.eNBUserName + lPassWord = self.eNBPassword + lSourcePath = self.eNBSourceCodePath + ocUserName = self.OCUserName + ocPassword = self.OCPassword + ocProjectName = self.OCProjectName + + if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '' or ocUserName == '' or ocPassword == '' or ocProjectName == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter') + logging.debug('Building on server: ' + lIpAddr) + mySSH = SSH.SSHConnection() + mySSH.open(lIpAddr, lUserName, lPassWord) + + self.testCase_id = HTML.testCase_id + + # on RedHat/CentOS .git extension is mandatory + result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) + if result is not None: + full_ran_repo_name = self.ranRepository.replace('git/', 'git') + else: + full_ran_repo_name = self.ranRepository + '.git' + mySSH.command('echo ' + lPassWord + ' | sudo rm -Rf ' + lSourcePath, '\$', 30) + mySSH.command('mkdir -p ' + lSourcePath, '\$', 5) + mySSH.command('cd ' + lSourcePath, '\$', 5) + mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) + # Raphael: here add a check if git clone or git fetch went smoothly + mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + mySSH.command('git config user.name "OAI Jenkins"', '\$', 5) + + mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) + mySSH.command('mkdir -p cmake_targets/log', '\$', 5) + # if the commit ID is provided use it to point to it + if self.ranCommitID != '': + mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30) + if self.ranAllowMerge: + imageTag = "ci-temp" + if self.ranTargetBranch == '': + if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): + mySSH.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.debug('Merging with the target branch: ' + self.ranTargetBranch) + mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + else: + imageTag = "develop" + # Check if image is exist on the Red Hat server, before pushing it to OC cluster + mySSH.command("sudo podman image inspect --format='Size = {{.Size}} bytes' oai-physim:" + imageTag, '\$', 60) + if mySSH.getBefore().count('no such image') != 0: + logging.error('\u001B[1m No such image oai-physim\u001B[0m') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.PHYSIM_IMAGE_ABSENT) + RAN.prematureExit = True + return + else: + result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) + if result is not None: + imageSize = float(result.group('size')) + imageSize = imageSize / 1000 + if imageSize < 1000: + logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') + else: + imageSize = imageSize / 1000 + if imageSize < 1000: + logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') + else: + imageSize = imageSize / 1000 + logging.debug('\u001B[1m oai-physim is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') + else: + logging.debug('oai-physim size is unknown') + + # logging to OC Cluster and then switch to corresponding project + mySSH.command(f'oc login -u {ocUserName} -p {ocPassword}', '\$', 6) + if mySSH.getBefore().count('Login successful.') == 0: + logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) + RAN.prematureExit = True + return + else: + logging.debug('\u001B[1m Login to OC Cluster Successfully\u001B[0m') + mySSH.command(f'oc project {ocProjectName}', '\$', 6) + if mySSH.getBefore().count(f'Already on project "{ocProjectName}"') == 0 and mySSH.getBefore().count(f'Now using project "{self.OCProjectName}"') == 0: + logging.error(f'\u001B[1m Unable to access OC project {ocProjectName}\u001B[0m') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PROJECT_FAIL) + RAN.prematureExit = True + return + else: + logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m') + + # Tag the image and push to the OC cluster + mySSH.command('oc whoami -t | sudo podman login -u ' + ocUserName + ' --password-stdin https://default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/ --tls-verify=false', '\$', 6) + if mySSH.getBefore().count('Login Succeeded!') == 0: + logging.error('\u001B[1m Podman Login to OC Cluster Registry Failed\u001B[0m') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) + RAN.prematureExit = True + return + else: + logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') + time.sleep(2) + mySSH.command('oc create -f openshift/oai-physim-image-stream.yml', '\$', 6) + if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: + logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) + RAN.prematureExit = True + return + else: + logging.debug(f'\u001B[1m Image Stream "oai-physim" created on OC project {ocProjectName}\u001B[0m') + time.sleep(2) + mySSH.command(f'sudo podman tag oai-physim:{imageTag} default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + time.sleep(2) + mySSH.command(f'sudo podman push default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag} --tls-verify=false', '\$', 30) + if mySSH.getBefore().count('Storing signatures') == 0: + logging.error('\u001B[1m Image "oai-physim" push to OC Cluster Registry Failed\u001B[0m') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) + RAN.prematureExit = True + return + else: + logging.debug('\u001B[1m Image "oai-physim" push to OC Cluster Registry Successfully\u001B[0m') + + # Using helm charts deployment + time.sleep(5) + mySSH.command(f'sed -i -e "s#TAG#{imageTag}#g" ./charts/physims/values.yaml', '\$', 6) + mySSH.command('helm install physim ./charts/physims/ | tee -a cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 6) + if mySSH.getBefore().count('STATUS: deployed') == 0: + logging.error('\u001B[1m Deploying PhySim Failed using helm chart on OC Cluster\u001B[0m') + mySSH.command('helm uninstall physim >> cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 6) + isFinished1 = False + while(isFinished1 == False): + time.sleep(20) + mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) + if re.search('No resources found', mySSH.getBefore()): + isFinished1 = True + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + mySSH.command('oc delete is oai-physim', '\$', 6) + mySSH.close() + self.AnalyzeLogFile_phySim(HTML) + RAN.prematureExit = True + return + else: + logging.debug('\u001B[1m Deployed PhySim Successfully using helm chart\u001B[0m') + isRunning = False + count = 0 + while(count < 2 and isRunning == False): + time.sleep(60) + mySSH.command('oc get pods -o wide -l app.kubernetes.io/instance=physim | tee -a cmake_targets/log/physim_pods_summary.txt', '\$', 6, resync=True) + if mySSH.getBefore().count('Running') == 12: + logging.debug('\u001B[1m Running the physim test Scenarios\u001B[0m') + isRunning = True + podNames = re.findall('oai-[\S\d\w]+', mySSH.getBefore()) + count +=1 + if isRunning == False: + logging.error('\u001B[1m Some PODS Running FAILED \u001B[0m') + mySSH.command('oc get pods -l app.kubernetes.io/instance=physim 2>&1 | tee -a cmake_targets/log/physim_pods_summary.txt', '\$', 6) + mySSH.command('helm uninstall physim >> cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 6) + self.AnalyzeLogFile_phySim(HTML) + isFinished1 = False + while(isFinished1 == False): + time.sleep(20) + mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) + if re.search('No resources found', mySSH.getBefore()): + isFinished1 = True + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + mySSH.command('oc delete is oai-physim', '\$', 6) + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL) + HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) + RAN.prematureExit = True + return + # Waiting to complete the running test + count = 0 + isFinished = False + # doing a deep copy! + tmpPodNames = podNames.copy() + while(count < 28 and isFinished == False): + time.sleep(60) + for podName in tmpPodNames: + mySSH.command2(f'oc logs --tail=1 {podName} 2>&1', 6, silent=True) + if mySSH.cmd2Results.count('FINISHED') != 0: + logging.debug(podName + ' is finished') + tmpPodNames.remove(podName) + if not tmpPodNames: + isFinished = True + count += 1 + if isFinished: + logging.debug('\u001B[1m PhySim test is Complete\u001B[0m') + + # Getting the logs of each executables running in individual pods + for podName in podNames: + mySSH.command(f'oc logs {podName} >> cmake_targets/log/physim_test.txt 2>&1', '\$', 15, resync=True) + time.sleep(30) + + # UnDeploy the physical simulator pods + mySSH.command('helm uninstall physim | tee -a cmake_targets/log/physim_helm_summary.txt 2>&1', '\$', 6) + isFinished1 = False + while(isFinished1 == False): + time.sleep(20) + mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) + if re.search('No resources found', mySSH.getBefore()): + isFinished1 = True + if isFinished1 == True: + logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m') + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.5glab.nsa.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + mySSH.command('oc delete is oai-physim', '\$', 6) + logging.debug('\u001B[1m Deleted the Image and ImageStream\u001B[0m') + mySSH.command('oc logout', '\$', 6) + mySSH.close() + self.AnalyzeLogFile_phySim(HTML) + if self.testStatus: + HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) + logging.info('\u001B[1m Physical Simulator Pass\u001B[0m') + else: + RAN.prematureExit = True + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) + logging.info('\u001B[1m Physical Simulator Fail\u001B[0m') + + def AnalyzeLogFile_phySim(self, HTML): + lIpAddr = self.eNBIPAddress + lUserName = self.eNBUserName + lPassWord = self.eNBPassword + lSourcePath = self.eNBSourceCodePath + mySSH = SSH.SSHConnection() + mySSH.open(lIpAddr, lUserName, lPassWord) + mySSH.command('cd ' + lSourcePath, '\$', 5) + mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) + mySSH.command('mkdir -p physim_test_log_' + self.testCase_id, '\$', 5) + mySSH.command('cp log/physim_* ' + 'physim_test_log_' + self.testCase_id, '\$', 5) + if not os.path.exists(f'./physim_test_logs_{self.testCase_id}'): + os.mkdir(f'./physim_test_logs_{self.testCase_id}') + mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/physim_test_log_' + self.testCase_id + '/*', './physim_test_logs_' + self.testCase_id) + mySSH.command('rm -rf ./physim_test_log_'+ self.testCase_id, '\$', 5) + mySSH.close() + # physim test log analysis + nextt = 0 + if (os.path.isfile(f'./physim_test_logs_{self.testCase_id}/physim_test.txt')): + with open(f'./physim_test_logs_{self.testCase_id}/physim_test.txt', 'r') as logfile: + for line in logfile: + if re.search('execution 015', str(line)) or re.search('Bypassing compilation', str(line)): + nextt = 1 + elif nextt == 1: + if not re.search('Test Results', str(line)): + nextt = 0 + ret2 = re.search('T[^\n]*', str(line)) + if ret2 is not None: + ret3 = ret2.group() + ret3 = ret3.replace("", "") + if re.search('execution 015', str(line)): + self.testCount[0] += 1 + testName = line.split() + ret1 = re.search('Result = PASS', str(line)) + if ret1 is not None: + self.testResult[testName[1]] = [ret3, 'PASS'] + self.testCount[1] += 1 + else: + self.testResult[testName[1]] = [ret3, 'FAIL'] + self.testCount[2] += 1 + self.testSummary['Nbtests'] = self.testCount[0] + self.testSummary['Nbpass'] = self.testCount[1] + self.testSummary['Nbfail'] = self.testCount[2] + if self.testSummary['Nbfail'] == 0: + self.testStatus = True + return 0 diff --git a/ci-scripts/cls_static_code_analysis.py b/ci-scripts/cls_static_code_analysis.py new file mode 100644 index 0000000000..1680f3e560 --- /dev/null +++ b/ci-scripts/cls_static_code_analysis.py @@ -0,0 +1,192 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# Python for CI of OAI-eNB + COTS-UE +# +# Required Python Version +# Python 3.x +# +# Required Python Package +# pexpect +#--------------------------------------------------------------------- + +#----------------------------------------------------------- +# Import +#----------------------------------------------------------- +import sys # arg +import re # reg +import logging +import os +import time + +#----------------------------------------------------------- +# OAI Testing modules +#----------------------------------------------------------- +import sshconnection as SSH +import helpreadme as HELP +import constants as CONST + +#----------------------------------------------------------- +# Class Declaration +#----------------------------------------------------------- +class CppCheckResults(): + + def __init__(self): + + self.variants = ['xenial', 'bionic'] + self.versions = ['',''] + self.nbErrors = [0,0] + self.nbWarnings = [0,0] + self.nbNullPtrs = [0,0] + self.nbMemLeaks = [0,0] + self.nbUninitVars = [0,0] + self.nbInvalidPrintf = [0,0] + self.nbModuloAlways = [0,0] + self.nbTooManyBitsShift = [0,0] + self.nbIntegerOverflow = [0,0] + self.nbWrongScanfArg = [0,0] + self.nbPtrAddNotNull = [0,0] + self.nbOppoInnerCondition = [0,0] + +class StaticCodeAnalysis(): + + def __init__(self): + + self.ranRepository = '' + self.ranBranch = '' + self.ranAllowMerge = False + self.ranCommitID = '' + self.ranTargetBranch = '' + self.eNBIPAddress = '' + self.eNBUserName = '' + self.eNBPassword = '' + self.eNBSourceCodePath = '' + + def CppCheckAnalysis(self, HTML): + if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter') + lIpAddr = self.eNBIPAddress + lUserName = self.eNBUserName + lPassWord = self.eNBPassword + lSourcePath = self.eNBSourceCodePath + + if lIpAddr == '' or lUserName == '' or lPassWord == '' or lSourcePath == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter') + logging.debug('Building on server: ' + lIpAddr) + mySSH = SSH.SSHConnection() + mySSH.open(lIpAddr, lUserName, lPassWord) + + self.testCase_id = HTML.testCase_id + + # on RedHat/CentOS .git extension is mandatory + result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) + if result is not None: + full_ran_repo_name = self.ranRepository.replace('git/', 'git') + else: + full_ran_repo_name = self.ranRepository + '.git' + mySSH.command('mkdir -p ' + lSourcePath, '\$', 5) + mySSH.command('cd ' + lSourcePath, '\$', 5) + mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) + # Raphael: here add a check if git clone or git fetch went smoothly + mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + mySSH.command('git config user.name "OAI Jenkins"', '\$', 5) + + mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) + mySSH.command('mkdir -p cmake_targets/log', '\$', 5) + # if the commit ID is provided use it to point to it + if self.ranCommitID != '': + mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30) + + mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 60) + mySSH.command('docker build --tag oai-cppcheck:xenial --file ci-scripts/docker/Dockerfile.cppcheck.xenial . > cmake_targets/log/cppcheck-xenial.txt 2>&1', '\$', 600) + mySSH.command('sed -e "s@xenial@bionic@" ci-scripts/docker/Dockerfile.cppcheck.xenial > ci-scripts/docker/Dockerfile.cppcheck.bionic', '\$', 6) + mySSH.command('docker build --tag oai-cppcheck:bionic --file ci-scripts/docker/Dockerfile.cppcheck.bionic . > cmake_targets/log/cppcheck-bionic.txt 2>&1', '\$', 600) + mySSH.command('docker image rm oai-cppcheck:bionic oai-cppcheck:xenial || true', '\$', 60) + + # Analyzing the logs + mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) + mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) + mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) + mySSH.close() + + mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '/*', '.') + CCR = CppCheckResults() + vId = 0 + for variant in CCR.variants: + if (os.path.isfile('./cppcheck-'+ variant + '.txt')): + xmlStart = False + with open('./cppcheck-'+ variant + '.txt', 'r') as logfile: + for line in logfile: + ret = re.search('Unpacking cppcheck \((?P[0-9\.]+)', str(line)) + if ret is not None: + CCR.versions[vId] = ret.group('version') + if re.search('RUN cat cmake_targets/log/cppcheck.xml', str(line)) is not None: + xmlStart = True + if xmlStart: + if re.search('severity="error"', str(line)) is not None: + CCR.nbErrors[vId] += 1 + if re.search('severity="warning"', str(line)) is not None: + CCR.nbWarnings[vId] += 1 + if re.search('id="memleak"', str(line)) is not None: + CCR.nbMemLeaks[vId] += 1 + if re.search('id="nullPointer"', str(line)) is not None: + CCR.nbNullPtrs[vId] += 1 + if re.search('id="uninitvar"', str(line)) is not None: + CCR.nbUninitVars[vId] += 1 + if re.search('id="invalidPrintfArgType_sint"|id="invalidPrintfArgType_uint"', str(line)) is not None: + CCR.nbInvalidPrintf[vId] += 1 + if re.search('id="moduloAlwaysTrueFalse"', str(line)) is not None: + CCR.nbModuloAlways[vId] += 1 + if re.search('id="shiftTooManyBitsSigned"', str(line)) is not None: + CCR.nbTooManyBitsShift[vId] += 1 + if re.search('id="integerOverflow"', str(line)) is not None: + CCR.nbIntegerOverflow[vId] += 1 + if re.search('id="wrongPrintfScanfArgNum"|id="invalidScanfArgType_int"', str(line)) is not None: + CCR.nbWrongScanfArg[vId] += 1 + if re.search('id="pointerAdditionResultNotNull"', str(line)) is not None: + CCR.nbPtrAddNotNull[vId] += 1 + if re.search('id="oppositeInnerCondition"', str(line)) is not None: + CCR.nbOppoInnerCondition[vId] += 1 + logging.debug('======== Variant ' + variant + ' - ' + CCR.versions[vId] + ' ========') + logging.debug(' ' + str(CCR.nbErrors[vId]) + ' errors') + logging.debug(' ' + str(CCR.nbWarnings[vId]) + ' warnings') + logging.debug(' -- Details --') + logging.debug(' Memory leak: ' + str(CCR.nbMemLeaks[vId])) + logging.debug(' Possible null pointer deference: ' + str(CCR.nbNullPtrs[vId])) + logging.debug(' Uninitialized variable: ' + str(CCR.nbUninitVars[vId])) + logging.debug(' Undefined behaviour shifting: ' + str(CCR.nbTooManyBitsShift[vId])) + logging.debug(' Signed integer overflow: ' + str(CCR.nbIntegerOverflow[vId])) + logging.debug('') + logging.debug(' Printf formatting issue: ' + str(CCR.nbInvalidPrintf[vId])) + logging.debug(' Modulo result is predetermined: ' + str(CCR.nbModuloAlways[vId])) + logging.debug(' Opposite Condition -> dead code: ' + str(CCR.nbOppoInnerCondition[vId])) + logging.debug(' Wrong Scanf Nb Args: ' + str(CCR.nbWrongScanfArg[vId])) + logging.debug('') + vId += 1 + + HTML.CreateHtmlTestRow('N/A', 'OK', CONST.ALL_PROCESSES_OK) + HTML.CreateHtmlTestRowCppCheckResults(CCR) + logging.info('\u001B[1m Static Code Analysis Pass\u001B[0m') + + return 0 + diff --git a/ci-scripts/conf_files/benetel-5g.conf b/ci-scripts/conf_files/benetel-5g.conf index 0dfe7854ee..9adead3a68 100644 --- a/ci-scripts/conf_files/benetel-5g.conf +++ b/ci-scripts/conf_files/benetel-5g.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; #pusch_TargetSNRx10 = 200; #pucch_TargetSNRx10 = 200; pusch_TargetSNRx10 = 200; @@ -50,7 +51,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -59,27 +60,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) - initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -92,7 +80,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -104,9 +92,9 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 74; zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -118; + #preambleReceivedTargetPower = -118; #preambleReceivedTargetPower = -104; - #preambleReceivedTargetPower = -108; + preambleReceivedTargetPower = -108; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep @@ -136,20 +124,18 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_0 = 55; # this is SS=0 L=12 - initialULBWPk2_2 = 7; + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + msg3_DeltaPreamble = 1; #p0_NominalWithGrant =-90; diff --git a/ci-scripts/conf_files/channelmod_rfsimu.conf b/ci-scripts/conf_files/channelmod_rfsimu.conf new file mode 100644 index 0000000000..9a6ded24f1 --- /dev/null +++ b/ci-scripts/conf_files/channelmod_rfsimu.conf @@ -0,0 +1,57 @@ +#/* configuration for channel modelisation */ +#/* To be included in main config file when */ +#/* channel modelisation is used (rfsimulator with chanmod options enabled) */ +channelmod = { + max_chan=10; + modellist="modellist_rfsimu_1"; + modellist_rfsimu_1 = ( + { + model_name = "rfsimu_channel_enB0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = -10; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue1" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + } + ); + modellist_rfsimu_2 = ( + { + model_name = "rfsimu_channel_ue0" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue1" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + }, + { + model_name = "rfsimu_channel_ue2" + type = "AWGN"; + ploss_dB = 0; + noise_power_dB = 0; + forgetfact = 0; + offset = 0; + ds_tdl = 0; + } + ); +}; + diff --git a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf index 4d89ad96da..087ee37f01 100644 --- a/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf +++ b/ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf @@ -260,7 +260,6 @@ NETWORK_CONTROLLER : FLEXRAN_CACHE = "/mnt/oai_agent_cache"; FLEXRAN_AWAIT_RECONF = "no"; }; - log_config : { global_log_level ="info"; @@ -279,3 +278,4 @@ NETWORK_CONTROLLER : rrc_log_verbosity ="medium"; }; +@include "channelmod_rfsimu.conf" diff --git a/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf new file mode 100644 index 0000000000..e7dd563e45 --- /dev/null +++ b/ci-scripts/conf_files/gnb.band261.tm1.32PRB.usrpn300.conf @@ -0,0 +1,289 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 311; mnc = 480; mnc_length = 3;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP) + absoluteFrequencySSB = 2071241; + dl_frequencyBand = 261; + # this is 27.900 GHz + dl_absoluteFrequencyPointA = 2070833; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 3; + dl_carrierBandwidth = 32; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=32 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 8525; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 3; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 + + initialDLBWPk0_3 = 0; #for mixed slot + initialDLBWPmappingType_3 = 0; + initialDLBWPstartSymbolAndLength_3 = 57; #this is SS=1,L=5 + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 261; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 3; + ul_carrierBandwidth = 32; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 8525; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 3; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 52; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 7; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 7; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 3, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 41; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 14; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 3; + ssb_PositionsInBurst_Bitmap = 0x0001000100010001L; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 3; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 3; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 3; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.18.99"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "no"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "192.168.18.199"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 1; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2"; + if_freq = 5124520000L; + clock_src = "external"; + time_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf index 32de0aa4f5..1209a6f227 100644 --- a/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band66.tm1.106PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,27 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_3 = 0; #for mixed slot + initialDLBWPmappingType_3 = 0; + initialDLBWPstartSymbolAndLength_3 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 66; @@ -131,20 +119,18 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -185,7 +171,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf index decaa392d7..bc9dcb47cc 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -55,27 +56,13 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 #uplinkConfigCommon #frequencyInfoUL @@ -89,7 +76,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -131,20 +118,17 @@ gNBs = restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -186,7 +170,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -227,6 +211,7 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; + ulsch_max_slots_inactivity = 1; } ); @@ -240,21 +225,21 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1 nb_rx = 1 att_tx = 0 att_rx = 0; bands = [7]; max_pdschReferenceSignalPower = -27; - max_rxgain = 75; + max_rxgain = 50; eNB_instances = [0]; - ##beamforming 1x2 matrix: 1 layer x 2 antennas + ## beamforming 1x2 matrix: 1 layer x 2 antennas bf_weights = [0x00007fff, 0x0000]; - ##beamforming 1x4 matrix: 1 layer x 4 antennas + ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index 258618e7f0..f0d5130f83 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -22,6 +22,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; @@ -48,7 +49,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -57,27 +58,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) - initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -90,7 +78,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -132,20 +120,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_2 = 7; + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -250,7 +235,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + pusch_proc_threads = 6; } ); diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf new file mode 100644 index 0000000000..cb3e69faf3 --- /dev/null +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf @@ -0,0 +1,296 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 31; //0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641272; //641032; #641968; 641968=start of ssb at 3600MHz + 82 RBs 641032=center of SSB at center of cell + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=84,L=13 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0;#for DL slot + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0;#for mixed slot + initialDLBWPmappingType_1 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_1 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6368; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -90; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 5; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; //15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 2; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 41; + + initialULBWPk2_1 = 2; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; #0x80; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; //8; //7; + nrofDownlinkSymbols = 6; //0; //6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; //0; //4; + + ssPBCH_BlockPower = -15; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; + ipv6 = "192:168:30::17"; + port = 36412 ; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "CI_FR1_CTL_ENB_IP_ADDR"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "CI_GNB_IP_ADDR"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "CI_GNB_IP_ADDR"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 6; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; #114 + eNB_instances = [0]; + sdr_addrs = "addr=192.168.80.50" + clock_src = "internal" + + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + //parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + +uicc: { +opc = "testopc"; +}; diff --git a/ci-scripts/constants.py b/ci-scripts/constants.py index a0e1ac5c45..bb110bc0e8 100644 --- a/ci-scripts/constants.py +++ b/ci-scripts/constants.py @@ -60,6 +60,11 @@ OAI_UE_PROCESS_SEG_FAULT = -25 OAI_UE_PROCESS_NO_MBMS_MSGS = -26 OAI_UE_PROCESS_OK = +6 INVALID_PARAMETER = -50 +PHYSIM_IMAGE_ABSENT = -60 +OC_LOGIN_FAIL = -61 +OC_PROJECT_FAIL = -62 +OC_IS_FAIL = -63 +OC_PHYSIM_DEPLOY_FAIL = -64 UE_STATUS_DETACHED = 0 UE_STATUS_DETACHING = 1 diff --git a/ci-scripts/createVM.sh b/ci-scripts/createVM.sh index b67668f0bc..f3f8ddaca2 100755 --- a/ci-scripts/createVM.sh +++ b/ci-scripts/createVM.sh @@ -87,7 +87,7 @@ function create_vm { echo "VM_CPU = $VM_CPU" echo "VM_DISK = $VM_DISK GBytes" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/datalog_rt_stats.yaml b/ci-scripts/datalog_rt_stats.yaml new file mode 100644 index 0000000000..3680d2a19b --- /dev/null +++ b/ci-scripts/datalog_rt_stats.yaml @@ -0,0 +1,33 @@ +#this is a configuration file +#used to build real time processing statistics +#for 5G NR phy test (gNB terminate) +Title : Processing Time (us) +ColNames : + - Metric + - Average + - Max + - Average vs Reference Deviation (Reference Value ; Acceptability Threshold) +Ref : + feprx : 60.0 + feptx_prec : 8.0 + feptx_ofdm : 85.0 + feptx_total : 75.0 + L1 Tx processing : 300.0 + DLSCH encoding : 230.0 + L1 Rx processing : 175.0 + PUSCH inner-receiver : 100.0 + PUSCH decoding : 140.0 + DL & UL scheduling timing stats : 15.0 + UL Indication : 20.0 +Threshold : + feprx : 1.25 + feptx_prec : 1.25 + feptx_ofdm : 1.25 + feptx_total : 1.25 + L1 Tx processing : 1.25 + DLSCH encoding : 1.25 + L1 Rx processing : 1.25 + PUSCH inner-receiver : 1.25 + PUSCH decoding : 1.25 + DL & UL scheduling timing stats : 1.25 + UL Indication : 1.25 diff --git a/ci-scripts/docker/Dockerfile.cppcheck.xenial b/ci-scripts/docker/Dockerfile.cppcheck.xenial new file mode 100644 index 0000000000..0aecc62037 --- /dev/null +++ b/ci-scripts/docker/Dockerfile.cppcheck.xenial @@ -0,0 +1,31 @@ +FROM ubuntu:xenial AS oai-cppcheck + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \ + DEBIAN_FRONTEND=noninteractive apt-get install --yes \ + build-essential \ + vim \ + cppcheck + +WORKDIR /oai-ran +COPY . . + +WORKDIR /oai-ran/common/utils/T +RUN make + +WORKDIR /oai-ran +RUN mkdir -p cmake_targets/log && \ + cppcheck --enable=warning --force --xml --xml-version=2 \ + -i openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c \ + --suppressions-list=ci-scripts/cppcheck_suppressions.list \ + -I common/utils \ + -I openair3/NAS/COMMON/UTIL \ + -j`nproc` . 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt + +RUN egrep -c 'severity="error' cmake_targets/log/cppcheck.xml + +RUN egrep -c 'severity="warning' cmake_targets/log/cppcheck.xml + +RUN cat cmake_targets/log/cppcheck.xml diff --git a/ci-scripts/html.py b/ci-scripts/html.py index b3ee00e7dc..9eadf30279 100644 --- a/ci-scripts/html.py +++ b/ci-scripts/html.py @@ -47,7 +47,7 @@ import constants as CONST class HTMLManagement(): def __init__(self): - + self.htmlFile = '' self.htmlHeaderCreated = False self.htmlFooterCreated = False @@ -86,13 +86,13 @@ class HTMLManagement(): #----------------------------------------------------------- # Setters and Getters #----------------------------------------------------------- - + def SethtmlUEConnected(self, nbUEs): if nbUEs > 0: self.htmlUEConnected = nbUEs else: self.htmlUEConnected = 1 - + #----------------------------------------------------------- @@ -365,6 +365,16 @@ class HTMLManagement(): self.htmlFile.write(' KO - SPGW process not found\n') elif (processesStatus == CONST.UE_IP_ADDRESS_ISSUE): self.htmlFile.write(' KO - Could not retrieve UE IP address\n') + elif (processesStatus == CONST.PHYSIM_IMAGE_ABSENT): + self.htmlFile.write(' KO - No such image oai-physim\n') + elif (processesStatus == CONST.OC_LOGIN_FAIL): + self.htmlFile.write(' KO - Could not log onto cluster\n') + elif (processesStatus == CONST.OC_PROJECT_FAIL): + self.htmlFile.write(' KO - Could not register into cluster project\n') + elif (processesStatus == CONST.OC_IS_FAIL): + self.htmlFile.write(' KO - Could not create Image Stream\n') + elif (processesStatus == CONST.OC_PHYSIM_DEPLOY_FAIL): + self.htmlFile.write(' KO - Could not properly deploy physim on cluster\n') else: self.htmlFile.write(' ' + str(status) + '\n') else: @@ -412,7 +422,12 @@ class HTMLManagement(): for image in collectInfo: files = collectInfo[image] # TabHeader for image logs on built shared and target images - self.htmlFile.write(' \n') + if allImagesSize[image].count('unknown') > 0: + self.htmlFile.write(' \n') + elif allImagesSize[image].count('Build Failed') > 0: + self.htmlFile.write(' \n') + else: + self.htmlFile.write(' \n') self.htmlFile.write(' ---- ' + image + ' IMAGE STATUS ----> Size ' + allImagesSize[image] + ' \n') self.htmlFile.write(' \n') self.htmlFile.write(' \n') @@ -431,21 +446,54 @@ class HTMLManagement(): self.htmlFile.write(' ' + str(parameters['errors']) + '\n') else: self.htmlFile.write(' ' + str(parameters['errors']) + '\n') - if (parameters['warnings'] == 0): + if (parameters['errors'] > 0): + self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') + elif (parameters['warnings'] == 0): self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') elif ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)): self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') else: - self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') + self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') if (parameters['errors'] == 0) and (parameters['warnings'] == 0): self.htmlFile.write(' OK \n') elif (parameters['errors'] == 0) and ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)): self.htmlFile.write(' OK \n') else: - self.htmlFile.write(' NOT OK \n') + self.htmlFile.write(' NOT OK \n') self.htmlFile.write(' \n') self.htmlFile.close() + #for the moment it is limited to 4 columns, to be made generic later + def CreateHtmlDataLogTable(self, DataLog): + if (self.htmlFooterCreated or (not self.htmlHeaderCreated)): + return + self.htmlFile = open('test_results.html', 'a') + + # TabHeader + self.htmlFile.write(' \n') + self.htmlFile.write(' ---- ' + DataLog['Title'] + ' ---- \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' '+ DataLog['ColNames'][0] +'\n') + self.htmlFile.write(' ' + DataLog['ColNames'][1] + '\n') + self.htmlFile.write(' ' + DataLog['ColNames'][2] + '\n') + self.htmlFile.write(' '+ DataLog['ColNames'][3] +'\n') + self.htmlFile.write(' \n') + + for k in DataLog['Data']: + # TestRow + self.htmlFile.write(' \n') + self.htmlFile.write(' ' + k + ' \n') + self.htmlFile.write(' ' + DataLog['Data'][k][0] + ' \n') + self.htmlFile.write(' ' + DataLog['Data'][k][1] + ' \n') + if float(DataLog['Data'][k][2])> DataLog['Threshold'][k]: + self.htmlFile.write(' ' + DataLog['Data'][k][2] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + '\n') + else: + self.htmlFile.write(' ' + DataLog['Data'][k][2] + ' (Ref = ' + str(DataLog['Ref'][k]) + ' ; Thres = ' +str(DataLog['Threshold'][k])+') ' + '\n') + self.htmlFile.write(' \n') + self.htmlFile.close() + + def CreateHtmlTestRowQueue(self, options, status, ue_status, ue_queue): if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)): self.htmlFile = open('test_results.html', 'a') @@ -479,3 +527,140 @@ class HTMLManagement(): self.htmlFile.write(' \n') self.htmlFile.close() + def CreateHtmlTestRowCppCheckResults(self, CCR): + if (self.htmlFooterCreated or (not self.htmlHeaderCreated)): + return + self.htmlFile = open('test_results.html', 'a') + vId = 0 + for version in CCR.versions: + self.htmlFile.write(' \n') + self.htmlFile.write(' Results for cppcheck v ' + version + ' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' NB ERRORS\n') + if CCR.nbErrors[vId] == 0: + myColor = 'lightgreen' + elif CCR.nbErrors[vId] < 20: + myColor = 'orange' + else: + myColor = 'lightcoral' + self.htmlFile.write(' ' + str(CCR.nbErrors[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' NB WARNINGS\n') + if CCR.nbWarnings[vId] == 0: + myColor = 'lightgreen' + elif CCR.nbWarnings[vId] < 20: + myColor = 'orange' + else: + myColor = 'lightcoral' + self.htmlFile.write(' ' + str(CCR.nbWarnings[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' ----------------- \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Memory leak\n') + self.htmlFile.write(' ' + str(CCR.nbMemLeaks[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Possible null pointer deference\n') + self.htmlFile.write(' ' + str(CCR.nbNullPtrs[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Uninitialized variable\n') + self.htmlFile.write(' ' + str(CCR.nbUninitVars[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Undefined behaviour shifting\n') + self.htmlFile.write(' ' + str(CCR.nbTooManyBitsShift[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Signed integer overflow\n') + self.htmlFile.write(' ' + str(CCR.nbIntegerOverflow[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Printf formatting issues\n') + self.htmlFile.write(' ' + str(CCR.nbInvalidPrintf[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Modulo result is predetermined\n') + self.htmlFile.write(' ' + str(CCR.nbModuloAlways[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Opposite Condition -> dead code\n') + self.htmlFile.write(' ' + str(CCR.nbOppoInnerCondition[vId]) + '\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Wrong Scanf Nb Args\n') + self.htmlFile.write(' ' + str(CCR.nbWrongScanfArg[vId]) + '\n') + self.htmlFile.write(' \n') + vId += 1 + + def CreateHtmlTestRowPhySimTestResult(self, testSummary, testResult): + if (self.htmlFooterCreated or (not self.htmlHeaderCreated)): + return + self.htmlFile = open('test_results.html', 'a') + if bool(testResult) == False and bool(testSummary) == False: + self.htmlFile.write(' \n') + self.htmlFile.write(' ----PHYSIM TESTING FAILED - Unable to recover the test logs ---- \n') + self.htmlFile.write(' \n') + else: + # Tab header + self.htmlFile.write(' \n') + self.htmlFile.write(' ---- PHYSIM TEST SUMMARY---- \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' LogFile Name\n') + self.htmlFile.write(' Nb Tests\n') + self.htmlFile.write(' Nb Failure\n') + self.htmlFile.write(' Nb Pass\n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' physim_test.txt \n') + self.htmlFile.write(' ' + str(testSummary['Nbtests']) + ' \n') + if testSummary['Nbfail'] == 0: + self.htmlFile.write(' ' + str(testSummary['Nbfail']) + ' \n') + else: + self.htmlFile.write(' ' + str(testSummary['Nbfail']) + ' \n') + self.htmlFile.write(' ' + str(testSummary['Nbpass']) + ' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' ---- PHYSIM TEST DETAIL INFO---- \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' \n') + self.htmlFile.write(' Test Name\n') + self.htmlFile.write(' Test Description\n') + self.htmlFile.write(' Result\n') + self.htmlFile.write(' \n') + y = '' + for key, value in testResult.items(): + x = key.split(".") + if x[0] != y: + self.htmlFile.write(' \n') + self.htmlFile.write(' "' + x[0] + '" series \n') + self.htmlFile.write(' \n') + y = x[0] + self.htmlFile.write(' \n') + self.htmlFile.write(' ' + key + ' \n') + self.htmlFile.write(' ' + value[0] + '\n') + if 'PASS' in value: + self.htmlFile.write(' ' + value[1] + '\n') + else: + self.htmlFile.write(' ' + value[1] + '\n') + + self.htmlFile.close() diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 3094197c54..3f5b57e016 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -38,11 +38,13 @@ import helpreadme as HELP import constants as CONST -import cls_oaicitest #main class for OAI CI test framework -import cls_physim #class PhySim for physical simulators build and test -import cls_cots_ue #class CotsUe for Airplane mode control -import cls_containerize #class Containerize for all container-based operations on RAN/UE objects - +import cls_oaicitest #main class for OAI CI test framework +import cls_physim #class PhySim for physical simulators build and test +import cls_cots_ue #class CotsUe for Airplane mode control +import cls_containerize #class Containerize for all container-based operations on RAN/UE objects +import cls_static_code_analysis #class for static code analysis +import cls_ci_ueinfra #class defining the multi Ue infrastrucure +import cls_physim1 #class PhySim for physical simulators deploy and run import sshconnection import epc @@ -192,6 +194,20 @@ def GetParametersFromXML(action): else : RAN.air_interface[RAN.eNB_instance] = 'ocp-enb' + elif action == 'Initialize_UE': + ue_id = test.findtext('id') + if (ue_id is None): + CiTestObj.ue_id = "" + else: + CiTestObj.ue_id = ue_id + + elif action == 'Detach_UE': + ue_id = test.findtext('id') + if (ue_id is None): + CiTestObj.ue_id = "" + else: + CiTestObj.ue_id = ue_id + elif action == 'Attach_UE': nbMaxUEtoAttach = test.findtext('nbMaxUEtoAttach') if (nbMaxUEtoAttach is None): @@ -252,9 +268,20 @@ def GetParametersFromXML(action): elif (action == 'Ping') or (action == 'Ping_CatM_module'): CiTestObj.ping_args = test.findtext('ping_args') CiTestObj.ping_packetloss_threshold = test.findtext('ping_packetloss_threshold') + ue_id = test.findtext('id') + if (ue_id is None): + CiTestObj.ue_id = "" + else: + CiTestObj.ue_id = ue_id elif action == 'Iperf': CiTestObj.iperf_args = test.findtext('iperf_args') + ue_id = test.findtext('id') + if (ue_id is None): + CiTestObj.ue_id = "" + else: + CiTestObj.ue_id = ue_id + CiTestObj.iperf_direction = test.findtext('direction')#used for modules only CiTestObj.iperf_packetloss_threshold = test.findtext('iperf_packetloss_threshold') CiTestObj.iperf_profile = test.findtext('iperf_profile') if (CiTestObj.iperf_profile is None): @@ -369,6 +396,20 @@ with open(yaml_file,'r') as f: +#loading UE infrastructure from yaml +ue_infra_file='ci_ueinfra.yaml' +if (os.path.isfile(ue_infra_file)): + yaml_file=ue_infra_file +elif (os.path.isfile('ci-scripts/'+ue_infra_file)): + yaml_file='ci-scripts/'+ue_infra_file +else: + logging.error("UE infrastructure yaml file cannot be found") + sys.exit("UE infrastructure file cannot be found") +InfraUE=cls_ci_ueinfra.InfraUE() #initialize UE infrastructure class +InfraUE.Get_UE_Infra(yaml_file) #read the UE infra, filename is hardcoded and unique for the moment but should be passed as parameter from the test suite + + + mode = '' CiTestObj = cls_oaicitest.OaiCiTest() @@ -378,17 +419,18 @@ EPC = epc.EPCManagement() RAN = ran.RANManagement() HTML = html.HTMLManagement() CONTAINERS = cls_containerize.Containerize() +SCA = cls_static_code_analysis.StaticCodeAnalysis() +PHYSIM = cls_physim1.PhySim() ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build - #----------------------------------------------------------- # Parsing Command Line Arguments #----------------------------------------------------------- import args_parse -py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP) +py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM) @@ -671,13 +713,13 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re elif action == 'Terminate_eNB': RAN.TerminateeNB(HTML, EPC) elif action == 'Initialize_UE': - CiTestObj.InitializeUE(HTML,COTS_UE) + CiTestObj.InitializeUE(HTML,RAN, EPC, COTS_UE, InfraUE) elif action == 'Terminate_UE': CiTestObj.TerminateUE(HTML,COTS_UE) elif action == 'Attach_UE': CiTestObj.AttachUE(HTML,RAN,EPC,COTS_UE) elif action == 'Detach_UE': - CiTestObj.DetachUE(HTML,RAN,EPC,COTS_UE) + CiTestObj.DetachUE(HTML,RAN,EPC,COTS_UE,InfraUE) elif action == 'DataDisable_UE': CiTestObj.DataDisableUE(HTML) elif action == 'DataEnable_UE': @@ -701,9 +743,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re elif action == 'Ping_CatM_module': CiTestObj.PingCatM(HTML,RAN,EPC,COTS_UE,EPC) elif action == 'Ping': - CiTestObj.Ping(HTML,RAN,EPC,COTS_UE) + CiTestObj.Ping(HTML,RAN,EPC,COTS_UE, InfraUE) elif action == 'Iperf': - CiTestObj.Iperf(HTML,RAN,EPC,COTS_UE) + CiTestObj.Iperf(HTML,RAN,EPC,COTS_UE, InfraUE) elif action == 'Reboot_UE': CiTestObj.RebootUE(HTML,RAN,EPC) elif action == 'Initialize_HSS': @@ -741,6 +783,10 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re CONTAINERS.DeployObject(HTML, EPC) elif action == 'Undeploy_Object': CONTAINERS.UndeployObject(HTML, RAN) + elif action == 'Cppcheck_Analysis': + SCA.CppCheckAnalysis(HTML) + elif action == 'Deploy_Run_PhySim': + PHYSIM.Deploy_PhySim(HTML, RAN) else: sys.exit('Invalid class (action) from xml') if not RAN.prematureExit: diff --git a/ci-scripts/ran.py b/ci-scripts/ran.py index 783adb98e6..31027d7234 100644 --- a/ci-scripts/ran.py +++ b/ci-scripts/ran.py @@ -37,6 +37,8 @@ import logging import os import time from multiprocessing import Process, Lock, SimpleQueue +import yaml + #----------------------------------------------------------- # OAI Testing modules @@ -90,6 +92,7 @@ class RANManagement(): self.testCase_id = '' self.epcPcapFile = '' self.runtime_stats= '' + self.datalog_rt_stats={} @@ -127,12 +130,16 @@ class RANManagement(): result = re.search('--eNBocp', self.Build_eNB_args) if result is not None: self.air_interface[self.eNB_instance] = 'ocp-enb' - else: - result = re.search('--gNB', self.Build_eNB_args) + else: + result = re.search('--RU', self.Build_eNB_args) if result is not None: - self.air_interface[self.eNB_instance] = 'nr-softmodem' + self.air_interface[self.eNB_instance] = 'oairu' else: - self.air_interface[self.eNB_instance] = 'lte-softmodem' + result = re.search('--gNB', self.Build_eNB_args) + if result is not None: + self.air_interface[self.eNB_instance] = 'nr-softmodem' + else: + self.air_interface[self.eNB_instance] = 'lte-softmodem' # Worakround for some servers, we need to erase completely the workspace if self.Build_eNB_forced_workspace_cleanup: @@ -141,7 +148,7 @@ class RANManagement(): # on RedHat/CentOS .git extension is mandatory result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) if result is not None: - full_ran_repo_name = self.ranRepository + full_ran_repo_name = self.ranRepository.replace('git/', 'git') else: full_ran_repo_name = self.ranRepository + '.git' mySSH.command('mkdir -p ' + lSourcePath, '\$', 5) @@ -184,7 +191,7 @@ class RANManagement(): mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) # if the commit ID is provided use it to point to it if self.ranCommitID != '': - mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 5) + mySSH.command('git checkout -f ' + self.ranCommitID, '\$', 30) # if the branch is not develop, then it is a merge request and we need to do # the potential merge. Note that merge conflicts should already been checked earlier if (self.ranAllowMerge): @@ -294,7 +301,7 @@ class RANManagement(): mySSH.open(self.eNBIPAddress, self.eNBUserName, self.eNBPassword) mySSH.command('cd ' + self.eNBSourceCodePath + '/cmake_targets', '\$', 5) #-qq quiet / -u update orcreate files - mySSH.command('unzip -u -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5) + mySSH.command('unzip -o -u -qq -DD tmp_build' + testcaseId + '.zip', '\$', 5) mySSH.command('rm -f tmp_build' + testcaseId + '.zip', '\$', 5) mySSH.close() else: @@ -382,13 +389,13 @@ class RANManagement(): # do not reset board twice in IF4.5 case result = re.search('^rru|^enb|^du.band', str(config_file)) if result is not None: - mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 60) + mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 90) result = re.search('type: b200', mySSH.getBefore()) if result is not None: logging.debug('Found a B2xx device --> resetting it') mySSH.command('echo ' + lPassWord + ' | sudo -S b2xx_fx3_utils --reset-device', '\$', 10) # Reloading FGPA bin firmware - mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 60) + mySSH.command('echo ' + lPassWord + ' | sudo -S uhd_find_devices', '\$', 90) # Make a copy and adapt to EPC / eNB IP addresses mySSH.command('cp ' + full_config_file + ' ' + ci_full_config_file, '\$', 5) localMmeIpAddr = EPC.MmeIPAddress @@ -633,6 +640,9 @@ class RANManagement(): HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK) else: HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK) + #display rt stats for gNB only + if len(self.datalog_rt_stats)!=0 and nodeB_prefix == 'g': + HTML.CreateHtmlDataLogTable(self.datalog_rt_stats) self.eNBmbmsEnables[int(self.eNB_instance)] = False self.eNBstatuses[int(self.eNB_instance)] = -1 @@ -694,12 +704,30 @@ class RANManagement(): NSA_RAPROC_PUSCH_check = 0 #dlsch and ulsch statistics (dictionary) dlsch_ulsch_stats = {} - #count "L1 thread not ready" msg - L1_thread_not_ready_cnt = 0 + #real time statistics (dictionary) + real_time_stats = {} #count "problem receiving samples" msg pb_receiving_samples_cnt = 0 + #NSA specific log markers + nsa_markers ={'SgNBReleaseRequestAcknowledge': [],'FAILURE': [], 'scgFailureInformationNR-r15': [], 'SgNBReleaseRequest': []} + #the datalog config file has to be loaded + datalog_rt_stats_file='datalog_rt_stats.yaml' + if (os.path.isfile(datalog_rt_stats_file)): + yaml_file=datalog_rt_stats_file + elif (os.path.isfile('ci-scripts/'+datalog_rt_stats_file)): + yaml_file='ci-scripts/'+datalog_rt_stats_file + else: + logging.error("Datalog RT stats yaml file cannot be found") + sys.exit("Datalog RT stats yaml file cannot be found") + + with open(yaml_file,'r') as f: + datalog_rt_stats = yaml.load(f,Loader=yaml.FullLoader) + rt_keys = datalog_rt_stats['Ref'] #we use the keys from the Ref field + + line_cnt=0 #log file line counter for line in enb_log_file.readlines(): + line_cnt+=1 # Runtime statistics result = re.search('Run time:' ,str(line)) if result is not None: @@ -857,20 +885,31 @@ class RANManagement(): #keys below are the markers we are loooking for, loop over this keys list #everytime these markers are found in the log file, the previous ones are overwritten in the dict #eventually we record and print only the last occurence - keys = {'dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled'} + keys = {'UE ID','dlsch_rounds','dlsch_total_bytes','ulsch_rounds','ulsch_total_bytes_scheduled'} for k in keys: result = re.search(k, line) if result is not None: #remove 1- all useless char before relevant info (ulsch or dlsch) 2- trailing char dlsch_ulsch_stats[k]=re.sub(r'^.*\]\s+', r'' , line.rstrip()) - #count "L1 thread not ready" msg - result = re.search('\[PHY\]\s+L1_thread isn\'t ready', str(line)) - if result is not None: - L1_thread_not_ready_cnt += 1 + #real time statistics for gNB + for k in rt_keys: + result = re.search(k, line) + if result is not None: + #remove 1- all useless char before relevant info 2- trailing char + line=line.replace('[0m','') + tmp=re.match(rf'^.*?(\b{k}\b.*)',line.rstrip()) #from python 3.6 we can use literal string interpolation for the variable k, using rf' in the regex + real_time_stats[k]=tmp.group(1) + #count "problem receiving samples" msg result = re.search('\[PHY\]\s+problem receiving samples', str(line)) if result is not None: - pb_receiving_samples_cnt += 1 + pb_receiving_samples_cnt += 1 + + #nsa markers logging + for k in nsa_markers: + result = re.search(k, line) + if result is not None: + nsa_markers[k].append(line_cnt) enb_log_file.close() logging.debug(' File analysis completed') @@ -879,7 +918,7 @@ class RANManagement(): else: nodeB_prefix = 'g' - if self.air_interface[self.eNB_instance] == 'nr-softmodem': + if nodeB_prefix == 'g': if ulschReceiveOK > 0: statMsg = nodeB_prefix + 'NB showed ' + str(ulschReceiveOK) + ' "ULSCH received ok" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') @@ -897,20 +936,31 @@ class RANManagement(): statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : PASS ' htmlMsg = statMsg+'\n' else: - statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL ' + statMsg = '[RAPROC] PUSCH with TC_RNTI message check for ' + nodeB_prefix + 'NB : FAIL or not relevant' htmlMsg = statMsg+'\n' logging.debug(statMsg) htmleNBFailureMsg += htmlMsg - #L1 thread not ready log - statMsg = '[PHY] L1 thread is not ready msg count = '+str(L1_thread_not_ready_cnt) - htmlMsg = statMsg+'\n' - logging.debug(statMsg) - htmleNBFailureMsg += htmlMsg #problem receiving samples log statMsg = '[PHY] problem receiving samples msg count = '+str(pb_receiving_samples_cnt) htmlMsg = statMsg+'\n' logging.debug(statMsg) htmleNBFailureMsg += htmlMsg + #nsa markers + statMsg = 'logfile line count = ' + str(line_cnt) + htmlMsg = statMsg+'\n' + logging.debug(statMsg) + htmleNBFailureMsg += htmlMsg + if len(nsa_markers['SgNBReleaseRequestAcknowledge'])!=0: + statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(nsa_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences , starting line ' + str(nsa_markers['SgNBReleaseRequestAcknowledge'][0]) + else: + statMsg = 'SgNBReleaseRequestAcknowledge = ' + str(len(nsa_markers['SgNBReleaseRequestAcknowledge'])) + ' occurences' + htmlMsg = statMsg+'\n' + logging.debug(statMsg) + htmleNBFailureMsg += htmlMsg + statMsg = 'FAILURE = ' + str(len(nsa_markers['FAILURE'])) + ' occurences' + htmlMsg = statMsg+'\n' + logging.debug(statMsg) + htmleNBFailureMsg += htmlMsg #ulsch and dlsch statistics if len(dlsch_ulsch_stats)!=0: #check if dictionary is not empty @@ -920,6 +970,47 @@ class RANManagement(): logging.debug(dlsch_ulsch_stats[key]) htmleNBFailureMsg += statMsg + #real time statistics + datalog_rt_stats['Data']={} + if len(real_time_stats)!=0: #check if dictionary is not empty + for k in real_time_stats: + tmp=re.match(r'^(?P.*):\s+(?P\d+\.\d+) us;\s+\d+;\s+(?P\d+\.\d+) us;',real_time_stats[k]) + if tmp is not None: + metric=tmp.group('metric') + avg=float(tmp.group('avg')) + max=float(tmp.group('max')) + datalog_rt_stats['Data'][metric]=["{:.0f}".format(avg),"{:.0f}".format(max),"{:.2f}".format(avg/datalog_rt_stats['Ref'][metric])] + #once all metrics are collected, store the data as a class attribute to build a dedicated HTML table afterward + self.datalog_rt_stats=datalog_rt_stats + #check if there is a fail => will render the test as failed + for k in datalog_rt_stats['Data']: + if float(datalog_rt_stats['Data'][k][2])> datalog_rt_stats['Threshold'][k]: #condition for fail : avg/ref is greater than the fixed threshold + #setting prematureExit is ok although not the best option + self.prematureExit=True + else: + statMsg = 'No real time stats found in the log file\n' + logging.debug('No real time stats found in the log file') + htmleNBFailureMsg += statMsg + + else: + #nsa markers + statMsg = 'logfile line count = ' + str(line_cnt) + htmlMsg = statMsg+'\n' + logging.debug(statMsg) + htmleNBFailureMsg += htmlMsg + if len(nsa_markers['SgNBReleaseRequest'])!=0: + statMsg = 'SgNBReleaseRequest = ' + str(len(nsa_markers['SgNBReleaseRequest'])) + ' occurences , starting line ' + str(nsa_markers['SgNBReleaseRequest'][0]) + else: + statMsg = 'SgNBReleaseRequest = ' + str(len(nsa_markers['SgNBReleaseRequest'])) + ' occurences' + htmlMsg = statMsg+'\n' + logging.debug(statMsg) + htmleNBFailureMsg += htmlMsg + statMsg = 'scgFailureInformationNR-r15 = ' + str(len(nsa_markers['scgFailureInformationNR-r15'])) + ' occurences' + htmlMsg = statMsg+'\n' + logging.debug(statMsg) + htmleNBFailureMsg += htmlMsg + + if uciStatMsgCount > 0: statMsg = nodeB_prefix + 'NB showed ' + str(uciStatMsgCount) + ' "uci->stat" message(s)' logging.debug('\u001B[1;30;43m ' + statMsg + ' \u001B[0m') diff --git a/ci-scripts/ran_dashboard.py b/ci-scripts/ran_dashboard.py new file mode 100644 index 0000000000..4f18638e68 --- /dev/null +++ b/ci-scripts/ran_dashboard.py @@ -0,0 +1,299 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# Merge Requests Dashboard for RAN on googleSheet +# +# Required Python Version +# Python 3.x +# +#--------------------------------------------------------------------- + +#----------------------------------------------------------- +# Import +#----------------------------------------------------------- + +#import google spreadsheet API +import gspread +from oauth2client.service_account import ServiceAccountCredentials + + +import subprocess +import shlex #lexical analysis +import json #json structures +import datetime #now() and date formating +from datetime import datetime +import re +import gitlab + +#----------------------------------------------------------- +# Class Declaration +#----------------------------------------------------------- + +class gDashboard: + def __init__(self, creds_file, spreadsheet, worksheet): #"creds.json", 'OAI RAN Dashboard', 'MR Status' + self.scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"] + self.creds = ServiceAccountCredentials.from_json_keyfile_name(creds_file, self.scope) + self.client = gspread.authorize(self.creds) + #spreadsheet + self.ss = self.client.open(spreadsheet) + #worksheet + self.sheet = self.ss.worksheet(worksheet) + self.ss.del_worksheet(self.sheet) #start by deleting the old sheet + self.sheet = self.ss.add_worksheet(title=worksheet, rows="100", cols="20") #create a new one + + self.d = {} #data dictionary + + + def fetchData(self,cmd): + #cmd="""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100" """ + process = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE) + output = process.stdout.readline() + tmp=output.decode("utf-8") + self.d = json.loads(tmp) + + + def gBuild(self, destinationSheetName): + + #line 1 : update date/time, format dd/mm/YY H:M:S + now = datetime.now() + dt_string = "Update : " + now.strftime("%d/%m/%Y %H:%M") + row =[dt_string] + self.sheet.insert_row(row, index=1, value_input_option='RAW') + + #line 2 empty + #line 3 is for the column names + i=3 + row =["MR","Created_at","Author","Title","Assignee", "Reviewer", "CAN START","IN PROGRESS","COMPLETED","Review Form","OK MERGE","Merge conflicts"] + self.sheet.insert_row(row, index=i, value_input_option='RAW') + + #line 4 onward, MR data lines + for x in range(len(self.d)): + i=i+1 + date_time_str = self.d[x]['created_at'] + date_time_obj = datetime.strptime(date_time_str, '%Y-%m-%dT%H:%M:%S.%fZ') + + milestone1=milestone2=milestone3=milestone4="" + if self.d[x]['milestone']!=None: + if self.d[x]['milestone']['title']=="REVIEW_CAN_START": + milestone1="X" + elif self.d[x]['milestone']['title']=="REVIEW_IN_PROGRESS": + milestone2="X" + elif self.d[x]['milestone']['title']=="REVIEW_COMPLETED_AND_APPROVED": + milestone3="X" + elif self.d[x]['milestone']['title']=="OK_TO_BE_MERGED": + milestone4="X" + else: + pass + else: + pass + + #check if empty or not + if self.d[x]['assignee']!=None: + assignee = str(self.d[x]['assignee']['name']) + else: + assignee = "" + + #check if empty or not + if len(self.d[x]['reviewers'])!=0: + reviewer = str(self.d[x]['reviewers'][0]['name']) + else: + reviewer = "" + + if self.d[x]['has_conflicts']==True: + conflicts = "YES" + else: + conflicts = "" + + + #add a column flagging that the review form is present + #we use gitlab API to parse the MR notes + gl = gitlab.Gitlab.from_config('OAI') + project_id = 223 + project = gl.projects.get(project_id) + #get the opened MR in the project + mrs = project.mergerequests.list(state='opened') + for m in range (0,len(mrs)): + if mrs[m].iid==self.d[x]['iid']:#check the iid is the one we are on + mr_notes = mrs[m].notes.list(all=True) + n=0 + found=False + review_form="" + while found==False and nUbuntu 16.04 LTS -- Summary" >> ./build_results.html - sca_summary_table_header ./archives/cppcheck/cppcheck.xml "OAI Static Code Analysis with CPPCHECK" - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory leak" memleak - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Memory is freed twice" doubleFree - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Resource leak" resourceLeak - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Possible null pointer dereference" nullPointer - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Array access out of bounds" arrayIndexOutOfBounds - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Buffer is accessed out of bounds" bufferAccessOutOfBounds - sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Expression depends on order of evaluation of side effects" unknownEvaluationOrder - sca_summary_table_footer ./archives/cppcheck/cppcheck.xml - -# summary_table_header "OAI Build: 4G LTE eNB -- USRP option" ./archives/enb_usrp -# summary_table_row "LTE SoftModem - Release 15" ./archives/enb_usrp/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_usrp_row1.html -# summary_table_row "Coding - Release 15" ./archives/enb_usrp/coding.Rel15.txt "Built target coding" ./enb_usrp_row2.html -# summary_table_row "OAI USRP device if - Release 15" ./archives/enb_usrp/oai_usrpdevif.Rel15.txt "Built target oai_usrpdevif" ./enb_usrp_row3.html -# summary_table_row "OAI ETHERNET transport - Release 15" ./archives/enb_usrp/oai_eth_transpro.Rel15.txt "Built target oai_eth_transpro" ./enb_usrp_row4.html -# summary_table_row "Parameters Lib Config - Release 15" ./archives/enb_usrp/params_libconfig.Rel15.txt "Built target params_libconfig" ./enb_usrp_row5.html -# summary_table_row "NASMESH - Release 15" ./archives/enb_usrp/nasmesh.Rel15.txt "Built target nasmesh" ./enb_usrp_row6.html -# summary_table_row "RB Tool - Release 15" ./archives/enb_usrp/rb_tool.Rel15.txt "Built target rb_tool" ./enb_usrp_row7.html -# summary_table_row "RF Simulator - Release 15" ./archives/enb_usrp/rfsimulator.Rel15.txt "Built target rfsimulator" ./enb_usrp_row8.html -# summary_table_row "TCP Bridge - Release 15" ./archives/enb_usrp/tcp_bridge_oai.Rel15.txt "Built target tcp_bridge_oai" ./enb_usrp_row9.html -# summary_table_footer -# summary_table_header "OAI Build: 4G LTE eNB -- USRP option" ./archives/enb_eth summary_table_row "LTE SoftModem - Release 15" ./archives/enb_eth/lte-softmodem.Rel15.txt "Built target lte-softmodem" ./enb_eth_row1.html summary_table_row "Coding - Release 15" ./archives/enb_eth/coding.Rel15.txt "Built target coding" ./enb_eth_row2.html @@ -634,48 +610,6 @@ function report_build { summary_table_row "NVRAM - Release 15" ./archives/basic_sim/nvram.Rel15.txt "Built target nvram" ./basic_sim_row13.html summary_table_footer - summary_table_header "OAI Build: 4G LTE / 5G NR Physical simulators option" ./archives/phy_sim - summary_table_row "LTE DL Simulator - Release 15" ./archives/phy_sim/dlsim.Rel15.txt "Built target dlsim" ./phy_sim_row1.html - summary_table_row "LTE UL Simulator - Release 15" ./archives/phy_sim/ulsim.Rel15.txt "Built target ulsim" ./phy_sim_row2.html - summary_table_row "Coding - Release 15" ./archives/phy_sim/coding.Rel15.txt "Built target coding" ./phy_sim_row3.html - if [ -f ./archives/phy_sim/ldpctest.Rel15.txt ] - then - summary_table_row "NR LDPC Test - Release 15" ./archives/phy_sim/ldpctest.Rel15.txt "Built target ldpctest" ./phy_sim_row4.html - fi - if [ -f ./archives/phy_sim/polartest.Rel15.txt ] - then - summary_table_row "NR Polar Test - Release 15" ./archives/phy_sim/polartest.Rel15.txt "Built target polartest" ./phy_sim_row5.html - fi - if [ -f ./archives/phy_sim/nr_pbchsim.Rel15.txt ] - then - summary_table_row "NR PBCH Test - Release 15" ./archives/phy_sim/nr_pbchsim.Rel15.txt "Built target nr_pbchsim" ./phy_sim_row6.html - fi - if [ -f ./archives/phy_sim/nr_dlschsim.Rel15.txt ] - then - summary_table_row "NR DLSCH Test - Release 15" ./archives/phy_sim/nr_dlschsim.Rel15.txt "Built target nr_dlschsim" ./phy_sim_row7.html - fi - if [ -f ./archives/phy_sim/nr_pucchsim.Rel15.txt ] - then - summary_table_row "NR PUCCH Test - Release 15" ./archives/phy_sim/nr_pucchsim.Rel15.txt "Built target nr_pucchsim" ./phy_sim_row8.html - fi - if [ -f ./archives/phy_sim/smallblocktest.Rel15.txt ] - then - summary_table_row "NR Small Block Test - Release 15" ./archives/phy_sim/smallblocktest.Rel15.txt "Built target smallblocktest" ./phy_sim_row9.html - fi - if [ -f ./archives/phy_sim/nr_dlsim.Rel15.txt ] - then - summary_table_row "NR DL Sim Test - Release 15" ./archives/phy_sim/nr_dlsim.Rel15.txt "Built target nr_dlsim" ./phy_sim_row10.html - fi - if [ -f ./archives/phy_sim/nr_ulschsim.Rel15.txt ] - then - summary_table_row "NR ULSCH Test - Release 15" ./archives/phy_sim/nr_ulschsim.Rel15.txt "Built target nr_ulschsim" ./phy_sim_row11.html - fi - if [ -f ./archives/phy_sim/nr_ulsim.Rel15.txt ] - then - summary_table_row "NR UL Sim Test - Release 15" ./archives/phy_sim/nr_ulsim.Rel15.txt "Built target nr_ulsim" ./phy_sim_row12.html - fi - summary_table_footer - if [ -f archives/gnb_usrp/nr-softmodem.Rel15.txt ] then summary_table_header "OAI Build: 5G NR gNB -- USRP option" ./archives/gnb_usrp @@ -718,13 +652,6 @@ function report_build { echo " " >> ./build_results.html echo "
" >> ./build_results.html -# if [ -f ./enb_usrp_row1.html ] || [ -f ./enb_usrp_row2.html ] || [ -f ./enb_usrp_row3.html ] || [ -f ./enb_usrp_row4.html ] -# then -# for DETAILS_TABLE in `ls ./enb_usrp_row*.html` -# do -# cat $DETAILS_TABLE >> ./build_results.html -# done -# fi if [ -f ./enb_eth_row1.html ] || [ -f ./enb_eth_row2.html ] || [ -f ./enb_eth_row3.html ] || [ -f ./enb_eth_row4.html ] || [ -f ./enb_eth_row5.html ] || [ -f ./enb_eth_row6.html ] || [ -f ./enb_eth_row7.html ] || [ -f ./enb_eth_row8.html ] || [ -f ./enb_eth_row9.html ] then for DETAILS_TABLE in `ls ./enb_eth_row*.html` @@ -746,13 +673,6 @@ function report_build { cat $DETAILS_TABLE >> ./build_results.html done fi - if [ -f ./phy_sim_row1.html ] || [ -f ./phy_sim_row2.html ] || [ -f ./phy_sim_row3.html ] || [ -f ./phy_sim_row4.html ] || [ -f ./phy_sim_row5.html ] || [ -f ./phy_sim_row6.html ] || [ -f ./phy_sim_row7.html ] || [ -f ./phy_sim_row8.html ] - then - for DETAILS_TABLE in `ls ./phy_sim_row*.html` - do - cat $DETAILS_TABLE >> ./build_results.html - done - fi if [ -f ./gnb_usrp_row1.html ] || [ -f ./gnb_usrp_row2.html ] || [ -f ./gnb_usrp_row3.html ] || [ -f ./gnb_usrp_row4.html ] then for DETAILS_TABLE in `ls ./gnb_usrp_row*.html` @@ -767,13 +687,6 @@ function report_build { cat $DETAILS_TABLE >> ./build_results.html done fi - if [ -f ./enb_usrp_rh_row1.html ] || [ -f ./enb_usrp_rh_row2.html ] || [ -f ./enb_usrp_rh_row3.html ] || [ -f ./enb_usrp_rh_row4.html ] - then - for DETAILS_TABLE in `ls ./enb_usrp_rh_row*.html` - do - cat $DETAILS_TABLE >> ./build_results.html - done - fi rm -f ./*_row*.html echo "
" >> ./build_results.html diff --git a/ci-scripts/reportTestLocally.sh b/ci-scripts/reportTestLocally.sh index 415ded57a4..105c95786f 100755 --- a/ci-scripts/reportTestLocally.sh +++ b/ci-scripts/reportTestLocally.sh @@ -309,14 +309,14 @@ function report_test { NB_ENB_GOT_SYNC=`egrep -c "got sync" $ENB_LOG` NB_UE_GOT_SYNC=`egrep -c "got sync" $UE_LOG` NB_ENB_SYNCED_WITH_UE=`egrep -c "got UE capabilities for UE" $ENB_LOG` - if [ $NB_ENB_GOT_SYNC -eq 1 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] + if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -eq 2 ] && [ $NB_ENB_SYNCED_WITH_UE -eq 1 ] then echo " OK" >> ./test_simulator_results.html else echo " KO" >> ./test_simulator_results.html fi echo "
" >> ./test_simulator_results.html
-                    if [ $NB_ENB_GOT_SYNC -eq 1 ]
+                    if [ $NB_ENB_GOT_SYNC -gt 0 ]
                     then
                         echo "- eNB --> got sync" >> ./test_simulator_results.html
                     else
@@ -749,6 +749,77 @@ function report_test {
         echo "      " >> ./test_simulator_results.html
 
         EPC_CONFIGS=("noS1")
+        TRANS_MODES=("tdd")
+        FR_MODE=("FR2")
+        BW_CASES=(32)
+        for CN_CONFIG in ${EPC_CONFIGS[@]}
+        do
+          for TMODE in ${TRANS_MODES[@]}
+          do
+            for BW in ${BW_CASES[@]}
+            do
+                echo "      " >> ./test_simulator_results.html
+                if [[ $CN_CONFIG =~ .*wS1.* ]]
+                then
+                    echo "          Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html
+                else
+                    echo "          Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html
+                fi
+                echo "      " >> ./test_simulator_results.html
+
+
+                #FR2 RA test (--do-ra option)
+
+                #build log files names tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_fr2_test.log
+
+                RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_fr2_test.log
+                RA_UE_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_ue_ra_fr2_test.log
+                if [ -f $RA_ENB_LOG ] && [ -f $RA_UE_LOG ]
+                then
+                    #get rid of full path
+                    NAME_ENB=`echo $RA_ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+                    NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
+                    echo "      " >> ./test_simulator_results.html
+                    echo "        $NAME_ENB --- $NAME_UE" >> ./test_simulator_results.html
+                    echo "        Check if FR2 RA proc succeeded" >> ./test_simulator_results.html
+
+                    #gNB RA check
+                    GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG`
+                    #UE RA check
+                    UE_RA_PROC_OK=`egrep -c "\[RAPROC\] RA procedure succeeded" $RA_UE_LOG`
+
+
+                    if [ $GNB_RECEIVED -gt 0 ] && [ $UE_RA_PROC_OK -gt 0 ]
+                    then
+                        echo "        OK" >> ./test_simulator_results.html
+                    else
+                        echo "        KO" >> ./test_simulator_results.html
+                    fi
+
+                    echo "        
" >> ./test_simulator_results.html
+                    if [ $GNB_RECEIVED -gt 0 ]
+                    then
+                        echo "- gNB --> RA received" >> ./test_simulator_results.html
+                    else
+                        echo "- gNB RA NOT RECEIVED" >> ./test_simulator_results.html
+                    fi
+                    if [ $UE_RA_PROC_OK -gt 0 ]
+                    then
+                        echo "- NR UE  --> RA procedure succeded" >> ./test_simulator_results.html
+                    else
+                        echo "- NR UE RA procedure failed" >> ./test_simulator_results.html
+                    fi
+                    echo "        
" >> ./test_simulator_results.html + echo " " >> ./test_simulator_results.html + fi + + done + done + done + + + EPC_CONFIGS=("noS1") + FR_MODE=("FR1") TRANS_MODES=("fdd" "tdd") BW_CASES=(106) for CN_CONFIG in ${EPC_CONFIGS[@]} @@ -760,13 +831,14 @@ function report_test { echo " " >> ./test_simulator_results.html if [[ $CN_CONFIG =~ .*wS1.* ]] then - echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB " >> ./test_simulator_results.html + echo " Test with EPC (aka withS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html else - echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB " >> ./test_simulator_results.html + echo " Test without EPC (aka noS1): ${TMODE} -- ${BW}PRB -- ${FR_MODE}" >> ./test_simulator_results.html fi echo " " >> ./test_simulator_results.html - #RA test (--do-ra option) + + #FR1 RA test (--do-ra option) #build log files names RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_test.log @@ -778,7 +850,7 @@ function report_test { NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"` echo " " >> ./test_simulator_results.html echo " $NAME_ENB --- $NAME_UE" >> ./test_simulator_results.html - echo " Check if RA proc succeeded" >> ./test_simulator_results.html + echo " Check if FR1 RA proc succeeded" >> ./test_simulator_results.html #gNB RA check GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG` diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index f818685049..7bd261fa0a 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -1235,9 +1235,9 @@ function start_rf_sim_gnb { then if [ $LOC_RA_TEST -eq 0 ] #no RA test => use --phy-test option then - echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test\" > ./my-nr-softmodem-run.sh " >> $1 + echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1 else #RA test => use --do-ra option - echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra\" > ./my-nr-softmodem-run.sh " >> $1 + echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1 fi fi echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1 @@ -1478,13 +1478,13 @@ function run_test_on_vm { echo "$VM_NAME has for IP addr = $VM_IP_ADDR" fi - if [ "$RUN_OPTIONS" == "none" ] + if [ "$RUN_OPTIONS" == "none" ] || [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]] then echo "No run on VM testing for this variant currently" return fi - if [[ $RUN_OPTIONS =~ .*run_exec_autotests.* ]] + if [[ $RUN_OPTIONS =~ .*run_XXXX_autotests.* ]] then echo "############################################################" echo "Running test script on VM ($VM_NAME)" @@ -2189,6 +2189,115 @@ function run_test_on_vm { if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]] then + echo "############################################################" + echo "RA TEST FR2" + echo "############################################################" + #RA FR2 test, attention : has a different config file from the rest of the test + CN_CONFIG="noS1" + CONF_FILE=gnb.band261.tm1.32PRB.usrpn300.conf + S1_NOS1_CFG=0 + PRB=32 + FREQUENCY=28000 #28GHz + + if [ ! -d $ARCHIVES_LOC ] + then + mkdir --parents $ARCHIVES_LOC + fi + + CN_CONFIG="noS1" + S1_NOS1_CFG=0 + + ######### start of RA TEST loop + # for the moment only TDD + TRANS_MODES=("tdd") + for TMODE in ${TRANS_MODES[@]} + do + if [[ $TMODE =~ .*fdd.* ]] + then + CONF_FILE=gnb.band66.tm1.106PRB.usrpn300.conf + PRB=106 + FREQUENCY=37000 + else + CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf + PRB=106 + FREQUENCY=3510 + fi + + local try_cnt=0 + NR_STATUS=0 + while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI + + do + SYNC_STATUS=0 + RA_FR2_STATUS=0 + rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*ra_fr2_test.log + + echo "############################################################" + echo "${CN_CONFIG} : Starting the gNB in ${TMODE} mode (RA TEST)" + echo "############################################################" + CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_fr2_test.log + #last argument = 1 is to enable --do-ra for RA test + start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 1 + + echo "############################################################" + echo "${CN_CONFIG} : Starting the NR-UE in ${TMODE} mode (RA TEST)" + echo "############################################################" + CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_ra_fr2_test.log + #last argument = 1 is to enable --do-ra for RA test + start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1 + if [ $NR_UE_SYNC -eq 0 ] + then + echo "Problem w/ gNB and NR-UE not syncing" + terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2 + terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1 + scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC + SYNC_STATUS=-1 + try_cnt=$((try_cnt+1)) + continue + fi + + echo "############################################################" + echo "${CN_CONFIG} : Terminate gNB/NR-UE simulators" + echo "############################################################" + sleep 20 + terminate_enb_ue_basic_sim $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 2 + terminate_enb_ue_basic_sim $GNB_VM_CMDS $GNB_VM_IP_ADDR 1 + scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_NR_UE_LOG_FILE $ARCHIVES_LOC + + #check RA markers in gNB and NR UE log files + echo "############################################################" + echo "${CN_CONFIG} : Checking FR2 RA on gNB / NR-UE" + echo "############################################################" + + # Proper check to be done when RA test is working! + check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE + if [ $RA_FR2_STATUS -ne 0 ] + then + echo "RA FR2 test NOT OK" + echo "try_cnt = " $try_cnt + try_cnt=$((try_cnt+1)) + else + try_cnt=$((try_cnt+10)) + fi + done + ########### end RA FR2 test + + sleep 30 + + + echo "############################################################" + echo "RA TEST FR1" + echo "############################################################" + ######### redefine config for the rest of the test + + CN_CONFIG="noS1" + CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf + S1_NOS1_CFG=0 + PRB=106 + FREQUENCY=3510 + if [ ! -d $ARCHIVES_LOC ] then mkdir --parents $ARCHIVES_LOC @@ -2258,14 +2367,14 @@ function run_test_on_vm { #check RA markers in gNB and NR UE log files echo "############################################################" - echo "${CN_CONFIG} : Checking RA on gNB / NR-UE" + echo "${CN_CONFIG} : Checking FR1 RA on gNB / NR-UE" echo "############################################################" # Proper check to be done when RA test is working! check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE if [ $RA_STATUS -ne 0 ] then - echo "RA test NOT OK" + echo "RA FR1 test NOT OK" echo "try_cnt = " $try_cnt try_cnt=$((try_cnt+1)) else @@ -2401,6 +2510,7 @@ function run_test_on_vm { echo "Checking run status" echo "############################################################" + if [ $RA_FR2_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $RA_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $SYNC_STATUS -ne 0 ]; then NR_STATUS=-1; fi if [ $PING_STATUS -ne 0 ]; then NR_STATUS=-1; fi diff --git a/ci-scripts/sshconnection.py b/ci-scripts/sshconnection.py index 5bfe5da70f..b4087c9695 100644 --- a/ci-scripts/sshconnection.py +++ b/ci-scripts/sshconnection.py @@ -35,6 +35,7 @@ import pexpect # pexpect import logging import time # sleep import re +import subprocess import sys #----------------------------------------------------------- @@ -44,6 +45,9 @@ class SSHConnection(): def __init__(self): self.ssh = '' self.picocom_closure = False + self.ipaddress = '' + self.username = '' + self.cmd2Results = '' def disablePicocomClosure(self): self.picocom_closure = False @@ -98,6 +102,8 @@ class SSHConnection(): pass else: sys.exit('SSH Connection Failed') + self.ipaddress = ipaddress + self.username = username @@ -111,11 +117,20 @@ class SSHConnection(): self.sshresponse = self.ssh.expect(expected) return self.sshresponse - def command(self, commandline, expectedline, timeout): - logging.debug(commandline) + def command(self, commandline, expectedline, timeout, silent=False, resync=False): + if not silent: + logging.debug(commandline) self.ssh.timeout = timeout - self.ssh.sendline(commandline) - self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT]) + # Nasty patch when pexpect output is out of sync. + # Much pronounced when running back-to-back-back oc commands + if resync: + self.ssh.send(commandline) + self.ssh.expect([commandline, pexpect.TIMEOUT]) + self.ssh.send('\r\n') + self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT]) + else: + self.ssh.sendline(commandline) + self.sshresponse = self.ssh.expect([expectedline, pexpect.EOF, pexpect.TIMEOUT]) if self.sshresponse == 0: return 0 elif self.sshresponse == 1: @@ -137,10 +152,23 @@ class SSHConnection(): logging.debug('Expected Line : ' + expectedline) sys.exit(self.sshresponse) + def command2(self, commandline, timeout, silent=False): + if not silent: + logging.debug(commandline) + self.cmd2Results = '' + myHost = self.username + '@' + self.ipaddress + # CAUTION: THIS METHOD IMPLIES THAT THERE ARE VALID SSH KEYS + # BETWEEN THE PYTHON EXECUTOR NODE AND THE REMOTE HOST + # OTHERWISE IT WON'T WORK + lSsh = subprocess.Popen(["ssh", "%s" % myHost, commandline],shell=False,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + self.cmd2Results = str(lSsh.stdout.readlines()) + def close(self): self.ssh.timeout = 5 self.ssh.sendline('exit') self.sshresponse = self.ssh.expect([pexpect.EOF, pexpect.TIMEOUT]) + self.ipaddress = '' + self.username = '' if self.sshresponse == 0: pass elif self.sshresponse == 1: diff --git a/ci-scripts/waitBuildOnVM.sh b/ci-scripts/waitBuildOnVM.sh index ff2129a187..4a604a1fe9 100755 --- a/ci-scripts/waitBuildOnVM.sh +++ b/ci-scripts/waitBuildOnVM.sh @@ -47,7 +47,7 @@ function wait_on_vm_build { echo "ARCHIVES_LOC = $ARCHIVES_LOC" echo "BUILD_OPTIONS = $BUILD_OPTIONS" - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] then echo "This VM type is no longer supported in the pipeline framework" return @@ -73,6 +73,9 @@ function wait_on_vm_build { echo "############################################################" echo "Waiting build process to end on VM ($VM_NAME)" echo "############################################################" + # Since the last VM was cppcheck and is removed + # we are going too fast in wait and the build_oai is not yet started + sleep 120 if [[ "$VM_NAME" == *"-cppcheck"* ]] then @@ -90,7 +93,7 @@ function wait_on_vm_build { } function check_on_vm_build { - if [[ "$VM_NAME" == *"-enb-usrp"* ]] + if [[ "$VM_NAME" == *"-enb-usrp"* ]] || [[ "$VM_NAME" == *"-cppcheck"* ]] || [[ "$VM_NAME" == *"-phy-sim"* ]] then echo "This VM type is no longer supported in the pipeline framework" return diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index 0e00a2e7d4..2282e101e5 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -37,3 +37,5 @@ - Build_Image - Deploy_Object - Undeploy_Object + - Cppcheck_Analysis + - Deploy_Run_PhySim \ No newline at end of file diff --git a/ci-scripts/xml_files/benetel_nsa_quectel.xml b/ci-scripts/xml_files/benetel_nsa_quectel.xml new file mode 100644 index 0000000000..ed93f59e81 --- /dev/null +++ b/ci-scripts/xml_files/benetel_nsa_quectel.xml @@ -0,0 +1,147 @@ + + + TEST-NSA-FR1-TM1 + NSA Ping DL UL with QUECTEL + tasks + 3 + + 030000 + 040000 + 000002 + 010000 + 050000 + 050001 + 000001 + 070000 + 000001 + 070001 + 000001 + 010002 + 000001 + 080001 + 080000 + + + + + Initialize_UE + Initialize Quectel + idefix + + + + + Detach_UE + Detach UE + idefix + + + + + Initialize_eNB + Initialize eNB + -O ci-scripts/conf_files/benetel-4g.conf + 0 + 0 + lte + + + + + Initialize_eNB + Initialize gNB + -O ci-scripts/conf_files/benetel-5g.conf -q + 1 + 1 + nr + + + + IdleSleep + Sleep + 5 + + + + IdleSleep + Sleep + 20 + + + + + Ping + Ping: 20pings in 20sec + idefix + -c 20 + 50 + + + + Ping + Ping: 100pings in 20sec + idefix + -c 100 -i 0.2 + 50 + + + + Iperf + iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile) + -u -b 20M -t 60 -i 1 + DL + idefix + 50 + single-ue + + + + Iperf + iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) + -u -b 3M -t 60 -i 1 + UL + idefix + 50 + single-ue + + + + + Terminate_eNB + Terminate eNB + 0 + 0 + lte + + + + Terminate_eNB + Terminate gNB + 1 + 1 + nr + + + + diff --git a/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml b/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml new file mode 100644 index 0000000000..93c0c5a00a --- /dev/null +++ b/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml @@ -0,0 +1,149 @@ + + + TEST-NSA-FR1-TM1 + NSA Ping DL UL with QUECTEL + tasks + 3 + + 030000 + 040000 + 000002 + 010000 + 000001 + 050000 + 050001 + 000001 + 070000 + 000001 + 070001 + 000001 + 010002 + 000001 + 080001 + 080000 + + + + + + Initialize_UE + Initialize Quectel + idefix + + + + + Detach_UE + Detach UE + idefix + + + + + Initialize_eNB + Initialize eNB + -O ci-scripts/conf_files/benetel-4g.conf + 0 + 0 + lte + + + + + Initialize_eNB + Initialize gNB + -O ci-scripts/conf_files/benetel-5g.conf -q + 1 + 1 + nr + + + + IdleSleep + Sleep + 10 + + + + IdleSleep + Sleep + 30 + + + + + Ping + Ping: 20pings in 20sec + idefix + -c 20 + 50 + + + + Ping + Ping: 100pings in 20sec + idefix + -c 100 -i 0.2 + 50 + + + + Iperf + iperf (DL/20Mbps/UDP)(20 min)(single-ue profile) + -u -b 20M -t 1200 -i 1 + DL + idefix + 50 + single-ue + + + + Iperf + iperf (UL/3Mbps/UDP)(20 min)(single-ue profile) + -u -b 2M -t 1200 -i 1 + UL + idefix + 50 + single-ue + + + + + Terminate_eNB + Terminate eNB + 0 + 0 + lte + + + + Terminate_eNB + Terminate gNB + 1 + 1 + nr + + + + diff --git a/ci-scripts/xml_files/container_image_build.xml b/ci-scripts/xml_files/container_image_build.xml index 430729c49c..e7eabc0794 100644 --- a/ci-scripts/xml_files/container_image_build.xml +++ b/ci-scripts/xml_files/container_image_build.xml @@ -35,6 +35,7 @@ all 0 0 + True diff --git a/ci-scripts/xml_files/cppcheck.xml b/ci-scripts/xml_files/cppcheck.xml new file mode 100644 index 0000000000..dd90d88f7e --- /dev/null +++ b/ci-scripts/xml_files/cppcheck.xml @@ -0,0 +1,37 @@ + + + build-tab + CPPCHECK Analysis + wrench + + 000001 + + + + + Cppcheck_Analysis + Static Code Analysis with cppcheck + + + diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml new file mode 100644 index 0000000000..6c2bd6bd26 --- /dev/null +++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml @@ -0,0 +1,147 @@ + + + TEST-NSA-FR1-TM1 + NSA Ping DL UL with QUECTEL + tasks + 3 + + 030000 + 040000 + 000002 + 010000 + 050000 + 050001 + 000001 + 070000 + 000001 + 070000 + 000001 + 010002 + 000001 + 080001 + 080000 + + + + + Initialize_UE + Initialize Quectel + idefix + + + + + Detach_UE + Detach UE + idefix + + + + + Initialize_eNB + Initialize eNB + -O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf + 0 + 0 + lte + + + + + Initialize_eNB + Initialize gNB + -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpn310.conf -q + 1 + 1 + nr + + + + IdleSleep + Sleep + 5 + + + + IdleSleep + Sleep + 20 + + + + + Ping + Ping: 20pings in 20sec + idefix + -c 20 + 50 + + + + Ping + Ping: 100pings in 20sec + idefix + -c 100 -i 0.2 + 50 + + + + Iperf + iperf (DL/20Mbps/UDP)(60 sec)(single-ue profile) + -u -b 20M -t 60 -i 1 + DL + idefix + 50 + single-ue + + + + Iperf + iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile) + -u -b 3M -t 60 -i 1 + UL + idefix + 50 + single-ue + + + + + Terminate_eNB + Terminate eNB + 0 + 0 + lte + + + + Terminate_eNB + Terminate gNB + 1 + 1 + nr + + + + diff --git a/ci-scripts/xml_files/gnb_phytest_usrp_run.xml b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml new file mode 100644 index 0000000000..9e798afdc4 --- /dev/null +++ b/ci-scripts/xml_files/gnb_phytest_usrp_run.xml @@ -0,0 +1,53 @@ + + + gNB-PHY-Test + Run-gNB-PHY-Test + tasks + 3 + +090101 000001 090109 + + + + + Initialize_eNB + Initialize gNB USRP + -O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106 + NR + + + + IdleSleep + Sleep + 300 + + + + + Terminate_eNB + Terminate gNB + NR + + + diff --git a/ci-scripts/xml_files/multi_rru_band38_build.xml b/ci-scripts/xml_files/multi_rru_band38_build.xml index ba45eab10a..1370a3a396 100644 --- a/ci-scripts/xml_files/multi_rru_band38_build.xml +++ b/ci-scripts/xml_files/multi_rru_band38_build.xml @@ -26,7 +26,7 @@ wrench 010101 010102 010103 - 000101 000102 000103 + 000102 000103 000101 @@ -50,7 +50,7 @@ Build_eNB Build Master RRU - -w USRP -c --eNB --ninja + -w USRP -c --RU --ninja 1 1 True @@ -59,7 +59,7 @@ WaitEndBuild_eNB Wait for end of Build Master RRU - -w USRP -c --eNB --ninja + -w USRP -c --RU --ninja 1 1 @@ -67,7 +67,7 @@ Build_eNB Build Slave RRU - -w USRP -c --eNB --ninja + -w USRP -c --RU --ninja 2 2 True @@ -76,7 +76,7 @@ WaitEndBuild_eNB Wait for end of Build Slave RRU - -w USRP -c --eNB --ninja + -w USRP -c --RU --ninja 2 2 diff --git a/ci-scripts/xml_files/physim_deploy_run.xml b/ci-scripts/xml_files/physim_deploy_run.xml new file mode 100644 index 0000000000..63152c1fb5 --- /dev/null +++ b/ci-scripts/xml_files/physim_deploy_run.xml @@ -0,0 +1,37 @@ + + + build-tab + Physical Simulators Check + wrench + + 010201 + + + + + Deploy_Run_PhySim + Deploy and run physical simulator on openshift + + + diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 626d938625..8d8e88455a 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -45,6 +45,8 @@ include_directories(${CONFIG_INCLUDE_DIRS}) pkg_search_module(CRYPTO libcrypto REQUIRED) include_directories(${CRYPTO_INCLUDE_DIRS}) +#uhd 4.0 and iris installs by default in /usr/local +include_directories("/usr/local/include/") #use native cmake method as this package is not in pkg-config if (${RF_BOARD} STREQUAL "OAI_USRP") find_package(Boost REQUIRED) @@ -52,7 +54,7 @@ if (${RF_BOARD} STREQUAL "OAI_USRP") elseif (${RF_BOARD} STREQUAL "OAI_IRIS") include_directories("${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/") - include_directories("/usr/local/include/") + set(HW_SOURCE ${HW_SOURCE} ${OPENAIR_TARGETS}/ARCH/IRIS/USERSPACE/LIB/iris_lib.cpp) LINK_DIRECTORIES("/usr/local/lib") @@ -60,6 +62,8 @@ elseif (${RF_BOARD} STREQUAL "OAI_IRIS") endif (${RF_BOARD} STREQUAL "OAI_USRP") +message("RU=${RU}") + pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2) if(NOT ${OPENPGM_FOUND}) message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built") @@ -333,6 +337,11 @@ else (CUDA_FOUND) ) endif () +if (SANITIZE_ADDRESS) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") +endif () + add_definitions("-DASN_DISABLE_OER_SUPPORT") ######################### @@ -405,6 +414,7 @@ add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") +add_boolean_option(NEW_GTPU False "NEW_GTP") set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti) add_library(ITTI @@ -413,7 +423,6 @@ add_library(ITTI ) add_dependencies(ITTI rrc_flag) set(ITTI_LIB ITTI) - set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c) ################################################## @@ -430,7 +439,6 @@ set(asn1_generated_dir ${OPENAIR_BIN_DIR}) set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf") set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) - # RRC ###### set (RRC_ASN1_VERSION "Rel15") @@ -441,15 +449,18 @@ add_definitions(-DLTE_RRC_VERSION=${LTE_RRC_VERSION}) set (RRC_FULL_DIR ${asn1_generated_dir}/RRC_${RRC_ASN1_VERSION}) # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make -execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_" - RESULT_VARIABLE ret) +if (${RU} STREQUAL 0) + execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "LTE_" " " "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" + RESULT_VARIABLE ret) +endif (${RU} STREQUAL 0) + if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") endif (NOT ${ret} STREQUAL 0) file(GLOB rrc_source ${RRC_FULL_DIR}/*.c) add_custom_target ( rrc_flag ALL - ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" "LTE_" + ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "LTE_" " " "${RRC_FULL_DIR}" "${RRC_GRAMMAR}" DEPENDS ${RRC_GRAMMAR} ) @@ -470,16 +481,18 @@ add_definitions(-DNR_RRC_VERSION=${NR_RRC_VERSION}) set (NR_RRC_FULL_DIR ${asn1_generated_dir}/RRC_${NR_RRC_ASN1_VERSION}) # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make -execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice" - RESULT_VARIABLE ret) + execute_process( + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NR_" "-findirect-choice" "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" + RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") endif () file(GLOB nr_rrc_source ${NR_RRC_FULL_DIR}/*.c) file(GLOB nr_rrc_h ${NR_RRC_FULL_DIR}/*.h) + add_custom_target ( nr_rrc_flag ALL - ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" "NR_" "-findirect-choice" + ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NR_" "-findirect-choice" "${NR_RRC_FULL_DIR}" "${NR_RRC_GRAMMAR}" DEPENDS ${NR_RRC_GRAMMAR} ) @@ -504,31 +517,34 @@ set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${S1AP_RELEASE}) set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${S1AP_RELEASE}) # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make -execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps - RESULT_VARIABLE ret) -if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${ret}: error") -endif (NOT ${ret} STREQUAL 0) -file(GLOB S1AP_source ${S1AP_C_DIR}/*.c) +if (${RU} STREQUAL 0) + execute_process( + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "S1AP_" -fno-include-deps "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" + RESULT_VARIABLE ret) + if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${ret}: error") + endif (NOT ${ret} STREQUAL 0) + file(GLOB S1AP_source ${S1AP_C_DIR}/*.c) +endif (${RU} STREQUAL 0) -add_custom_target ( - s1ap_flag ALL - ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" "S1AP_" -fno-include-deps - DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" -) - -add_library(S1AP_LIB - ${S1AP_source} - ${S1AP_DIR}/s1ap_common.c + add_custom_target ( + s1ap_flag ALL + ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "S1AP_" -fno-include-deps "${S1AP_C_DIR}" "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" + DEPENDS "${S1AP_ASN_DIR}/${S1AP_ASN_FILES}" ) -add_dependencies(S1AP_LIB rrc_flag s1ap_flag) -include_directories ("${S1AP_C_DIR}") -include_directories ("${S1AP_DIR}") + add_library(S1AP_LIB + ${S1AP_source} + ${S1AP_DIR}/s1ap_common.c + ) + add_dependencies(S1AP_LIB rrc_flag s1ap_flag) + + include_directories ("${S1AP_C_DIR}") + include_directories ("${S1AP_DIR}") add_library(S1AP_ENB - ${S1AP_DIR}/s1ap_eNB.c - ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c + ${S1AP_DIR}/s1ap_eNB.c + ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c ${S1AP_DIR}/s1ap_eNB_decoder.c ${S1AP_DIR}/s1ap_eNB_encoder.c ${S1AP_DIR}/s1ap_eNB_handlers.c @@ -558,8 +574,9 @@ set(NGAP_ASN_DIR ${NGAP_DIR}/MESSAGES/ASN1/ASN1_files) set(NGAP_C_DIR ${asn1_generated_dir}/NGAP_${NGAP_RELEASE}) # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make -execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}" "NGAP_" -fno-include-deps -findirect-choice - RESULT_VARIABLE ret) +execute_process( + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NGAP_" "-fno-include-deps -findirect-choice" "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}" + RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") endif (NOT ${ret} STREQUAL 0) @@ -567,7 +584,7 @@ file(GLOB NGAP_source ${NGAP_C_DIR}/*.c) add_custom_target ( ngap_flag ALL - ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}" "NGAP_" -fno-include-deps + ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "NGAP_" "-fno-include-deps -findirect-choice" "${NGAP_C_DIR}" "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}" DEPENDS "${NGAP_ASN_DIR}/${NGAP_ASN_FILES}" ) @@ -624,17 +641,20 @@ set(M2AP_ASN_DIR ${M2AP_DIR}/MESSAGES/ASN1/${M2AP_RELEASE}) set(M2AP_C_DIR ${asn1_generated_dir}/M2AP_${M2AP_RELEASE}) # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make -execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" "M2AP_" -fno-include-deps -DEMIT_ASN_DEBUG=1 - RESULT_VARIABLE ret) -if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${ret}: error") -endif (NOT ${ret} STREQUAL 0) +if (${RU} STREQUAL 0) + execute_process( + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps -DEMIT_ASN_DEBUG=1" "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" + RESULT_VARIABLE ret) + if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${ret}: error") + endif (NOT ${ret} STREQUAL 0) +endif (${RU} STREQUAL 0) file(GLOB M2AP_source ${M2AP_C_DIR}/*.c) add_custom_target ( m2_flag ALL - COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" "M2AP_" -fno-include-deps + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps -DEMIT_ASN_DEBUG=1" "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" DEPENDS ${M2AP_ASN_DIR}/${M2AP_ASN_FILES} ) @@ -694,17 +714,20 @@ set(M3AP_ASN_DIR ${M3AP_DIR}/MESSAGES/ASN1/${M3AP_RELEASE}) set(M3AP_C_DIR ${asn1_generated_dir}/M3AP_${M3AP_RELEASE}) # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make -execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" "M3AP_" -fno-include-deps - RESULT_VARIABLE ret) -if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${ret}: error") -endif (NOT ${ret} STREQUAL 0) +if (${RU} STREQUAL 0) + execute_process( + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M3AP_" -fno-include-deps "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" + RESULT_VARIABLE ret) + if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${ret}: error") + endif (NOT ${ret} STREQUAL 0) +endif (${RU} STREQUAL 0) file(GLOB M3AP_source ${M3AP_C_DIR}/*.c) add_custom_target ( m3_flag ALL - COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" "M3AP_" -fno-include-deps + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M3AP_" -fno-include-deps "${M3AP_C_DIR}" "${M3AP_ASN_DIR}/${M3AP_ASN_FILES}" DEPENDS ${M3AP_ASN_DIR}/${M3AP_ASN_FILES} ) @@ -748,17 +771,20 @@ add_definitions(-DX2AP_VERSION=${X2AP_VERSION}) set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${X2AP_RELEASE}) set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${X2AP_RELEASE}) # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make -execute_process(COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps - RESULT_VARIABLE ret) -if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${ret}: error") -endif (NOT ${ret} STREQUAL 0) +if (${RU} STREQUAL 0) + execute_process( + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "X2AP_" -fno-include-deps "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" + RESULT_VARIABLE ret) + if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${ret}: error") + endif (NOT ${ret} STREQUAL 0) +endif (${RU} STREQUAL 0) file(GLOB X2AP_source ${X2AP_C_DIR}/*.c) add_custom_target ( x2_flag ALL - COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" "X2AP_" -fno-include-deps + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "X2AP_" -fno-include-deps "${X2AP_C_DIR}" "${X2AP_ASN_DIR}/${X2AP_ASN_FILES}" DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} ) @@ -787,12 +813,12 @@ add_dependencies(X2AP_ENB X2AP_LIB rrc_flag x2_flag) # F1AP ############## -add_list1_option(F1AP_RELEASE R15 "F1AP ASN.1 grammar version" R15) +add_list1_option(F1AP_RELEASE R16 "F1AP ASN.1 grammar version" R16) set(F1AP_DIR ${OPENAIR2_DIR}/F1AP) -if (${F1AP_RELEASE} STREQUAL "R15") - make_version(F1AP_VERSION 15 2 1) - set (ASN1RELDIR R15.2.1) -endif(${F1AP_RELEASE} STREQUAL "R15") +if (${F1AP_RELEASE} STREQUAL "R16") + make_version(F1AP_VERSION 16 3 1) + set (ASN1RELDIR R16.3.1) +endif(${F1AP_RELEASE} STREQUAL "R16") add_definitions(-DF1AP_VERSION=${F1AP_VERSION}) set(F1AP_ASN_DIR ${F1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) set(F1AP_ASN_FILES @@ -804,22 +830,28 @@ set(F1AP_ASN_FILES ${F1AP_ASN_DIR}/F1AP-Containers.asn ) -set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR}) -message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}") -execute_process(COMMAND mkdir -p ${F1AP_ASN_GENERATED_C_DIR} - COMMAND env "ASN1C_PREFIX=F1AP_" asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES} - RESULT_VARIABLE ret - OUTPUT_QUIET - ERROR_QUIET) +if (${RU} STREQUAL 0) + set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR}) + message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}") + execute_process( + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES} + RESULT_VARIABLE ret + ) -if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "asn1c: error") -endif (NOT ${ret} STREQUAL 0) - -file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c) -add_library(F1AP_LIB - ${F1AP_ASN_GENERATED_C_FILES} -) + if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "asn1c: error") + endif (NOT ${ret} STREQUAL 0) + + add_custom_target ( + f1_flag ALL + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES} + DEPENDS ${F1AP_ASN_FILES} + ) + file(GLOB F1AP_ASN_GENERATED_C_FILES ${F1AP_ASN_GENERATED_C_DIR}/*.c) + add_library(F1AP_LIB + ${F1AP_ASN_GENERATED_C_FILES} + ) + add_dependencies (F1AP_LIB f1_flag) include_directories ("${F1AP_ASN_GENERATED_C_DIR}") include_directories ("${F1AP_DIR}") @@ -829,16 +861,15 @@ add_library(F1AP ${F1AP_C_FILES} ) +endif (${RU} STREQUAL 0) # Hardware dependant options ################################### -add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") +add_list1_option(NB_ANTENNAS_RX "4" "Number of antennas in reception" "1" "2" "4") add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4") add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "OAI_USRP" "OAI_BLADERF" "OAI_LMSSDR" "OAI_SIMU") - - add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET") #NOKIA config enhancement set (CONFIG_ROOTDIR @@ -1635,7 +1666,6 @@ set(PHY_SRC_COMMON ${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c ${OPENAIR1_DIR}/PHY/INIT/init_top.c ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c - ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c ${OPENAIR1_DIR}/PHY/TOOLS/dfts_load.c ${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c @@ -1973,6 +2003,7 @@ set(NR_PDCP_SRC ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_sdu.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c + ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c ) @@ -2227,26 +2258,21 @@ add_library(CN_UTILS ) set(GTPV1U_DIR ${OPENAIR3_DIR}/GTPV1-U) -set (GTPV1U_SRC - ${RRC_DIR}/rrc_eNB_GTPV1U.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c - ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1u.c - ${GTPV1U_DIR}/gtpv1u_teid_pool.c -) -add_library(GTPV1U ${GTPV1U_SRC}) -add_dependencies(GTPV1U rrc_flag) -#add_library (GTPV1U_OCP -#${OPENAIR3_DIR}/ocp-gtp/gtp_itf.cpp -#) -#include_directories(${OPENAIR3_DIR}/ocp-gtp) +add_library (GTPV1U_OCP + ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c + ${RRC_DIR}/rrc_eNB_GTPV1U.c +${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp +) +add_dependencies(GTPV1U_OCP rrc_flag) +include_directories(${OPENAIR3_DIR}/ocp-gtp) #NR case set (NR_GTPV1U_SRC ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c ${RRC_DIR}/rrc_eNB_GTPV1U.c + ${GTPV1U_DIR}/gtpv1u_eNB.c + ${GTPV1U_DIR}/gtpv1u_gNB.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c @@ -2256,6 +2282,12 @@ set (NR_GTPV1U_SRC add_library(NR_GTPV1U ${NR_GTPV1U_SRC}) add_dependencies(NR_GTPV1U rrc_flag) +if (${NEW_GTPU}) +set(GTPV1U GTPV1U_OCP) +else() +set(GTPV1U NR_GTPV1U) +endif() + set (MME_APP_SRC ${OPENAIR3_DIR}/MME_APP/mme_app.c ${OPENAIR3_DIR}/MME_APP/mme_config.c @@ -2794,6 +2826,7 @@ add_library(rfsimulator MODULE ${OPENAIR_TARGETS}/ARCH/rfsimulator/simulator.c ${OPENAIR_TARGETS}/ARCH/rfsimulator/apply_channelmod.c ${OPENAIR_TARGETS}/ARCH/rfsimulator/new_channel_sim.c + ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c ) target_link_libraries(rfsimulator SIMU_COMMON ${ATLAS_LIBRARIES}) @@ -2808,6 +2841,7 @@ include_directories("${OPENAIR_DIR}/common/utils/T") if (${T_TRACER}) set(T_SOURCE + ${OPENAIR_DIR}/common/utils/T/T_IDs.h ${OPENAIR_DIR}/common/utils/T/T.c ${OPENAIR_DIR}/common/utils/T/local_tracer.c) set(T_LIB "rt") @@ -2817,8 +2851,6 @@ endif (${T_TRACER}) #This rule and the following deal with it. add_custom_command ( OUTPUT ${OPENAIR_DIR}/common/utils/T/T_IDs.h - COMMAND make clean - COMMAND make -j2 COMMAND make check_vcd WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt @@ -2826,6 +2858,10 @@ add_custom_command ( ${OPENAIR_DIR}/common/utils/LOG/vcd_signal_dumper.h ) +execute_process ( + COMMAND make check_vcd + WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T +) #This rule is specifically needed to generate T files #before anything else in a project that uses the T. #See below, there are some 'add_dependencies' showing that. @@ -2895,7 +2931,8 @@ add_executable(lte-softmodem ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} + ${OPENAIR_DIR}/common/utils/lte/ue_power.c + ${OPENAIR_DIR}/common/utils/lte/prach_utils.c ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -2905,7 +2942,8 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer) target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) @@ -2936,7 +2974,8 @@ add_executable(ocp-enb ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} + ${OPENAIR_DIR}/common/utils/lte/ue_power.c + ${OPENAIR_DIR}/common/utils/lte/prach_utils.c ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -2946,7 +2985,8 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l target_link_libraries (ocp-enb -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) @@ -2980,6 +3020,33 @@ target_link_libraries(du_test ${PROTO_AGENT_LIB} pthread UTIL ${T_LIB} dl ${ITTI_LIB} ) +add_executable(oairu + ${OPENAIR_TARGETS}/RT/USER/lte-ru.c + ${OPENAIR_TARGETS}/RT/USER/ru_control.c + ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c + ${OPENAIR_DIR}/executables/softmodem-common.c + ${OPENAIR_DIR}/openair1/SCHED/phy_procedures_lte_common.c + ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c + ${OPENAIR_DIR}/executables/main_ru.c + ${T_SOURCE} + ${OPENAIR_DIR}/common/utils/LOG/log.c + ${CONFIG_SOURCES} + ${OPENAIR_DIR}/common/utils/utils.c + ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/lte/prach_utils.c + ${SHLIB_LOADER_SOURCES} +) +target_link_libraries (oairu + -Wl,--start-group + SCHED_RU_LIB + PHY_COMMON PHY_RU + -Wl,--end-group z dl) + +target_link_libraries (oairu pthread m ${CONFIG_LIB} rt ${CMAKE_DL_LIBS} ${T_LIB}) + + # lte-uesoftmodem is UE implementation ####################################### @@ -2988,9 +3055,6 @@ add_executable(lte-uesoftmodem ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c ${OPENAIR_DIR}/executables/softmodem-common.c - ${OPENAIR_TARGETS}/RT/USER/lte-ru.c - ${OPENAIR_TARGETS}/RT/USER/ru_control.c - ${OPENAIR_TARGETS}/RT/USER/rfsim.c ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c @@ -3002,6 +3066,8 @@ add_executable(lte-uesoftmodem ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/lte/ue_power.c + ${OPENAIR_DIR}/common/utils/lte/prach_utils.c ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -3016,7 +3082,8 @@ endif() target_link_libraries (lte-uesoftmodem -Wl,--start-group RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP F1AP_LIB - GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON + + ${GTPV1U} SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} -Wl,--end-group z dl) @@ -3044,21 +3111,22 @@ add_executable(nr-softmodem ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_DIR}/common/utils/lte/ue_power.c + ${OPENAIR_DIR}/common/utils/lte/prach_utils.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c - ${GTPU_need_ITTI} ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} ${SHLIB_LOADER_SOURCES} + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c ) target_link_libraries (nr-softmodem -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} @@ -3088,7 +3156,6 @@ add_executable(ocp-gnb ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c - ${GTPU_need_ITTI} ${XFORMS_SOURCE_NR} ${T_SOURCE} ${CONFIG_SOURCES} @@ -3098,7 +3165,7 @@ add_executable(ocp-gnb target_link_libraries (ocp-gnb -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON @@ -3147,7 +3214,7 @@ target_link_libraries (nr-uesoftmodem NFAPI_USER_LIB MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} NFAPI_USER_LIB S1AP_LIB S1AP_ENB - ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB + ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB ${NAS_SIM_LIB} -Wl,--end-group z dl) target_link_libraries (nr-uesoftmodem ${LIBXML2_LIBRARIES}) @@ -3177,6 +3244,17 @@ target_link_libraries (dlsim_tm4 pthread m rt ${CONFIG_LIB} ${ATLAS_LIBRARIES} ${T_LIB} ) +add_executable(rftest + ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_test.c + ${OPENAIR_DIR}/openair1/PHY/TOOLS/calibration_scope.c + ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR_DIR}/executables/softmodem-common.c + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} +) +target_link_libraries(rftest minimal_lib PHY_NR_COMMON pthread dl m forms ${T_LIB} ) + add_executable(polartest ${OPENAIR1_DIR}/PHY/CODING/TESTBENCH/polartest.c ${OPENAIR_DIR}/common/utils/backtrace.c @@ -3323,7 +3401,7 @@ add_executable(nr_dlsim ) target_link_libraries(nr_dlsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl ) target_compile_definitions(nr_dlsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -3342,7 +3420,7 @@ add_executable(nr_prachsim ${SHLIB_LOADER_SOURCES}) target_link_libraries(nr_prachsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_RU PHY_NR_UE MAC_NR_COMMON SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl) + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl) add_executable(nr_ulschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c @@ -3375,7 +3453,7 @@ add_executable(nr_ulsim ) target_link_libraries(nr_ulsim -Wl,--start-group UTIL SIMU_COMMON SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_LTE_NR L2_NR HASHTABLE X2AP_ENB X2AP_LIB SECU_CN NGAP_GNB -Wl,--end-group - m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} dl + m pthread ${ATLAS_LIBRARIES} ${T_LIB} ${ITTI_LIB} ${OPENSSL_LIBRARIES} dl ) target_compile_definitions(nr_ulsim PUBLIC -DPHYSICAL_SIMULATOR) @@ -3387,6 +3465,9 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/utils.c + ${OPENAIR_DIR}/common/utils/lte/ue_power.c + ${OPENAIR_DIR}/common/utils/lte/prach_utils.c + ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c ${XFORMS_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -3409,7 +3490,7 @@ add_executable(test_epc_generate_scenario ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ) target_link_libraries (test_epc_generate_scenario - -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP ${GTPV1U} LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) add_executable(test_epc_play_scenario @@ -3428,7 +3509,7 @@ add_executable(test_epc_play_scenario ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario - -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP ${GTPV1U} LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) @@ -3474,7 +3555,7 @@ if (${T_TRACER}) NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB - CN_UTILS GTPV1U NR_GTPV1U SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB + CN_UTILS ${GTPV1U} SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts) if (TARGET ${i}) add_dependencies(${i} generate_T) @@ -3565,14 +3646,15 @@ add_executable(nr-ittisim ${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c ${OPENAIR2_DIR}/RRC/NAS/nas_config.c ${OPENAIR2_DIR}/RRC/NAS/rb_config.c - ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_gNB.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c - ${GTPU_need_ITTI} + ${OPENAIR_DIR}/common/utils/lte/ue_power.c + ${OPENAIR_DIR}/common/utils/lte/prach_utils.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api_to_fix.c ${XFORMSINTERFACE_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} @@ -3581,11 +3663,11 @@ add_executable(nr-ittisim target_link_libraries (nr-ittisim -Wl,--start-group - UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA + UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS ${GTPV1U} SECU_CN SECU_OSA ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_SIM_LIB} RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB ${PROTO_AGENT_LIB} ${FSPT_MSG_LIB} - PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE + PHY_NR_UE SCHED_NR_UE_LIB NR_L2_UE -Wl,--end-group z dl) target_link_libraries (nr-ittisim ${LIBXML2_LIBRARIES}) diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/README.txt b/cmake_targets/autotests/README.txt old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/core.py b/cmake_targets/autotests/core.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/log.py b/cmake_targets/autotests/log.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/openair.py b/cmake_targets/autotests/openair.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/templates/index.html b/cmake_targets/autotests/templates/index.html old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/templates/testcase_report.html b/cmake_targets/autotests/templates/testcase_report.html old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml old mode 100644 new mode 100755 index 016c76dc06..29257e482f --- a/cmake_targets/autotests/test_case_list.xml +++ b/cmake_targets/autotests/test_case_list.xml @@ -1099,8 +1099,9 @@ (Test14: 3 PTRS, 8 Interpolated Symbols), (Test15: 6 PTRS, 5 Interpolated Symbols), (Test16: 11 PTRS, 0 Interpolated Symbols), - (Test17: 2 DMRS Symbols), - (Test18: 3 DMRS Symbols) + (Test17: Mapping type A, 2 DMRS Symbols), + (Test18: Mapping type A, 3 DMRS Symbols), + (Test19: Mapping type B, 4 DMRS Symbols) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1124,8 +1125,9 @@ -n100 -s5 -T 2 1 2 -n100 -s5 -T 2 0 4 -n100 -s2 -U 2 0 1 - -n100 -s2 -U 2 0 2 - nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18 + -n100 -s2 -U 2 0 2 + -n100 -s2 -U 2 1 3 + nr_dlsim.test1 nr_dlsim.test2 nr_dlsim.test3 nr_dlsim.test4 nr_dlsim.test5 nr_dlsim.test6 nr_dlsim.test7 nr_dlsim.test8 nr_dlsim.test9 nr_dlsim.test10 nr_dlsim.test11 nr_dlsim.test12 nr_dlsim.test13 nr_dlsim.test14 nr_dlsim.test15 nr_dlsim.test16 nr_dlsim.test17 nr_dlsim.test18 nr_dlsim.test19 PDSCH test OK segmentation fault|assertion|exiting|fatal 3 @@ -1287,15 +1289,16 @@ (Test3: MCS 28 50 PRBs), (Test4: MCS 9 217 PRBs), (Test5: MCS 9 273 PRBs), - (Test6: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols), - (Test7: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols), - (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols), - (Test9: SC-FDMA, 50 PRBs), - (Test10: SC-FDMA, 75 PRBs), - (Test11: SC-FDMA, 216 PRBs), - (Test12: SC-FDMA, 273 PRBs), - (Test13: SC-FDMA, 3 DMRS), - (Test14: MCS 16 50 PRBs 2 RX_Antenna) + (Test6: DMRS Type A, 2 DMRS Symbols), + (Test7: DMRS Type A, 3 DMRS, 4 PTRS, 5 Interpolated Symbols), + (Test8: DMRS Type B, 3 DMRS, 2 PTRS, 7 Interpolated Symbols), + (Test9: DMRS Type B, 3 DMRS, 2 PTRS, 3 Interpolated Symbols), + (Test10: SC-FDMA, 50 PRBs), + (Test11: SC-FDMA, 75 PRBs), + (Test12: SC-FDMA, 216 PRBs), + (Test13: SC-FDMA, 273 PRBs), + (Test14: SC-FDMA, 3 DMRS), + (Test15: MCS 16 50 PRBs 2 RX_Antenna) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1307,6 +1310,7 @@ -n100 -m28 -s20 -n100 -m9 -R217 -r217 -s5 -n100 -m9 -R273 -r273 -s5 + -n100 -s5 -U 2 0 1 -n100 -s5 -T 2 1 2 -U 2 0 2 -n100 -s5 -T 2 2 2 -U 2 1 2 -n100 -s5 -a4 -b8 -T 2 1 2 -U 2 1 3 @@ -1317,7 +1321,7 @@ -n100 -s2 -Z -U 2 0 2 -n100 -m16 -s10 -z2 - nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14 + nr_ulsim.test1 nr_ulsim.test2 nr_ulsim.test3 nr_ulsim.test4 nr_ulsim.test5 nr_ulsim.test6 nr_ulsim.test7 nr_ulsim.test8 nr_ulsim.test9 nr_ulsim.test10 nr_ulsim.test11 nr_ulsim.test12 nr_ulsim.test13 nr_ulsim.test14 nr_ulsim.test15 PUSCH test OK segmentation fault|assertion|exiting|fatal 3 @@ -1330,7 +1334,8 @@ (Test3: 30kHz SCS, 273 PRBs, Prach format A2), (Test4: 30kHz SCS, 106 PRBs, Prach format 0), (Test5: 120kHz SCS, 32 PRBs, Prach format A2), - (Test6: 120kHz SCS, 66 PRBs, Prach format A2) + (Test6: 120kHz SCS, 66 PRBs, Prach format A2), + (Test7: 120kHz SCS, 66 PRBs, High Speed Enabled) $OPENAIR_DIR/cmake_targets/build_oai --phy_simulators -c @@ -1342,8 +1347,9 @@ -a -s -30 -n 100 -p 63 -R 273 -a -s -30 -n 100 -p 63 -R 106 -c 4 -a -s -30 -n 100 -p 32 -R 32 -m 3 -c52 - -a -s -30 -n 100 -p 32 -R 66 -m 3 -c52 - nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4 nr_prachsim.test5 nr_prachsim.test6 + -a -s -30 -n 100 -p 32 -R 66 -m 3 -c52 + -a -s -30 -n 100 -R 66 -m 3 -c52 -H + nr_prachsim.test1 nr_prachsim.test2 nr_prachsim.test3 nr_prachsim.test4 nr_prachsim.test5 nr_prachsim.test6 nr_prachsim.test7 PRACH test OK segmentation fault|assertion|exiting|fatal 3 diff --git a/cmake_targets/autotests/testsuite_ue_noS1.xml b/cmake_targets/autotests/testsuite_ue_noS1.xml old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/testsuite_ue_noS1_TCL.xml b/cmake_targets/autotests/testsuite_ue_noS1_TCL.xml old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/tools/lib_autotest.py b/cmake_targets/autotests/tools/lib_autotest.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/tools/lib_autotest_analyser.py b/cmake_targets/autotests/tools/lib_autotest_analyser.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/tools/wdial.bandrich.conf b/cmake_targets/autotests/tools/wdial.bandrich.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/3276.txt b/cmake_targets/autotests/v2/actions/3276.txt old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/alu_epc.bash b/cmake_targets/autotests/v2/actions/alu_epc.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/alu_epc_stop.bash b/cmake_targets/autotests/v2/actions/alu_epc_stop.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/alu_hss.bash b/cmake_targets/autotests/v2/actions/alu_hss.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/bandrich.txt b/cmake_targets/autotests/v2/actions/bandrich.txt old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/client_tcp.bash b/cmake_targets/autotests/v2/actions/client_tcp.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/client_udp.bash b/cmake_targets/autotests/v2/actions/client_udp.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/clone_repository.bash b/cmake_targets/autotests/v2/actions/clone_repository.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/compilation.bash b/cmake_targets/autotests/v2/actions/compilation.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/execution.bash b/cmake_targets/autotests/v2/actions/execution.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/execution_compile.bash b/cmake_targets/autotests/v2/actions/execution_compile.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/modem.py b/cmake_targets/autotests/v2/actions/modem.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/run_enb.bash b/cmake_targets/autotests/v2/actions/run_enb.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/server_tcp.bash b/cmake_targets/autotests/v2/actions/server_tcp.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/server_udp.bash b/cmake_targets/autotests/v2/actions/server_udp.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/start_3276.bash b/cmake_targets/autotests/v2/actions/start_3276.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/start_3276.py b/cmake_targets/autotests/v2/actions/start_3276.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/start_bandrich.bash b/cmake_targets/autotests/v2/actions/start_bandrich.bash old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/start_bandrich.py b/cmake_targets/autotests/v2/actions/start_bandrich.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/stop_3276.py b/cmake_targets/autotests/v2/actions/stop_3276.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/stop_bandrich.py b/cmake_targets/autotests/v2/actions/stop_bandrich.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/wvdial.3276.conf b/cmake_targets/autotests/v2/actions/wvdial.3276.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/actions/wvdial.bandrich.conf b/cmake_targets/autotests/v2/actions/wvdial.bandrich.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/alu_test.py b/cmake_targets/autotests/v2/alu_test.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.10MHz.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.20MHz.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band38.tm1.usrpb210.tdd.5MHz.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.10MHz.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.20MHz.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf b/cmake_targets/autotests/v2/config/enb.band7.tm1.usrpb210.fdd.5MHz.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.10MHz.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.20MHz.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf b/cmake_targets/autotests/v2/config/rcc.band7.tm1.if4p5.5MHz.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.10MHz.udp.usrpb210.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.20MHz.udp.usrpb210.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf b/cmake_targets/autotests/v2/config/rru.band7.tm1.if4p5.5MHz.udp.usrpb210.conf old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/connection.py b/cmake_targets/autotests/v2/connection.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/machine_list.py b/cmake_targets/autotests/v2/machine_list.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/main.py b/cmake_targets/autotests/v2/main.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/task.py b/cmake_targets/autotests/v2/task.py old mode 100644 new mode 100755 diff --git a/cmake_targets/autotests/v2/utils.py b/cmake_targets/autotests/v2/utils.py old mode 100644 new mode 100755 diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index dba6d7da6d..279b9489e0 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -68,7 +68,9 @@ USRP_REC_PLAY="False" BUILD_ECLIPSE=0 NR="False" ITTI_SIM="False" +SANITIZE_ADDRESS="False" OPTIONAL_LIBRARIES="telnetsrv enbscope uescope nrscope msc" +RU=0 trap handle_ctrl_c INT function print_help() { @@ -103,6 +105,8 @@ Options Makes the NR softmodem --nrUE Makes the NR UE softmodem +--RU + Makes the OAI RRU (without full stack) --UE Makes the UE specific parts (ue_ip, usim, nvram) from the given configuration file --UE-conf-nvram [configuration file] @@ -240,25 +244,34 @@ function main() { shift;; --eNB) eNB=1 + RU=0 echo_info "Will compile eNB" shift;; --eNBocp) eNBocp=1 + RU=0 echo_info "Will compile OCP eNB" shift;; --gNB) gNB=1 + RU=0 NR="True" echo_info "Will compile gNB" shift;; + --RU) + RU=1 + echo_info "Will compile RRU" + shift;; -a | --agent) echo_info "FlexRAN support is always compiled into the eNB" shift;; --UE) + RU=0 UE=1 echo_info "Will compile UE" shift;; --nrUE) + RU=0 nrUE=1 NR="True" echo_info "Will compile NR UE" @@ -295,6 +308,7 @@ function main() { shift 2;; -P | --phy_simulators) SIMUS_PHY=1 + RU=0 echo_info "Will compile dlsim, ulsim, ..." shift;; -S | --core_simulators) @@ -424,6 +438,9 @@ function main() { CMAKE_CMD="$CMAKE_CMD -GNinja" MAKE_CMD=ninja shift;; + --sanitize-address | -fsanitize=address) + SANITIZE_ADDRESS=True + shift;; --ittiSIM) ittiSIM=1 ITTI_SIM="True" @@ -460,7 +477,7 @@ function main() { ######################################################## # to be discussed - if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" ] ; then + if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$gNB" = "1" -o "$RU" = "1" ] ; then if [ "$HW" = "None" -a "$TP" = "None" ] ; then echo_info "No local radio head and no transport protocol selected" fi @@ -587,7 +604,7 @@ function main() { config_libconfig_shlib=params_libconfig # first generate the CMakefile in the right directory - if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" ] ; then + if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" -o "$HW" = "EXMIMO" -o "$ittiSIM" = "1" ] ; then # softmodem compilation @@ -611,7 +628,9 @@ function main() { echo "set ( UE_TIMING_TRACE $UE_TIMING_TRACE )" >> $cmake_file echo "set ( USRP_REC_PLAY $USRP_REC_PLAY )" >> $cmake_file echo "set ( SKIP_SHARED_LIB_FLAG $SKIP_SHARED_LIB_FLAG )" >> $cmake_file + echo "set ( RU $RU )" >> $cmake_file echo "set ( ITTI_SIM $ITTI_SIM )" >> $cmake_file + echo "set ( SANITIZE_ADDRESS $SANITIZE_ADDRESS )" >> $cmake_file echo 'include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt)' >> $cmake_file cd $DIR/$build_dir/build eval $CMAKE_CMD @@ -626,6 +645,9 @@ function main() { if [ "$gNB" = "1" ] ; then execlist="$execlist nr-softmodem" fi + if [ "$RU" = "1" ] ; then + execlist="$execlist oairu" + fi if [ "$UE" = 1 ] ; then execlist="$execlist lte-uesoftmodem" fi @@ -654,28 +676,29 @@ function main() { $build_dir $config_libconfig_shlib \ lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so - compilations \ - $build_dir coding \ - libcoding.so $dbin/libcoding.so - - - #check if we run inside a container or not - #IS_CONTAINER variable is defined in build_helper file - #compile nasmesh and rb_tool only if NOT running in a container - if [ $IS_CONTAINER -eq 0 ] - then - compilations \ - $build_dir nasmesh \ - CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko + if [ "$RU" = "0" ] ; then compilations \ - $build_dir rb_tool \ - rb_tool $dbin/rb_tool + $build_dir coding \ + libcoding.so $dbin/libcoding.so - cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin - fi #IS_CONTAINER + #check if we run inside a container or not + #IS_CONTAINER variable is defined in build_helper file + #compile nasmesh and rb_tool only if NOT running in a container + if [ $IS_CONTAINER -eq 0 ] + then + compilations \ + $build_dir nasmesh \ + CMakeFiles/nasmesh/nasmesh.ko $dbin/nasmesh.ko + + compilations \ + $build_dir rb_tool \ + rb_tool $dbin/rb_tool + + cp $OPENAIR_DIR/cmake_targets/tools/init_nas_nos1 $dbin + fi #IS_CONTAINER + fi fi - fi if [ "$UE" = 1 ] ; then @@ -857,7 +880,7 @@ function main() { #################################################### # Build RF device and transport protocol libraries # #################################################### - if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then + if [ "$eNB" = "1" -o "$eNBocp" = "1" -o "$UE" = "1" -o "$gNB" = "1" -o "$RU" = "1" -o "$nrUE" = "1" -o "$HWLAT" = "1" ] ; then # build RF device libraries if [ "$HW" != "None" ] ; then diff --git a/cmake_targets/doxygen/CMakeLists.txt b/cmake_targets/doxygen/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/cmake_targets/epc_test/CMakeLists.template b/cmake_targets/epc_test/CMakeLists.template old mode 100644 new mode 100755 diff --git a/cmake_targets/install_external_packages.ubuntu20 b/cmake_targets/install_external_packages.ubuntu20 index 9ef79be9c2..4b1cda42f8 100755 --- a/cmake_targets/install_external_packages.ubuntu20 +++ b/cmake_targets/install_external_packages.ubuntu20 @@ -83,6 +83,8 @@ get_distribution_release() { check_supported_distribution() { case $(get_distribution_release) in "ubuntu20.04") return 0 ;; + "ubuntu20.10") return 0 ;; + "ubuntu21.04") return 0 ;; esac return 1 } @@ -157,8 +159,16 @@ install_protobuf_from_source(){ #cd protobuf-2.6.1/ rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz - tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner - cd protobuf-3.3.0/ || exit + tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner + cd protobuf-3.3.0/ + else + export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs + rm -rf /tmp/protobuf + git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf + cd /tmp/protobuf + git submodule update --init --recursive + ./autogen.sh + fi ./configure echo "Compiling protobuf" make -j"$(nproc)" @@ -198,15 +208,15 @@ install_usrp_uhd_driver_from_source(){ rm -rf /tmp/uhd git clone https://github.com/EttusResearch/uhd.git cd uhd || exit - git checkout tags/v3.13.0.2 + git checkout UHD-3.15.LTS mkdir -p host/build cd host/build || exit - $CMAKE ../ + $CMAKE ../ -GNinja echo "Compiling UHD" - make -j"$(nproc)" - make test - $SUDO make install + ninja + $SUDO ninja install $SUDO ldconfig + $SUDO /usr/lib/uhd/utils/uhd_images_downloader.py ) >& "$uhd_install_log" } @@ -329,6 +339,7 @@ check_install_ubuntu_packages() { $SUDO apt install -y software-properties-common case "$(get_distribution_release)" in "ubuntu20.04") + "ubuntu21.04") specific_packages="libtasn1-6-dev libgnutls28-dev iproute2 libconfig-dev" LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" @@ -345,7 +356,6 @@ check_install_ubuntu_packages() { openvpn \ pkg-config \ python3-dev \ - python-pexpect \ sshfs \ swig \ tshark \ @@ -358,7 +368,6 @@ check_install_ubuntu_packages() { iperf3 \ android-tools-adb \ wvdial \ - python-numpy \ sshpass \ nscd \ bc \ @@ -379,7 +388,6 @@ check_install_ubuntu_packages() { git \ graphviz \ gtkwave \ - guile-2.0-dev \ iperf \ iptables \ libxtables-dev \ @@ -419,7 +427,8 @@ check_install_ubuntu_packages() { libxpm-dev \ libboost-all-dev \ nettle-dev \ - nettle-bin + nettle-bin \ + libreadline-dev fi $SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET" diff --git a/cmake_targets/nas_sim_tools/CMakeLists.txt b/cmake_targets/nas_sim_tools/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/cmake_targets/phy_simulators/CMakeLists.txt b/cmake_targets/phy_simulators/CMakeLists.txt old mode 100644 new mode 100755 index 447e90bcab..f8c659959f --- a/cmake_targets/phy_simulators/CMakeLists.txt +++ b/cmake_targets/phy_simulators/CMakeLists.txt @@ -17,4 +17,5 @@ set ( UE_TIMING_TRACE False ) set ( USRP_REC_PLAY False ) set ( SKIP_SHARED_LIB_FLAG False ) set ( PHYSIM True) +set ( RU 0) include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakeLists.txt) diff --git a/cmake_targets/s1c_mme_test/CMakeLists.template b/cmake_targets/s1c_mme_test/CMakeLists.template old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/Kbuild.cmake b/cmake_targets/tools/Kbuild.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/CMakeParseArguments.cmake b/cmake_targets/tools/MODULES/CMakeParseArguments.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/CMakeUserFindMySQL.cmake b/cmake_targets/tools/MODULES/CMakeUserFindMySQL.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/CMakeUserUseBison.cmake b/cmake_targets/tools/MODULES/CMakeUserUseBison.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/CMakeUserUseFlex.cmake b/cmake_targets/tools/MODULES/CMakeUserUseFlex.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindFreeDiameter.cmake b/cmake_targets/tools/MODULES/FindFreeDiameter.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindGCCXML.cmake b/cmake_targets/tools/MODULES/FindGCCXML.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindGcrypt.cmake b/cmake_targets/tools/MODULES/FindGcrypt.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindGnuTLS.cmake b/cmake_targets/tools/MODULES/FindGnuTLS.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindKbuild.cmake b/cmake_targets/tools/MODULES/FindKbuild.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindLibXml2.cmake b/cmake_targets/tools/MODULES/FindLibXml2.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindMySQL.cmake b/cmake_targets/tools/MODULES/FindMySQL.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindNettle.cmake b/cmake_targets/tools/MODULES/FindNettle.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindPostgreSQL.cmake b/cmake_targets/tools/MODULES/FindPostgreSQL.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/FindSCTP.cmake b/cmake_targets/tools/MODULES/FindSCTP.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/Kbuild.cmake b/cmake_targets/tools/MODULES/Kbuild.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/cmake_useful.cmake b/cmake_targets/tools/MODULES/cmake_useful.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/kbuild_system.cmake b/cmake_targets/tools/MODULES/kbuild_system.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/kmodule.cmake b/cmake_targets/tools/MODULES/kmodule.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/MODULES/path_prefixes.cmake b/cmake_targets/tools/MODULES/path_prefixes.cmake old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/asn1tostruct.py b/cmake_targets/tools/asn1tostruct.py old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 9b8363fc2b..30fdb7eb1e 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -113,6 +113,7 @@ check_supported_distribution() { "rhel7.6") return 0 ;; "rhel7.7") return 0 ;; "rhel7.8") return 0 ;; + "rhel7.9") return 0 ;; "rhel8.2") return 0 ;; "rhel8.3") return 0 ;; "rhel8.4") return 0 ;; diff --git a/cmake_targets/tools/example_enb_exmimo_mme_hss.txt b/cmake_targets/tools/example_enb_exmimo_mme_hss.txt old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt b/cmake_targets/tools/example_oaisim_enb_ue_mme_virtual.txt old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/exmimo2_2arxg.lime b/cmake_targets/tools/exmimo2_2arxg.lime old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/exmimo2_2brxg.lime b/cmake_targets/tools/exmimo2_2brxg.lime old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/exmimo_stop_octave.m b/cmake_targets/tools/exmimo_stop_octave.m old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff b/cmake_targets/tools/fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff b/cmake_targets/tools/fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff old mode 100644 new mode 100755 diff --git a/cmake_targets/tools/make_asn1c_includes.sh b/cmake_targets/tools/make_asn1c_includes.sh index 1598678a73..00c88d6497 100755 --- a/cmake_targets/tools/make_asn1c_includes.sh +++ b/cmake_targets/tools/make_asn1c_includes.sh @@ -1,13 +1,19 @@ #!/bin/bash -GENERATED_FULL_DIR=$1 -shift -ASN1_SOURCE_DIR=$1 -shift export ASN1C_PREFIX=$1 shift -options=$* +options=$1 +shift +GENERATED_FULL_DIR=$1 +shift +ASN1_SOURCE_DIR=$* done_flag="$GENERATED_FULL_DIR"/done -if [ "$done_flag" -ot $ASN1_SOURCE_DIR ] ; then +rebuild=0 +for f in $ASN1_SOURCE_DIR ; do + if [ "$done_flag" -ot "$f" ] ; then + rebuild=1 + fi +done +if [ $rebuild -eq 1 ] ; then rm -f "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.c "$GENERATED_FULL_DIR"/${ASN1C_PREFIX}*.h mkdir -p "$GENERATED_FULL_DIR" asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example $options -D $GENERATED_FULL_DIR $ASN1_SOURCE_DIR |& egrep -v "^Copied|^Compiled" | sort -u diff --git a/cmake_targets/tools/run_enb_s1_usrp b/cmake_targets/tools/run_enb_s1_usrp index e119126683..1a4c6b10b8 100755 --- a/cmake_targets/tools/run_enb_s1_usrp +++ b/cmake_targets/tools/run_enb_s1_usrp @@ -101,7 +101,6 @@ function main() local -i run_gdb=0 local -i show_stdout=0 local exe_arguments="" - local itti_dump_file="" until [ -z "$1" ] do @@ -154,18 +153,6 @@ function main() exe_arguments="$exe_arguments --rf-config-file=$rf_config_file" fi ;; - -K | --itti-dump-file) - itti_dump_file=$2 - # can omit file name if last arg on the line - if [ "x$itti_dump_file" = "x" ]; then - itti_dump_file="/tmp/enb_s1_usrp_itti.log" - shift 1; - else - shift 2; - fi - echo "setting ITTI dump file to: $itti_dump_file" - exe_arguments="$exe_arguments -K $itti_dump_file" - ;; -m | --mscgen) g_msc_dir=$2 # can omit file name if last arg on the line diff --git a/cmake_targets/tools/test_helper b/cmake_targets/tools/test_helper old mode 100644 new mode 100755 diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index 6d01d98c65..1df1bc16f7 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -255,7 +255,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */ ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) || /* long option beginning with "--" */ ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgoptions[n].optname) == 0) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) || - ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) { + ((strlen(oneargv) > 2) && (strcmp(oneargv + 2, cfgoptions[n].optname) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) { char *valptr=NULL; int ret; config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED; diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h index 8baaa99bb8..0688f6531f 100644 --- a/common/config/config_load_configmodule.h +++ b/common/config/config_load_configmodule.h @@ -82,10 +82,12 @@ typedef struct configmodule_interface { #ifdef CONFIG_LOADCONFIG_MAIN configmodule_interface_t *cfgptr=NULL; -static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]> \n \ - debugflags can also be defined in the config_libconfig section of the config file\n \ +static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \ + debugflags can also be defined in the config section of the config file\n \ debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \ - 4->print command line processing debug messages\n "; + 4->print command line processing debug messages\n \ + incp parameter can be used to define the include path used for config files (@include directive)\n \ + defaults is set to the path of the main config file.\n"; #define CONFIG_SECTIONNAME "config" #define CONFIGPARAM_DEBUGFLAGS_IDX 0 diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index eb08a70183..17266246f0 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -33,8 +33,9 @@ #include #include +#include + #include -#include #include "config_libconfig.h" #include "config_libconfig_private.h" @@ -347,17 +348,35 @@ int config_libconfig_init(char *cfgP[], int numP) { config_get_if()->numptrs=0; memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS); memset(config_get_if()->ptrsAllocated, 0, sizeof(config_get_if()->ptrsAllocated)); - + /* search for include path parameter and set config file include path accordingly */ + for (int i=0; i + + +#include "PHY/LTE_TRANSPORT/transport_common.h" + +// This is table 5.7.1-4 from 36.211 +PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = { + // TDD Configuration Index 0 + { {1,{{0,1,0,2}}},{1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {1,{{0,1,0,2}}}}, + // TDD Configuration Index 1 + { {1,{{0,2,0,2}}},{1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {1,{{0,2,0,2}}}}, + // TDD Configuration Index 2 + { {1,{{0,1,1,2}}},{1,{{0,1,1,1}}}, {1,{{0,1,1,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,1}}}}, + // TDD Configuration Index 3 + { {1,{{0,0,0,2}}},{1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {1,{{0,0,0,2}}}}, + // TDD Configuration Index 4 + { {1,{{0,0,1,2}}},{1,{{0,0,1,1}}}, {1,{{0,0,1,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,1}}}}, + // TDD Configuration Index 5 + { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}}, + // TDD Configuration Index 6 + { {2,{{0,0,0,2},{0,0,1,2}}}, {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {2,{{0,0,0,1},{0,0,0,2}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {2,{{0,0,0,2},{0,0,1,1}}}}, + // TDD Configuration Index 7 + { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,2}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}}, + // TDD Configuration Index 8 + { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,0,1}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{0,0,1,1}}}}, + // TDD Configuration Index 9 + { {3,{{0,0,0,1},{0,0,0,2},{0,0,1,2}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,0,2}}}, {3,{{0,0,0,0},{0,0,0,1},{1,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {3,{{0,0,0,1},{0,0,0,2},{0,0,1,1}}}}, + // TDD Configuration Index 10 + { {3,{{0,0,0,0},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{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}}}, {3,{{0,0,0,0},{0,0,0,2},{0,0,1,0}}}}, + // TDD Configuration Index 11 + { {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,0},{0,0,0,1},{0,0,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,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,0}}}, {3,{{0,0,0,1},{0,0,1,0},{0,0,1,1}}}}, + // TDD Configuration Index 12 + { {4,{{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {4,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1}}}, + {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, + {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,2}}}, + {4,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}, + {4,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}} + }, + // TDD Configuration Index 13 + { {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {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},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,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},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1}}} + }, + // TDD Configuration Index 14 + { {4,{{0,0,0,0},{0,0,0,1},{0,0,1,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},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{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,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,0},{0,0,0,2},{0,0,1,0},{0,0,1,1}}} + }, + // TDD Configuration Index 15 + { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1}}}, + {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,1},{1,0,0,2}}}, + {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,1}}}, {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, + {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1}}} + }, + // TDD Configuration Index 16 + { {5,{{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,1,1}}}, + {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,1,0}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,2}}}, + {5,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,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,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}} + }, + // TDD Configuration Index 17 + { {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,2}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,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}}}, {5,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,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},{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,0,0,0},{0,0,0,0},{0,0,0,0}}} + }, + // TDD Configuration Index 18 + { {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{0,0,1,2}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, + {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,1,0}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{1,0,0,0},{1,0,0,1},{1,0,0,2}}}, + {6,{{0,0,0,0},{0,0,0,1},{1,0,0,0},{1,0,0,1},{2,0,0,0},{2,0,0,1}}}, + {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,0,0,0}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,0,2}}} + }, + // TDD Configuration Index 19 + { {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}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{1,0,0,0},{1,0,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}}}, + {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,{{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,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {6,{{0,0,0,0},{0,0,0,1},{0,0,0,2},{0,0,1,0},{0,0,1,1},{1,0,1,1}}} + }, + // TDD Configuration Index 20 + { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}}, + // TDD Configuration Index 21 + { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}}, + + // TDD Configuration Index 22 + { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}}, + + // TDD Configuration Index 23 + { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}}, + + // TDD Configuration Index 24 + { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}}, + + // TDD Configuration Index 25 + { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}}, + + // TDD Configuration Index 26 + { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}}, + + // TDD Configuration Index 27 + { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}} + }, + + // TDD Configuration Index 28 + { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}}, + {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}} + }, + + // TDD Configuration Index 29 + { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}}, + {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,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}}}, + {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}}, + {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,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,0,0}}}, + {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}} + }, + + + // TDD Configuration Index 30 + { {1,{{0,1,0,1}}},{1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,1}}}}, + + // TDD Configuration Index 31 + { {1,{{0,2,0,1}}},{1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,1}}}}, + + // TDD Configuration Index 32 + { {1,{{0,1,1,1}}},{1,{{0,1,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,1,0}}}}, + + // TDD Configuration Index 33 + { {1,{{0,0,0,1}}},{1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,1}}}}, + + // TDD Configuration Index 34 + { {1,{{0,0,1,1}}},{1,{{0,0,1,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,1,0}}}}, + + // TDD Configuration Index 35 + { {2,{{0,0,0,1},{0,0,1,1}}}, {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{1,0,0,1}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,1},{0,0,1,0}}}}, + + // TDD Configuration Index 36 + { {3,{{0,0,0,1},{0,0,1,1},{1,0,0,1}}}, {3,{{0,0,0,0},{0,0,1,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{1,0,0,1},{2,0,0,1}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {3,{{0,0,0,1},{0,0,1,0},{1,0,0,1}}}}, + + // TDD Configuration Index 37 + { {4,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1}}}, {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0}}} + }, + + // TDD Configuration Index 38 + { {5,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1}}}, {5,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0}}}, + {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, {5,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1}}}, + {5,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {5,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1}}} + }, + + // TDD Configuration Index 39 + { {6,{{0,0,0,1},{0,0,1,1},{1,0,0,1},{1,0,1,1},{2,0,0,1},{2,0,1,1}}}, + {6,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,1,0},{2,0,0,0},{2,0,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}}}, + {6,{{0,0,0,1},{1,0,0,1},{2,0,0,1},{3,0,0,1},{4,0,0,1},{5,0,0,1}}}, + {6,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0},{4,0,0,0},{5,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,0,0}}}, + {6,{{0,0,0,1},{0,0,1,0},{1,0,0,1},{1,0,1,0},{2,0,0,1},{2,0,1,0}}} + }, + + // TDD Configuration Index 40 + { {1,{{0,1,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,1,0,0}}}}, + // TDD Configuration Index 41 + { {1,{{0,2,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,2,0,0}}}}, + + // TDD Configuration Index 42 + { {1,{{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}}}, {0,{{0,0,0,0}}}}, + + // TDD Configuration Index 43 + { {1,{{0,0,0,0}}},{0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {0,{{0,0,0,0}}}, {1,{{0,0,0,0}}}}, + + // TDD Configuration Index 44 + { {1,{{0,0,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}}}, {0,{{0,0,0,0}}}}, + + // TDD Configuration Index 45 + { {2,{{0,0,0,0},{0,0,1,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {0,{{0,0,0,0},{0,0,0,0}}}, {2,{{0,0,0,0},{1,0,0,0}}}}, + + // TDD Configuration Index 46 + { {3,{{0,0,0,0},{0,0,1,0},{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,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,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,0,0,0}}}, {3,{{0,0,0,0},{1,0,0,0},{2,0,0,0}}}}, + + // TDD Configuration Index 47 + { {4,{{0,0,0,0},{0,0,1,0},{1,0,0,0},{1,0,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,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,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,0,0,0},{0,0,0,0},{0,0,0,0}}}, + {4,{{0,0,0,0},{1,0,0,0},{2,0,0,0},{3,0,0,0}}} + } +}; + + +uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type) { + if (frame_type == FDD) // FDD + return(prach_ConfigIndex>>4); + else { + if (prach_ConfigIndex < 20) + return (0); + + if (prach_ConfigIndex < 30) + return (1); + + if (prach_ConfigIndex < 40) + return (2); + + if (prach_ConfigIndex < 48) + return (3); + else + return (4); + } +} + +uint8_t get_prach_prb_offset(int frame_type, + int tdd_config, + int N_RB_UL, + uint8_t prach_ConfigIndex, + uint8_t n_ra_prboffset, + uint8_t tdd_mapindex, uint16_t Nf) { + uint8_t n_ra_prb; + uint8_t f_ra,t1_ra; + uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); + uint8_t Nsp=2; + + if (frame_type == TDD) { // TDD + if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) { + LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex); + return(-1); + } + + // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211) + f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra; + + if (prach_fmt < 4) { + if ((f_ra&1) == 0) { + n_ra_prb = n_ra_prboffset + 6*(f_ra>>1); + } else { + n_ra_prb = N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1); + } + } else { + if ((tdd_config >2) && (tdd_config<6)) + Nsp = 2; + + t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; + + if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) { + n_ra_prb = 6*f_ra; + } else { + n_ra_prb = N_RB_UL - 6*(f_ra+1); + } + } + } else { //FDD + n_ra_prb = n_ra_prboffset; + } + + return(n_ra_prb); +} + +int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) { + uint8_t t0_ra; + uint8_t t1_ra; + uint8_t t2_ra; + int prach_mask = 0; + + if (frame_type == FDD) { //FDD + //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41) + if ((((frame&1) == 1) && (subframe < 9)) || + (((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames + if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50 + ((prach_ConfigIndex&0x1f)==18) || // 18,50 + ((prach_ConfigIndex&0xf)==15)) // 15,47 + return(0); + + switch (prach_ConfigIndex&0x1f) { + case 0: + case 3: + if (subframe==1) prach_mask = 1; + + break; + + case 1: + case 4: + if (subframe==4) prach_mask = 1; + + break; + + case 2: + case 5: + if (subframe==7) prach_mask = 1; + + break; + + case 6: + if ((subframe==1) || (subframe==6)) prach_mask=1; + + break; + + case 7: + if ((subframe==2) || (subframe==7)) prach_mask=1; + + break; + + case 8: + if ((subframe==3) || (subframe==8)) prach_mask=1; + + break; + + case 9: + if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1; + + break; + + case 10: + if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1; + + break; + + case 11: + if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1; + + break; + + case 12: + if ((subframe&1)==0) prach_mask=1; + + break; + + case 13: + if ((subframe&1)==1) prach_mask=1; + + break; + + case 14: + prach_mask=1; + break; + + case 15: + if (subframe==9) prach_mask=1; + + break; + } + } else { // TDD + AssertFatal(prach_ConfigIndex<64, + "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex); + AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0, + "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex); + t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra; + t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; + t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra; +#ifdef PRACH_DEBUG + LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n", + prach_ConfigIndex, + subframe, + t0_ra,t1_ra,t2_ra); +#endif + + if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames + ((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames + (t0_ra == 0)) && // PRACH is in all frames + (((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame + (((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame + if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe + (((subframe%5)-2)==t2_ra)) prach_mask=1; + else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS + } + } + + return(prach_mask); +} + diff --git a/common/utils/lte/prach_utils.h b/common/utils/lte/prach_utils.h new file mode 100644 index 0000000000..995805fbd2 --- /dev/null +++ b/common/utils/lte/prach_utils.h @@ -0,0 +1,40 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file common/utils/prach_utils.h +* \brief computation of some PRACH variables used in both MAC and PHY +* \author R. Knopp +* \date 2020 +* \version 0.1 +* \company Eurecom +* \email: raymond.knopp@eurecom.fr, florian.kaltenberger@eurecom.fr, oscar.tonelli@yahoo.it +* \note +* \warning +*/ +uint8_t get_prach_fmt(int prach_ConfigIndex,int frame_type); + +uint8_t get_prach_prb_offset(int frame_type, + int tdd_config, + int N_RB_UL, + uint8_t prach_ConfigIndex, + uint8_t n_ra_prboffset, + uint8_t tdd_mapindex, uint16_t Nf); +int is_prach_subframe0(int tdd_config,int frame_type,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe); diff --git a/common/utils/lte/ue_power.c b/common/utils/lte/ue_power.c new file mode 100644 index 0000000000..b377abf2ff --- /dev/null +++ b/common/utils/lte/ue_power.c @@ -0,0 +1,108 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file ue_power.c +* \brief Routines to compute UE TX power according to 36.213 +* \author R. Knopp, F. Kaltenberger +* \date 2020 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr +* \note +* \warning +*/ + +#include +#include +#include "PHY/defs_eNB.h" +#include "PHY/TOOLS/dB_routines.h" + +extern int16_t hundred_times_delta_TF[100]; +extern uint16_t hundred_times_log10_NPRB[100]; + +int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, int ncp, uint8_t use_srs) +{ + + /// The payload + CRC size in bits, "B" + uint32_t B; + /// Number of code segments + uint32_t C; + /// Number of "small" code segments + uint32_t Cminus; + /// Number of "large" code segments + uint32_t Cplus; + /// Number of bits in "small" code segments (<6144) + uint32_t Kminus; + /// Number of bits in "large" code segments (<6144) + uint32_t Kplus; + /// Total number of bits across all segments + uint32_t sumKr; + /// Number of "Filler" bits + uint32_t F; + // num resource elements + uint32_t num_re=0.0; + // num symbols + uint32_t num_symb=0.0; + /// effective spectral efficiency of the PUSCH + uint32_t MPR_x100=0; + /// beta_offset + uint16_t beta_offset_pusch_x8=8; + /// delta mcs + float delta_mcs=0.0; + /// bandwidth factor + float bw_factor=0.0; + + B= tbs+24; + lte_segmentation(NULL, + NULL, + B, + &C, + &Cplus, + &Cminus, + &Kplus, + &Kminus, + &F); + + + sumKr = Cminus*Kminus + Cplus*Kplus; + num_symb = 12-(ncp<<1)-(use_srs==0?0:1); + num_re = num_symb * nb_rb * 12; + + if (num_re == 0) + return(0); + + MPR_x100 = 100*sumKr/num_re; + + if (control_only == 1 ) + beta_offset_pusch_x8=8; // fixme + + //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8; + + // if deltamcs_enabledm + delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_times10((beta_offset_pusch_x8)>>3))/100.0); + + bw_factor = (norm!=0) ? 0 : (hundred_times_log10_NPRB[nb_rb-1]/100.0); + LOG_D(PHY,"estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n", + (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor); + return (int16_t)ceil(delta_mcs + bw_factor); + +} + diff --git a/targets/RT/USER/rfsim.h b/common/utils/lte/ue_power.h similarity index 69% rename from targets/RT/USER/rfsim.h rename to common/utils/lte/ue_power.h index 801ab5eb56..caeebec2c8 100644 --- a/targets/RT/USER/rfsim.h +++ b/common/utils/lte/ue_power.h @@ -18,23 +18,17 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ -#ifndef __RFSIM__H__ -#define __RFSIM__H__ -#include "lte-softmodem.h" -#include "openair1/SIMULATION/TOOLS/sim.h" -#include "platform_constants.h" -#include "common/ran_context.h" -#include "PHY/defs_UE.h" -#include "PHY/defs_eNB.h" -void init_ocm(void); +/*! \file ue_power.h +* \brief support routines used in MAC and PHY +* \author R. Knopp, F. Kaltenberger +* \date 2020 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr +* \note +* \warning +*/ -void update_ocm(double snr_dB,double sinr_dB); +int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs); -//extern pthread_mutex_t async_server_lock; -//extern pthread_cond_t async_server_notify; -//extern int async_server_shutdown; - -void init_channel_vars(void); - -#endif diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c index 7cc5f79f90..84b723b022 100644 --- a/common/utils/msc/msc.c +++ b/common/utils/msc/msc.c @@ -52,6 +52,7 @@ FILE *g_msc_fd; char g_msc_proto2str[MAX_MSC_PROTOS][MSC_MAX_PROTO_NAME_LENGTH]; +msc_interface_t msc_interface; typedef unsigned long msc_message_number_t; typedef struct msc_queue_item_s { diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h index aab872cfe1..adb0d9e657 100644 --- a/common/utils/msc/msc.h +++ b/common/utils/msc/msc.h @@ -117,7 +117,7 @@ void msc_log_message( #define MESSAGE_CHART_GENERATOR msc_interface.msc_loaded -msc_interface_t msc_interface; +extern msc_interface_t msc_interface; #define MSC_INIT(arg1,arg2) if(msc_interface.msc_loaded) msc_interface.msc_init(arg1,arg2) #define MSC_START_USE if(msc_interface.msc_loaded) msc_interface.msc_start_use #define MSC_END if(msc_interface.msc_loaded) msc_interface.msc_end diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 2189be9fe8..c774da57e6 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -339,7 +339,9 @@ extern "C" { int itti_create_queue(const task_info_t *taskInfo) { pthread_mutex_lock (&lock_nb_queues); int newQueue=nb_queues++; - AssertFatal(tasks=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks)),""); + task_list_t **new_tasks = (task_list_t **)realloc(tasks, nb_queues * sizeof(*tasks)); + AssertFatal(new_tasks != NULL, "could not realloc() tasks list"); + tasks = new_tasks; tasks[newQueue]= new task_list_t; pthread_mutex_unlock (&lock_nb_queues); LOG_I(TMR,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue); diff --git a/common/utils/ocp_itti/intertask_interface.h b/common/utils/ocp_itti/intertask_interface.h index 18a8f7868c..944ca12b01 100644 --- a/common/utils/ocp_itti/intertask_interface.h +++ b/common/utils/ocp_itti/intertask_interface.h @@ -340,6 +340,7 @@ void *rrc_enb_process_msg(void *); TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200, NULL, NULL)\ TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\ + TASK_DEF(OCP_GTPV1_U, TASK_PRIORITY_MED, 1000,NULL, NULL)\ TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000, NULL, NULL)\ TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \ TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200, NULL, NULL) \ @@ -471,6 +472,9 @@ void itti_subscribe_event_fd(task_id_t task_id, int fd); void itti_unsubscribe_event_fd(task_id_t task_id, int fd); /** \brief Return the list of events excluding the fd associated with itti + \the fd associated with itti can return, but it is marked events[i].events &= ~EPOLLIN + \as it is not EPOLLIN, the reader should ignore this fd + \or it can manage the list of fd's in his interest, so ignore the other ones \param task_id Task ID of the task \param events events list @returns number of events to handle diff --git a/common/utils/system.c b/common/utils/system.c index 1bd5c7d39b..4c6c1a4dc0 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -199,15 +199,32 @@ void start_background_system(void) { void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){ pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedpolicy(&attr, SCHED_FIFO); + int ret; + ret=pthread_attr_init(&attr); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + if(prioritysched_get_priority_max(SCHED_FIFO)) { + LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n", + priority, + sched_get_priority_min(SCHED_OAI), + sched_get_priority_max(SCHED_OAI)); + if(prioritysched_get_priority_max(SCHED_OAI)) + priority=sched_get_priority_max(SCHED_OAI); + } + AssertFatal(priority<=sched_get_priority_max(SCHED_OAI),""); struct sched_param sparam={0}; sparam.sched_priority = priority; - pthread_attr_setschedparam(&attr, &sparam); - - pthread_create(t, &attr, func, param); + ret=pthread_attr_setschedparam(&attr, &sparam); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + ret=pthread_create(t, &attr, func, param); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); pthread_setname_np(*t, name); if (affinity != -1 ) { @@ -216,7 +233,6 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, CPU_SET(affinity, &cpuset); AssertFatal( pthread_setaffinity_np(*t, sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity"); } - pthread_attr_destroy(&attr); } diff --git a/common/utils/system.h b/common/utils/system.h index a89a6c5b17..fbfd338a1a 100644 --- a/common/utils/system.h +++ b/common/utils/system.h @@ -46,9 +46,11 @@ void set_latency_target(void); void configure_linux(void); void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority); -#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_FIFO) -#define OAI_PRIORITY_RT sched_get_priority_max(SCHED_FIFO)-10 -#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_FIFO) + +#define SCHED_OAI SCHED_RR +#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI) +#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_max(SCHED_OAI))/2) +#define OAI_PRIORITY_RT_MAX sched_get_priority_max(SCHED_OAI)-2 void thread_top_init(char *thread_name, int affinity, diff --git a/common/utils/telnetsrv/telnetsrv.c b/common/utils/telnetsrv/telnetsrv.c index 03f7af99bc..734126721a 100644 --- a/common/utils/telnetsrv/telnetsrv.c +++ b/common/utils/telnetsrv/telnetsrv.c @@ -461,12 +461,12 @@ int process_command(char *buf) { int i,j,k; char modulename[TELNET_CMD_MAXSIZE]; char cmd[TELNET_CMD_MAXSIZE]; - char cmdb[TELNET_MAX_MSGLENGTH]; + char *cmdb=NULL; char *bufbck; int rt; memset(modulename,0,sizeof(modulename)); memset(cmd,0,sizeof(cmd)); - memset(cmdb,0,sizeof(cmdb)); + if (strncasecmp(buf,"ex",2) == 0) return CMDSTATUS_EXIT; @@ -490,12 +490,10 @@ int process_command(char *buf) { return CMDSTATUS_FOUND; } - memset(modulename,0,sizeof(modulename)); - memset(cmd,0,sizeof(cmd)); - memset(cmdb,0,sizeof(cmdb)); + bufbck=strdup(buf); rt=CMDSTATUS_NOTFOUND; - j = sscanf(buf,"%19s %19s %19[^\t\n]",modulename,cmd,cmdb); + j = sscanf(buf,"%19s %19s %m[^\t\n]",modulename,cmd,&cmdb); if (telnetparams.telnetdbg > 0) printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb); @@ -562,7 +560,7 @@ int process_command(char *buf) { rt= CMDSTATUS_FOUND; } /* loop */ } /* for i */ - + free(cmdb); free(bufbck); return rt; } @@ -702,7 +700,7 @@ void poll_telnetcmdq(void *qid, void *arg) { */ void exec_moduleinit(char *modname) { void (*fptr)(void); - char initfunc[TELNET_CMD_MAXSIZE+9]; + char initfunc[TELNET_CMD_MAXSIZE+10]; if (strlen(modname) > TELNET_CMD_MAXSIZE) { fprintf(stderr,"[TELNETSRV] module %s not loaded, name exceeds the %i size limit\n", diff --git a/common/utils/telnetsrv/telnetsrv.h b/common/utils/telnetsrv/telnetsrv.h index b66641d5c8..59655501d3 100644 --- a/common/utils/telnetsrv/telnetsrv.h +++ b/common/utils/telnetsrv/telnetsrv.h @@ -31,6 +31,7 @@ #ifndef TELNETSRV_H #define TELNETSRV_H +#include #define TELNETSRV_MODNAME "telnetsrv" #define TELNET_PORT 9090 diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index 5db1a5e34e..a32b7c3859 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -37,14 +37,21 @@ #else #define THREADINIT PTHREAD_MUTEX_INITIALIZER #endif -#define mutexinit(mutex) AssertFatal(pthread_mutex_init(&mutex,NULL)==0,""); -#define condinit(signal) AssertFatal(pthread_cond_init(&signal,NULL)==0,""); -#define mutexlock(mutex) AssertFatal(pthread_mutex_lock(&mutex)==0,""); +#define mutexinit(mutex) {int ret=pthread_mutex_init(&mutex,NULL); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condinit(signal) {int ret=pthread_cond_init(&signal,NULL); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define mutexlock(mutex) {int ret=pthread_mutex_lock(&mutex); \ + AssertFatal(ret==0,"ret=%d\n",ret);} #define mutextrylock(mutex) pthread_mutex_trylock(&mutex) -#define mutexunlock(mutex) AssertFatal(pthread_mutex_unlock(&mutex)==0,""); -#define condwait(condition, mutex) AssertFatal(pthread_cond_wait(&condition, &mutex)==0,""); -#define condbroadcast(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); -#define condsignal(signal) AssertFatal(pthread_cond_broadcast(&signal)==0,""); +#define mutexunlock(mutex) {int ret=pthread_mutex_unlock(&mutex); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condwait(condition, mutex) {int ret=pthread_cond_wait(&condition, &mutex); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condbroadcast(signal) {int ret=pthread_cond_broadcast(&signal); \ + AssertFatal(ret==0,"ret=%d\n",ret);} +#define condsignal(signal) {int ret=pthread_cond_broadcast(&signal); \ + AssertFatal(ret==0,"ret=%d\n",ret);} #define tpool_nbthreads(tpool) (tpool.nbThreads) typedef struct notifiedFIFO_elt_s { struct notifiedFIFO_elt_s *next; @@ -78,7 +85,7 @@ static inline notifiedFIFO_elt_t *newNotifiedFIFO_elt(int size, ret->reponseFifo=reponseFifo; ret->processingFunc=processingFunc; // We set user data piece aligend 32 bytes to be able to process it with SIMD - ret->msgData=(void *)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32; + ret->msgData=(void *)((uint8_t*)ret+(sizeof(notifiedFIFO_elt_t)/32+1)*32); ret->malloced=true; return ret; } diff --git a/common/utils/threadPool/thread-pool.md b/common/utils/threadPool/thread-pool.md index a087b989fa..f2422d9822 100644 --- a/common/utils/threadPool/thread-pool.md +++ b/common/utils/threadPool/thread-pool.md @@ -210,8 +210,8 @@ time the worker finished the job time the client reads the result if you set the environement variable: -thread-pool-measurements to a valid file name +threadPoolMeasurements to a valid file name These measurements will be wrote to this Linux pipe. -A tool to read the linux fifo and display it in ascii is provided: -see the local directory Makefile for this tool and to compile the thread pool unitary tests. +A tool to read the linux fifo and display it in ascii is provided; compute the binay: +in cmake building directory: make/ninja measurement_display diff --git a/doc/SW_archi.md b/doc/SW_archi.md index d92f802148..e5856d63bc 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -171,24 +171,31 @@ NR_sched_pusch_t (for values changing every TTI, e.g., frequency domain allocation) and NR_sched_pusch_save_t (for values changing less frequently, at least in FR1 [to my understanding], e.g., DMRS fields when the time domain allocation stays between TTIs) structures. Furthermore, the preprocessor is an -exchangeable module that might schedule differently, e.g., one user for -phytest, multiple users in FR1, or maybe FR2: phytest is in -nr_ul_preprocessor_phytest(), for FR1 is nr_simple_ulsch_preprocessor() [under -development], for FR2 does not exist yet. +exchangeable module that schedules differently based on a particular +use-case/deployment type, e.g., one user for phytest [in +nr_ul_preprocessor_phytest()], multiple users in FR1 +[nr_fr1_ulsch_preprocessor()], or maybe FR2 [does not exist yet]: * calls preprocessor via pre_processor_ul(): the preprocessor is responsible - for allocating CCEs (using allocate_nr_CCEs()). Note that we do not yet have - scheduling requests or buffer status reports, and only one UE. E.g., - nr_simple_ulsch_preprocessor(): + for allocating CCEs (using allocate_nr_CCEs()) and deciding on resource + allocation for the UEs including TB size. Note that we do not yet have + scheduling requests. What it typically does: 1) check whether the current frame/slot plus K2 is an UL slot, and return if not. 2) Find first free start RB in vrb_map_UL, and as many free consecutive RBs as possible. - 3) allocate a CCE for the UE (and return if it is not possible) - 4) Calculate DMRS stuff (nr_save_pusch_fields()) and the TBS. - 5) Mark used resources in vrb_map_UL. -* loop through all users: get a free HARQ PID and - update statistics. Fill nFAPI structures directly for PUSCH, and call - config_uldci() and fill_dci_pdu_rel15() for DCI filling and PDCCH messages. + 3) Either set up resource allocation directly (e.g., for a single UE, + phytest), or call into a function to perform actual resource allocation. + Currently, this is done using pf_ul() which implements a basic + proportional fair scheduler: + * for every UE, check for retransmission and allocate as necessary + * Calculate DMRS stuff (nr_set_pusch_semi_static()) + * Calculate the PF coefficient and put eligible UEs into a list + * Allocate resources to the UE(s) with the highest coefficient + 4) Mark used resources in vrb_map_UL. +* loop through all users: get a HARQ process as indicated through the + preprocessor, update statistics, fill nFAPI structures directly for PUSCH, + and call config_uldci() and fill_dci_pdu_rel15() for DCI filling and PDCCH + messages. Calls nr_schedule_ue_spec(). It is divided into the "preprocessor" and the "postprocessor": the first makes the scheduling decisions, the second fills @@ -196,29 +203,28 @@ nFAPI structures to indicate to the PHY what it is supposed to do. To signal which users have how many resources, the preprocessor populates the NR_UE_sched_ctrl_t structure of affected users. In particular, the field rbSize decides whether a user is to be allocated. Furthermore, the preprocessor is an -exchangeable module that might schedule differently, e.g., one user for -phytest, multiple users in FR1, or maybe FR2: phytest is in -nr_preprocessor_phytest(), for FR1 is nr_simple_dlsch_preprocessor() [under -development], for FR2 does not exist yet. +exchangeable module that schedules differently based on a particular +use-case/deployment type, e.g., one user for phytest [in +nr_preprocessor_phytest()], multiple users in FR1 +[nr_fr1_dlsch_preprocessor()], or maybe FR2 [does not exist yet]. * calls preprocessor via pre_processor_dl(): the preprocessor is responsible for allocating CCEs and PUCCH (using allocate_nr_CCEs() and nr_acknack_scheduling()) and deciding on the frequency/time domain - allocation. E.g., nr_simple_dlsch_preprocessor(): - 1) mac_rlc_status_ind() locks and checks directly inside rlc data the - quantity of waiting data. - 2) return from the preprocessor if there is no data and no timing advance to - send, - 3) otherwise, allocate a CCE for the UE (and return if it is not possible) - 4) find a PUCCH occasion for HARQ - 5a) check if there is a retransmission: if yes, find free resources to - transmit using the same resources, else - 5b) calculate the necessary RBs needed to get a TBS large enough to hold all - data, or until no more resources are available - 6) Mark taken resources in the vrb_map + allocation including the TB size. What it typically does: + 1) Check available resources in the vrb_map + 2) Checks the quantity of waiting data in RLC + 3) Either set up resource allocation directly (e.g., for a single UE, + phytest), or call into a function to perform actual resource allocation. + Currently, this is done using pf_dl() which implements a basic + proportional fair scheduler: + * for every UE, check for retransmission and allocate as necessary + * Calculate the PF coefficient and put eligible UEs into a list + * Allocate resources to the UE(s) with the highest coefficient + 4) Mark taken resources in the vrb_map * loop through all users: check if a new TA is necessary. Then, if a user has - allocated resources, compute its TBS, and fill nFAPI structures - (nr_fill_nfapi_dl_pdu() to populate what should be done by the lower layers - to make the Tx subframe). Update statistics (round, sent bytes). + allocated resources, update statistics (round, sent bytes), update HARQ + process information, and fill nFAPI structures (allocate a DCI and PDCCH + messages, TX_req, ...) # RRC RRC is a regular thread with itti loop on queue: TASK_RRC_GNB @@ -296,6 +302,28 @@ gtp thread calls directly pdcp_data_req(), so it runs inside it's context intern ## inside other threads gtpv1u_create_s1u_tunnel(), delete tunnel, ... functions are called inside the other threads, without mutex. +# New GTP +## initialization +Coexistance until full merge with legacy GTP +cmake new option: NEW_GTPU to use the new implementation (it changes for the entire executable) +It is possible to use both old and new GTP in same executable because the itti task and all functions names are different +Current status of new implementation: not tested, X2 not developped, 5G new GTP option not developped, remain issues on data coming from void: muid, enb_flag, ... + +ocp_gtpv1uTask(): this creates only the thread, doesn't configure anything +gtpv1Init(): creates a listening socket to Linux for a given reception and select a local IP address + +newGtpuCreateTunnel() this function will replace the xxx_create_tunnel_xxx() for various cases +This creates a outgoing context for a teid (in input), it computes and return the incoming teid that will be used for incoming packets +These teids and in a "instance", so in a Linux socket: same teid can co-exist for different sockets + Remain here a lack to fill: the information given in the legacy funtions is not enough to fullfil the data needed by the callback +stuff like enb_flag, but also mui and more important data are not given explicitly by any legacy function (gtpv1u_create_s1u_tunnel), but the legacy and the new interface to lower layer (like pdcp) require this data. +The datamodel is still not fully understood, so this data source remain unknown +A new parameter is the callback function: will be pdpcp_data_req() and gtpv_data_req() (x2 case) for existing implementation and later other call backs like the F1-U implementation. + +incoming packets +the gtp layer retrieves the data, the teid, find out the related data: rnti, bearer and quite a lot of other parameters (not clear why, because it looks like all is statefull, so the lower layer should have the context) +if lower layers can be stateless, it is a good idea to keep the context in the gtp layer and pass it to the callback, but the design remain obfuscated. + # NGAP NGAP would be a itti thread as is S1AP (+twin thread SCTP that is almost void processing)? About all messages are exchanged with RRC thread diff --git a/doc/TESTING_GNB_W_COTS_UE.md b/doc/TESTING_GNB_W_COTS_UE.md index 73ae18351f..5f9299f0ef 100644 --- a/doc/TESTING_GNB_W_COTS_UE.md +++ b/doc/TESTING_GNB_W_COTS_UE.md @@ -44,10 +44,11 @@ Our code might not work with all 5G phones yet, but we are constantly improving * Oppo Reno 5G * Samsung A90 5G -* Google Pixel 5G +* Google Pixel 5G (note1) * Simcom SIMCOM8200EA * Quectel RM500Q-GL +Note1: In the version we have at Eurecom, you need to set the PLMN to 50501, and you also need to change the firmware to "11.0.0 (RD1A.201105.003.B1, Nov 2020, EU carriers)" (see https://developers.google.com/android/images) ## Repository diff --git a/docker/Dockerfile.eNB.rhel8.2 b/docker/Dockerfile.eNB.rhel8.2 index aa8b9aa228..cf012502e0 100644 --- a/docker/Dockerfile.eNB.rhel8.2 +++ b/docker/Dockerfile.eNB.rhel8.2 @@ -25,7 +25,7 @@ # #--------------------------------------------------------------------- -FROM localhost/ran-build:latest AS enb-build +FROM ran-build:latest AS enb-build RUN rm -Rf /oai-ran WORKDIR /oai-ran @@ -37,10 +37,9 @@ RUN /bin/sh oaienv && \ mkdir -p log && \ ./build_oai --eNB --ninja -w USRP --verbose-ci -# debug -#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15 -#RUN ls -ls /oai-ran/targets/bin -#RUN ls -ls /oai-ran/cmake_targets/ran_build/build/*.so +RUN yum install -y python3-pip && \ + pip3 install --ignore-installed pyyaml && \ + python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml #start from scratch for target executable FROM registry.access.redhat.com/ubi8/ubi:latest as oai-enb @@ -59,6 +58,7 @@ RUN yum update -y && \ WORKDIR /opt/oai-enb/bin COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 . +COPY --from=enb-build /oai-ran/docker/scripts/enb_entrypoint.sh entrypoint.sh WORKDIR /usr/local/lib/ COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . @@ -93,34 +93,16 @@ COPY --from=enb-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 RUN ldconfig -#debug -#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 -#RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -#RUN ldd /usr/local/lib/libcoding.so -#RUN ldd /usr/local/lib/libparams_libconfig.so -#RUN ldd /usr/local/lib/libdfts.so -#RUN ldd /usr/local/lib/liboai_iqplayer.so -#RUN ldd /opt/oai-enb/bin/lte-softmodem.Rel15 - # Copy the relevant configuration files for eNB WORKDIR /opt/oai-enb/etc -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/enb.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rcc.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/cu.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/du.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rru.* . +COPY --from=enb-build /oai-ran/docker/etc . WORKDIR /opt/oai-enb -#EXPOSE 2152/udp # S1U, GTP/UDP -#EXPOSE 22100/tcp # ? -#EXPOSE 36412/udp # S1C, SCTP/UDP -#EXPOSE 36422/udp # X2C, SCTP/UDP -#EXPOSE 50000/udp # IF5 / ORI (control) -#EXPOSE 50001/udp # IF5 / ECPRI (data) +# 2152 --> S1U, GTP/UDP +# 36412 --> S1C, SCTP/UDP +# 36422 --> X2C, SCTP/UDP +EXPOSE 2152/udp 36412/udp 36422/udp -#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] +ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"] +CMD ["/opt/oai-enb/bin/lte-softmodem.Rel15", "-O", "/opt/oai-enb/etc/enb.conf"] diff --git a/docker/Dockerfile.eNB.ubuntu18 b/docker/Dockerfile.eNB.ubuntu18 index 95d7194c31..1f276094d5 100644 --- a/docker/Dockerfile.eNB.ubuntu18 +++ b/docker/Dockerfile.eNB.ubuntu18 @@ -41,11 +41,6 @@ RUN apt-get install -y python3-pip && \ pip3 install --ignore-installed pyyaml && \ python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml -# debug -#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15 -#RUN ls -ls /oai-ran/targets/bin -#RUN ls -ls /oai-ran/cmake_targets/ran_build/build/*.so - #start from scratch for target executable FROM ubuntu:bionic as oai-enb ENV DEBIAN_FRONTEND=noninteractive @@ -98,17 +93,6 @@ COPY --from=enb-build /usr/local/lib/libprotobuf-c.so.1 . RUN ldconfig -#debug -#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 -#RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -#RUN ldd /usr/local/lib/libcoding.so -#RUN ldd /usr/local/lib/libparams_libconfig.so -#RUN ldd /usr/local/lib/libdfts.so -#RUN ldd /usr/local/lib/liboai_iqplayer.so -#RUN ldd /opt/oai-enb/bin/lte-softmodem.Rel15 - # Copy the relevant configuration files for eNB WORKDIR /opt/oai-enb/etc COPY --from=enb-build /oai-ran/docker/etc . diff --git a/docker/Dockerfile.lteUE.rhel8.2 b/docker/Dockerfile.lteUE.rhel8.2 index e22343d63c..731abed1a8 100644 --- a/docker/Dockerfile.lteUE.rhel8.2 +++ b/docker/Dockerfile.lteUE.rhel8.2 @@ -25,7 +25,7 @@ # #--------------------------------------------------------------------- -FROM localhost/ran-build:latest AS lte-ue-build +FROM ran-build:latest AS lte-ue-build RUN rm -Rf /oai-ran WORKDIR /oai-ran @@ -37,10 +37,10 @@ RUN /bin/sh oaienv && \ mkdir -p log && \ ./build_oai --UE --ninja -w USRP --verbose-ci -# debug -#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15 -#RUN ls -lst /oai-ran/targets/bin -#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so +RUN yum install -y python3-pip && \ + pip3 install --ignore-installed pyyaml && \ + python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \ + python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml #start from scratch for target executable FROM registry.access.redhat.com/ubi8/ubi:latest as oai-lte-ue @@ -59,12 +59,10 @@ RUN yum update -y && \ WORKDIR /opt/oai-lte-ue/bin COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 . +COPY --from=lte-ue-build /oai-ran/docker/scripts/lte_ue_entrypoint.sh entrypoint.sh COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata . COPY --from=lte-ue-build /oai-ran/targets/bin/nvram . COPY --from=lte-ue-build /oai-ran/targets/bin/usim . -COPY --from=lte-ue-build /oai-ran/targets/bin/.ue_emm.nvram0 . -COPY --from=lte-ue-build /oai-ran/targets/bin/.ue.nvram0 . -COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 . WORKDIR /usr/local/lib/ COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . @@ -99,26 +97,10 @@ COPY --from=lte-ue-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 RUN ldconfig -#debug -#RUN ldd /opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15 -#RUN ldd /opt/oai-lte-ue/bin/conf2uedata -#RUN ldd /opt/oai-lte-ue/bin/nvram -#RUN ldd /opt/oai-lte-ue/bin/usim -#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 -#RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -#RUN ldd /usr/local/lib/libcoding.so -#RUN ldd /usr/local/lib/libparams_libconfig.so -#RUN ldd /usr/local/lib/libSIMU.so -#RUN ldd /usr/local/lib/libdfts.so - -# Copy the relevant configuration files for eNB +# Copy the relevant configuration files for UE WORKDIR /opt/oai-lte-ue/etc -COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* . -COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf +COPY --from=lte-ue-build /oai-ran/docker/etc . WORKDIR /opt/oai-lte-ue -#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] +CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15"] +ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"] diff --git a/docker/Dockerfile.lteUE.ubuntu18 b/docker/Dockerfile.lteUE.ubuntu18 index 6af2e61991..6575a81899 100644 --- a/docker/Dockerfile.lteUE.ubuntu18 +++ b/docker/Dockerfile.lteUE.ubuntu18 @@ -37,11 +37,10 @@ RUN /bin/sh oaienv && \ mkdir -p log && \ ./build_oai --UE --ninja -w USRP --verbose-ci -# debug -#RUN ldconfig -v -#RUN ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15 -#RUN ls -lst /oai-ran/targets/bin -#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so +RUN apt-get install -y python3-pip && \ + pip3 install --ignore-installed pyyaml && \ + python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \ + python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml #start from scratch for target executable FROM ubuntu:bionic as oai-lte-ue @@ -76,12 +75,10 @@ RUN apt-get update && \ WORKDIR /opt/oai-lte-ue/bin COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 . +COPY --from=lte-ue-build /oai-ran/docker/scripts/lte_ue_entrypoint.sh entrypoint.sh COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata . COPY --from=lte-ue-build /oai-ran/targets/bin/nvram . COPY --from=lte-ue-build /oai-ran/targets/bin/usim . -COPY --from=lte-ue-build /oai-ran/targets/bin/.ue_emm.nvram0 . -COPY --from=lte-ue-build /oai-ran/targets/bin/.ue.nvram0 . -COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 . WORKDIR /usr/local/lib/ COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . @@ -100,26 +97,10 @@ COPY --from=lte-ue-build /usr/local/lib/libprotobuf-c.so.1 . RUN ldconfig -#debug -#RUN ldd /opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15 -#RUN ldd /opt/oai-lte-ue/bin/conf2uedata -#RUN ldd /opt/oai-lte-ue/bin/nvram -#RUN ldd /opt/oai-lte-ue/bin/usim -#RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -#RUN ldd /usr/local/lib/libtcp_bridge_oai.so.Rel15 -#RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -#RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -#RUN ldd /usr/local/lib/libcoding.so -#RUN ldd /usr/local/lib/libparams_libconfig.so -#RUN ldd /usr/local/lib/libSIMU.so -#RUN ldd /usr/local/lib/libdfts.so - -# Copy the relevant configuration files for eNB +# Copy the relevant configuration files for UE WORKDIR /opt/oai-lte-ue/etc -COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* ./ -COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf +COPY --from=lte-ue-build /oai-ran/docker/etc . WORKDIR /opt/oai-lte-ue -#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] +CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15"] +ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"] diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2 new file mode 100644 index 0000000000..4472ece363 --- /dev/null +++ b/docker/Dockerfile.phySim.rhel8.2 @@ -0,0 +1,123 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# +# Dockerfile for the Open-Air-Interface BUILD service +# Valid for RHEL8 +# +#--------------------------------------------------------------------- + +FROM localhost/ran-build:develop AS phy-sim-build + +RUN rm -Rf /oai-ran +WORKDIR /oai-ran +COPY . . + +#run build_oai to build the target image +RUN /bin/sh oaienv && \ + cd cmake_targets && \ + mkdir -p log && \ + ./build_oai --phy_simulators --ninja --verbose-ci + + +#start from scratch for target executable +FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim + +RUN yum update -y && \ + yum install -y --enablerepo="ubi-8-codeready-builder" \ + lksctp-tools \ + nettle \ + atlas \ + hostname \ + sudo \ + procps-ng \ + net-tools \ + iputils \ + bc \ + iproute \ + libyaml && \ + echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ + echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf + +WORKDIR /opt/oai-physim/targets/bin +COPY --from=phy-sim-build /oai-ran/targets/bin/dlsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_dlsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_prachsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_ulschsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/polartest.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/ulsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/ldpctest.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_dlschsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_pbchsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_pucchsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/nr_ulsim.Rel15 . +COPY --from=phy-sim-build /oai-ran/targets/bin/smallblocktest.Rel15 . + +WORKDIR /usr/local/lib/ +COPY --from=phy-sim-build /oai-ran/targets/bin/libcoding.so . +COPY --from=phy-sim-build /lib64/liblapacke.so.3 . +COPY --from=phy-sim-build /lib64/libX11.so.6 . +COPY --from=phy-sim-build /lib64/libXpm.so.4 . +COPY --from=phy-sim-build /lib64/libxcb.so.1 . +COPY --from=phy-sim-build /lib64/libXau.so.6 . +COPY --from=phy-sim-build /lib64/libforms.so.2 . +COPY --from=phy-sim-build /lib64/libblas.so.3 . +COPY --from=phy-sim-build /lib64/liblapack.so.3 . +COPY --from=phy-sim-build /lib64/libexslt.so.0 . +COPY --from=phy-sim-build /lib64/libxslt.so.1 . +COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libdfts.so . +COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libSIMU.so . +COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libldpc.so . +COPY --from=phy-sim-build /oai-ran/cmake_targets/phy_simulators/build/libldpc_orig.so . + +RUN ldconfig + +#debug +#RUN ldd /opt/oai-physim/targets/bin/dlsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_dlsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_prachsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_ulschsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/polartest.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/ulsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/ldpctest.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_dlschsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_pbchsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_pucchsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/nr_ulsim.Rel15 +#RUN ldd /opt/oai-physim/targets/bin/smallblocktest.Rel15 + +# Copy some executables +WORKDIR /usr/bin/ + +COPY --from=phy-sim-build /usr/bin/killall . +COPY --from=phy-sim-build /usr/bin/xmlstarlet . +COPY --from=phy-sim-build /usr/bin/svn . + +# Copy the relevant configuration files for phySim +WORKDIR /opt/oai-physim/ + +COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/run_exec_autotests.bash /opt/oai-physim/cmake_targets/autotests/ +COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/test_case_list.xml /opt/oai-physim/cmake_targets/autotests/ +COPY --from=phy-sim-build /oai-ran/cmake_targets/autotests/tools/free_mem.bash /opt/oai-physim/cmake_targets/autotests/tools/ +COPY --from=phy-sim-build /oai-ran/cmake_targets/tools/build_helper /opt/oai-physim/cmake_targets/tools/ +COPY --from=phy-sim-build /oai-ran/cmake_targets/tools/test_helper /opt/oai-physim/cmake_targets/tools/ + +#CMD ["sleep", "infinity"] diff --git a/docker/scripts/enb_entrypoint.sh b/docker/scripts/enb_entrypoint.sh index 31d99b2a67..dbe97360f6 100755 --- a/docker/scripts/enb_entrypoint.sh +++ b/docker/scripts/enb_entrypoint.sh @@ -2,17 +2,20 @@ set -euo pipefail +PREFIX=/opt/oai-enb +RRC_INACTIVITY_THRESHOLD=${RRC_INACTIVITY_THRESHOLD:-0} + # Based another env var, pick one template to use -if [[ -v USE_FDD_CU ]]; then ln -s /opt/oai-enb/etc/cu.fdd.conf /opt/oai-enb/etc/enb.conf; fi -if [[ -v USE_FDD_DU ]]; then ln -s /opt/oai-enb/etc/du.fdd.conf /opt/oai-enb/etc/enb.conf; fi -if [[ -v USE_FDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi -if [[ -v USE_TDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.tdd.conf /opt/oai-enb/etc/enb.conf; fi -if [[ -v USE_FDD_RCC ]]; then ln -s /opt/oai-enb/etc/rcc.if4p5.enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi -if [[ -v USE_FDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.fdd.conf /opt/oai-enb/etc/enb.conf; fi -if [[ -v USE_TDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.tdd.conf /opt/oai-enb/etc/enb.conf; fi +if [[ -v USE_FDD_CU ]]; then ln -s $PREFIX/etc/cu.fdd.conf $PREFIX/etc/enb.conf; fi +if [[ -v USE_FDD_DU ]]; then ln -s $PREFIX/etc/du.fdd.conf $PREFIX/etc/enb.conf; fi +if [[ -v USE_FDD_MONO ]]; then ln -s $PREFIX/etc/enb.fdd.conf $PREFIX/etc/enb.conf; fi +if [[ -v USE_TDD_MONO ]]; then ln -s $PREFIX/etc/enb.tdd.conf $PREFIX/etc/enb.conf; fi +if [[ -v USE_FDD_FAPI_RCC ]]; then ln -s $PREFIX/etc/rcc.nfapi.fdd.conf $PREFIX/etc/enb.conf; fi +if [[ -v USE_FDD_RRU ]]; then ln -s $PREFIX/etc/rru.fdd.conf $PREFIX/etc/enb.conf; fi +if [[ -v USE_TDD_RRU ]]; then ln -s $PREFIX/etc/rru.tdd.conf $PREFIX/etc/enb.conf; fi # Only this template will be manipulated -CONFIG_FILES=`ls /opt/oai-enb/etc/enb.conf` +CONFIG_FILES=`ls $PREFIX/etc/enb.conf || true` for c in ${CONFIG_FILES}; do # grep variable names (format: ${VAR}) from template to be rendered diff --git a/docker/scripts/enb_parameters.yaml b/docker/scripts/enb_parameters.yaml index a60fc20e29..d115d177ab 100644 --- a/docker/scripts/enb_parameters.yaml +++ b/docker/scripts/enb_parameters.yaml @@ -159,6 +159,8 @@ env: "@ENB_S1U_IP_ADDRESS@" - key: ENB_IPV4_ADDRESS_FOR_X2C env: "@ENB_X2_IP_ADDRESS@" + - key: rrc_inactivity_threshold + env: "@RRC_INACTIVITY_THRESHOLD@" - key: FLEXRAN_ENABLED env: "@FLEXRAN_ENABLED@" - key: FLEXRAN_INTERFACE_NAME @@ -204,7 +206,7 @@ env: "@F1_CU_IP_ADDRESS@" - filePrefix: "rcc.band7.tm1.nfapi" - outputfilename: "rcc.if4p5.enb.fdd.conf" + outputfilename: "rcc.nfapi.fdd.conf" config: - key: Active_eNBs env: "@ENB_NAME@" diff --git a/docker/scripts/generateTemplate.py b/docker/scripts/generateTemplate.py index 4949e9cf21..418476d395 100644 --- a/docker/scripts/generateTemplate.py +++ b/docker/scripts/generateTemplate.py @@ -35,11 +35,12 @@ def main(): data = yaml.full_load(f) dir = os.listdir(f'{data[0]["paths"]["source_dir"]}') - #identify configs, read and replace corresponding values for config in data[1]["configurations"]: filePrefix = config["filePrefix"] outputfilename = config["outputfilename"] + print('filePrefix = ' + filePrefix) + print('outputfilename = ' + outputfilename) for inputfile in dir: if inputfile.find(filePrefix) >=0: prefix_outputfile = {"cu": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', @@ -48,7 +49,9 @@ def main(): "rru.tdd": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', "enb.band7.tm1.25PRB.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', "enb.band40.tm1.25PRB.FairScheduler.usrpb210": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', - "rcc.band7.tm1.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}' + "rcc.band7.tm1.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', + "ue.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', + "ue_sim_ci": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}' } if filePrefix in prefix_outputfile: outputfile1 = prefix_outputfile[filePrefix] @@ -61,6 +64,9 @@ def main(): open(outputfile1, mode='w') as outputfile: for line in inputfile: count = 0 + if re.search(r'EHPLMN_LIST', line): + outputfile.write(line) + continue for key in config["config"]: if line.find(key["key"]) >= 0: count += 1 diff --git a/docker/scripts/lte_ue_entrypoint.sh b/docker/scripts/lte_ue_entrypoint.sh new file mode 100755 index 0000000000..235128f738 --- /dev/null +++ b/docker/scripts/lte_ue_entrypoint.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +set -euo pipefail + +PREFIX=/opt/oai-lte-ue + +# Based another env var, pick one template to use +if [[ -v USE_NFAPI ]]; then ln -s $PREFIX/etc/ue.nfapi.conf $PREFIX/etc/ue.conf; fi + +# Only this template will be manipulated and the USIM one! +CONFIG_FILES=`ls $PREFIX/etc/ue.conf $PREFIX/etc/ue_usim.conf || true` + +for c in ${CONFIG_FILES}; do + # grep variable names (format: ${VAR}) from template to be rendered + VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs) + + # create sed expressions for substituting each occurrence of ${VAR} + # with the value of the environment variable "VAR" + EXPRESSIONS="" + for v in ${VARS}; do + NEW_VAR=`echo $v | sed -e "s#@##g"` + if [[ "${!NEW_VAR}x" == "x" ]]; then + echo "Error: Environment variable '${NEW_VAR}' is not set." \ + "Config file '$(basename $c)' requires all of $VARS." + exit 1 + fi + EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g" + done + EXPRESSIONS="${EXPRESSIONS#';'}" + + # render template and inline replace config file + sed -i "${EXPRESSIONS}" ${c} +done + +#now generate USIM files +# At this point all operations will be run from $PREFIX! +cd $PREFIX +$PREFIX/bin/conf2uedata -c $PREFIX/etc/ue_usim.conf -o $PREFIX + +# Load the USRP binaries +if [[ -v USE_B2XX ]]; then + /usr/lib/uhd/utils/uhd_images_downloader.py -t b2xx +elif [[ -v USE_X3XX ]]; then + /usr/lib/uhd/utils/uhd_images_downloader.py -t x3xx +elif [[ -v USE_N3XX ]]; then + /usr/lib/uhd/utils/uhd_images_downloader.py -t n3xx +fi + +# in case we have conf file, append +new_args=() +while [[ $# -gt 0 ]]; do + new_args+=("$1") + shift +done +if [[ -v USE_NFAPI ]]; then + new_args+=("-O") + new_args+=("$PREFIX/etc/ue.conf") +fi + +echo "==================================" +echo "== Starting LTE UE soft modem" +if [[ -v USE_ADDITIONAL_OPTIONS ]]; then + echo "Additional option(s): ${USE_ADDITIONAL_OPTIONS}" + for word in ${USE_ADDITIONAL_OPTIONS}; do + new_args+=("$word") + done + echo "${new_args[@]}" + exec "${new_args[@]}" +else + echo "${new_args[@]}" + exec "${new_args[@]}" +fi diff --git a/docker/scripts/lte_ue_parameters.yaml b/docker/scripts/lte_ue_parameters.yaml new file mode 100644 index 0000000000..977659bb54 --- /dev/null +++ b/docker/scripts/lte_ue_parameters.yaml @@ -0,0 +1,37 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ + +--- +- paths: + source_dir: "ci-scripts/conf_files/" + dest_dir: docker/etc + +- configurations: + - filePrefix: ue.nfapi + outputfilename: "ue.nfapi.conf" + config: + - key: remote_n_address + env: "@ENB_IP_ADDRESS@" + - key: local_n_address + env: "@LTE_UE_IP_ADDRESS@" + - key: local_n_if_name + env: "@UE_NFAPI_IF_NAME@" + diff --git a/docker/scripts/lte_ue_sim_parameters.yaml b/docker/scripts/lte_ue_sim_parameters.yaml new file mode 100644 index 0000000000..a339ed7504 --- /dev/null +++ b/docker/scripts/lte_ue_sim_parameters.yaml @@ -0,0 +1,47 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ + +--- +- paths: + source_dir: "openair3/NAS/TOOLS/" + dest_dir: docker/etc + +- configurations: + - filePrefix: ue_sim_ci + outputfilename: "ue_usim.conf" + config: + - key: MNC + env: "@MNC@" + - key: MCC + env: "@MCC@" + - key: MSIN + env: "@SHORT_IMSI@" + - key: USIM_API_K + env: "@LTE_KEY@" + - key: OPC + env: "@OPC@" + - key: MSISDN + env: "@MSISDN@" + - key: HPLMN + env: "@HPLMN@" + - key: OPLMN_LIST + env: "@HPLMN@" + diff --git a/executables/main-fs6.c b/executables/main-fs6.c index 5283ce5eaa..438edb4044 100644 --- a/executables/main-fs6.c +++ b/executables/main-fs6.c @@ -750,7 +750,7 @@ void phy_procedures_eNB_uespec_RX_fromsplit(uint8_t *bufferZone, int nbBlocks,PH recvFs6Ul(bufferZone, nbBlocks, eNB, ul_propa); // dirty memory allocation in OAI... - for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) + for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) if ( eNB->uci_vars[i].frame == proc->frame_rx && eNB->uci_vars[i].subframe == proc->subframe_rx ) eNB->uci_vars[i].active=0; @@ -1145,7 +1145,7 @@ void appendFs6DLUEcch(uint8_t *bufferZone, PHY_VARS_eNB *eNB, int frame, int sub commonUDP_t *newUDPheader=(commonUDP_t *) firstFreeByte; bool first_UE=true; - for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) { + for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) { LTE_eNB_UCI *uci = &(eNB->uci_vars[i]); if ((uci->active == 1) && (uci->frame == frame) && (uci->subframe == subframe)) { diff --git a/executables/main-ocp.c b/executables/main-ocp.c index ae1db7195b..b0f0b05315 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -73,13 +73,15 @@ int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; volatile int oai_exit = 0; double cpuf; +msc_interface_t msc_interface; +THREAD_STRUCT thread_struct; + uint16_t sf_ahead=4; //uint16_t slot_ahead=6; int otg_enabled; uint64_t downlink_frequency[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int split73; -int usrp_tx_thread = 0; char * split73_config; int split73; AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0}; @@ -202,7 +204,6 @@ void init_eNB_afterRU(void) { for (int inst=0; instframe_parms.nb_antennas_rx = 0; eNB->frame_parms.nb_antennas_tx = 0; eNB->prach_vars.rxsigF[0] = (int16_t **)malloc16(64*sizeof(int16_t *)); @@ -228,12 +229,26 @@ void init_eNB_afterRU(void) { for (int ce_level=0; ce_level<4; ce_level++) eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[ru_id]->prach_rxsigF_br[ce_level][i]; - eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i]; } } - AssertFatal( eNB->frame_parms.nb_antennas_rx > 0 && eNB->frame_parms.nb_antennas_rx < 4, ""); - AssertFatal( eNB->frame_parms.nb_antennas_tx > 0 && eNB->frame_parms.nb_antennas_rx < 4, ""); + + AssertFatal( eNB->frame_parms.nb_antennas_rx > 0 && eNB->frame_parms.nb_antennas_rx < 5, ""); + AssertFatal( eNB->frame_parms.nb_antennas_tx > 0 && eNB->frame_parms.nb_antennas_rx < 5, ""); + + phy_init_lte_eNB(eNB,0,0); + + // need to copy rxdataF after L1 variables are allocated + for (int inst=0; instnum_RU; ru_id++) { + for (int i=0; iRU_list[ru_id]->nb_rx; aa++,i++) + eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i]; + } + } + } + LOG_I(PHY,"inst %d, CC_id %d : nb_antennas_rx %d\n",inst,CC_id,eNB->frame_parms.nb_antennas_rx); init_transport(eNB); //init_precoding_weights(RC.eNB[inst][CC_id]); @@ -800,7 +815,7 @@ int init_rf(RU_t *ru) { pthread_setname_np(pthread_self(),name); return ret; } - + void ocp_init_RU(RU_t *ru, char *rf_config_file, int send_dmrssync) { PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL; int i; @@ -1318,7 +1333,7 @@ int main ( int argc, char **argv ) { // end of CI modifications //getchar(); - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) load_softscope("enb", NULL); itti_wait_tasks_end(); @@ -1327,7 +1342,7 @@ int main ( int argc, char **argv ) { // stop threads if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) { - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) end_forms(); LOG_I(ENB_APP,"stopping MODEM threads\n"); diff --git a/executables/main_ru.c b/executables/main_ru.c new file mode 100644 index 0000000000..93a580560e --- /dev/null +++ b/executables/main_ru.c @@ -0,0 +1,382 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file oairu.c + * \brief Top-level threads for radio-unit + * \author R. Knopp + * \date 2020 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr + * \note + * \warning + */ + + +#define _GNU_SOURCE /* See feature_test_macros(7) */ +#include + + + + +#include "assertions.h" +#include "PHY/types.h" + +#include "PHY/defs_RU.h" +#include "common/config/config_userapi.h" +#include "common/utils/load_module_shlib.h" + + +#include "../../ARCH/COMMON/common_lib.h" +#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" + + +#include "PHY/phy_vars.h" +#include "SCHED/sched_common_vars.h" +#include "PHY/TOOLS/phy_scope_interface.h" +#include "common/utils/LOG/log.h" +#include "common/utils/LOG/vcd_signal_dumper.h" +#include "PHY/INIT/phy_init.h" +#include "openair2/ENB_APP/enb_paramdef.h" +#include "system.h" + +#include +#include +#include + +static int DEFBANDS[] = {7}; +static int DEFENBS[] = {0}; +static int DEFBFW[] = {0x00007fff}; + +THREAD_STRUCT thread_struct; + +pthread_cond_t sync_cond; +pthread_mutex_t sync_mutex; +int sync_var=-1; //!< protected by mutex \ref sync_mutex. +int config_sync_var=-1; + +volatile int oai_exit = 0; +uint16_t sf_ahead = 4; +RU_t ru_m; + + +extern void init_RU0(RU_t *ru,int ru_id,char *rf_config_file, int send_dmrssync); +extern void init_RU_proc(RU_t *ru); +extern void kill_RU_proc(RU_t *ru); +extern void set_function_spec_param(RU_t *ru); + +int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; + + +void nfapi_setmode(nfapi_mode_t nfapi_mode) { return; } +void exit_function(const char *file, const char *function, const int line, const char *s) { + + if (s != NULL) { + printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s); + } + close_log_mem(); + oai_exit = 1; + + if (ru_m.rfdevice.trx_end_func) { + ru_m.rfdevice.trx_end_func(&ru_m.rfdevice); + ru_m.rfdevice.trx_end_func = NULL; + } + + if (ru_m.ifdevice.trx_end_func) { + ru_m.ifdevice.trx_end_func(&ru_m.ifdevice); + ru_m.ifdevice.trx_end_func = NULL; + } + + pthread_mutex_destroy(ru_m.ru_mutex); + pthread_cond_destroy(ru_m.ru_cond); + sleep(1); //allow lte-softmodem threads to exit first + exit(1); +} + + +static void get_options(void) { + CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); + get_common_options(SOFTMODEM_ENB_BIT ); + CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); + + //RCConfig(); + +} + + + + + +extern void phy_free_RU(RU_t *); + +nfapi_mode_t nfapi_getmode(void) { + return(NFAPI_MODE_PNF); +} + +void oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) { + + AssertFatal(1==0,"This is bad ... please check why we get here\n"); +} + +void wait_eNBs(void){ return; } + +uint64_t downlink_frequency[MAX_NUM_CCs][4]; + + +int main ( int argc, char **argv ) +{ + + if ( load_configmodule(argc,argv,0) == NULL) { + exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); + } + + logInit(); + printf("Reading in command-line options\n"); + get_options (); + + if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) { + fprintf(stderr,"Getting configuration failed\n"); + exit(-1); + } + +#if T_TRACER + T_Config_Init(); +#endif + printf("configuring for RRU\n"); + +#ifndef PACKAGE_VERSION +# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL" +#endif + LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); + + /* Read configuration */ + + printf("About to Init RU threads\n"); + + + RU_t *ru=&ru_m; + + paramdef_t RUParams[] = RUPARAMS_DESC; + paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0}; + config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL); + + int j=0; + uint64_t ru_mask=1; + pthread_mutex_t ru_mutex; pthread_mutex_init(&ru_mutex,NULL); + pthread_cond_t ru_cond; pthread_cond_init(&ru_cond,NULL); + + ru->ru_mask= &ru_mask; + ru->ru_mutex = &ru_mutex; + ru->ru_cond = &ru_cond; + + ru->if_timing = synch_to_ext_device; + ru->num_eNB = 0; + ru->has_ctrl_prt = 1; + if (config_isparamset(RUParamList.paramarray[j], RU_SDR_ADDRS)) { + ru->openair0_cfg.sdr_addrs = strdup(*(RUParamList.paramarray[j][RU_SDR_ADDRS].strptr)); + } + + if (config_isparamset(RUParamList.paramarray[j], RU_SDR_CLK_SRC)) { + if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "internal") == 0) { + ru->openair0_cfg.clock_source = internal; + LOG_D(PHY, "RU clock source set as internal\n"); + } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "external") == 0) { + ru->openair0_cfg.clock_source = external; + LOG_D(PHY, "RU clock source set as external\n"); + } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "gpsdo") == 0) { + ru->openair0_cfg.clock_source = gpsdo; + LOG_D(PHY, "RU clock source set as gpsdo\n"); + } else { + LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr)); + } + } + else { + ru->openair0_cfg.clock_source = unset; + } + + if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) { + if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) { + ru->openair0_cfg.time_source = internal; + LOG_D(PHY, "RU time source set as internal\n"); + } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) { + ru->openair0_cfg.time_source = external; + LOG_D(PHY, "RU time source set as external\n"); + } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) { + ru->openair0_cfg.time_source = gpsdo; + LOG_D(PHY, "RU time source set as gpsdo\n"); + } else { + LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr)); + } + } + else { + ru->openair0_cfg.time_source = unset; + } + + if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) { + if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) { + AssertFatal(1==0,"IF_NAME is required\n"); + } else { + ru->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); + ru->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); + ru->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr)); + ru->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr); + ru->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr); + + // Check if control port set + if (!(config_isparamset(RUParamList.paramarray[j],RU_REMOTE_PORTC_IDX)) ) { + printf("Removing control port for RU %d\n",j); + ru->has_ctrl_prt = 0; + } else { + ru->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); + ru->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); + printf(" Control port %u \n",ru->eth_params.my_portc); + } + + if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) { + ru->if_south = LOCAL_RF; + ru->function = NGFI_RRU_IF5; + ru->eth_params.transp_preference = ETH_UDP_MODE; + printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j); + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) { + ru->if_south = LOCAL_RF; + ru->function = NGFI_RRU_IF5; + ru->eth_params.transp_preference = ETH_RAW_MODE; + printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j); + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) { + ru->if_south = LOCAL_RF; + ru->function = NGFI_RRU_IF4p5; + ru->eth_params.transp_preference = ETH_UDP_IF4p5_MODE; + printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j); + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) { + ru->if_south = LOCAL_RF; + ru->function = NGFI_RRU_IF4p5; + ru->eth_params.transp_preference = ETH_RAW_IF4p5_MODE; + printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j); + } + + printf("RU %d is_slave=%s\n",j,*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr)); + + if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru->is_slave=1; + else ru->is_slave=0; + + printf("RU %d ota_sync_enabled=%s\n",j,*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr)); + + if (strcmp(*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr), "yes") == 0) ru->ota_sync_enable=1; + else ru->ota_sync_enable=0; + } + + ru->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);; + ru->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr); + ru->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; + /* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */ + ru->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr); + + for (int i=0; inum_bands; i++) ru->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; + } //strcmp(local_rf, "yes") == 0 + else { + printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr)); + ru->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); + ru->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); + ru->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr)); + ru->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); + ru->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); + ru->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr); + ru->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr); + + if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) { + ru->if_south = REMOTE_IF5; + ru->function = NGFI_RAU_IF5; + ru->eth_params.transp_preference = ETH_UDP_MODE; + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) { + ru->if_south = REMOTE_IF5; + ru->function = NGFI_RAU_IF5; + ru->eth_params.transp_preference = ETH_RAW_MODE; + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) { + ru->if_south = REMOTE_IF4p5; + ru->function = NGFI_RAU_IF4p5; + ru->eth_params.transp_preference = ETH_UDP_IF4p5_MODE; + } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) { + ru->if_south = REMOTE_IF4p5; + ru->function = NGFI_RAU_IF4p5; + ru->eth_params.transp_preference = ETH_RAW_IF4p5_MODE; + } + + if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru->is_slave=1; + else ru->is_slave=0; + } /* strcmp(local_rf, "yes") != 0 */ + + ru->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr); + ru->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr); + ru->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); + ru->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr); + + + set_worker_conf("WORKER_ENABLE"); + + mlockall(MCL_CURRENT | MCL_FUTURE); + pthread_cond_init(&sync_cond,NULL); + pthread_mutex_init(&sync_mutex, NULL); + + init_RU0(ru,0,get_softmodem_params()->rf_config_file,get_softmodem_params()->send_dmrs_sync); + ru->rf_map.card=0; + ru->rf_map.chain=(get_softmodem_params()->chain_offset); + + LOG_I(PHY, "Initializing RRU descriptor : (%s,%s,%d)\n", ru_if_types[ru->if_south], NB_timing[ru->if_timing], ru->function); + set_function_spec_param(ru); + LOG_I(PHY, "Starting ru_thread , is_slave %d, send_dmrs %d\n", ru->is_slave, ru->generate_dmrs_sync); + init_RU_proc(ru); + + pthread_mutex_lock(&ru_mutex); + while (ru_mask>0) + pthread_cond_wait(&ru_cond,&ru_mutex); + pthread_mutex_unlock(&ru_mutex); + LOG_I(PHY,"RU configured, unlocking threads\n"); + config_sync_var=0; + pthread_mutex_lock(&sync_mutex); + sync_var=0; + pthread_cond_broadcast(&sync_cond); + pthread_mutex_unlock(&sync_mutex); + + while (oai_exit==0) sleep(1); + // stop threads + + kill_RU_proc(ru); + phy_free_RU(ru); + + free_lte_top(); + end_configmodule(); + + if (ru->rfdevice.trx_end_func) { + ru->rfdevice.trx_end_func(&ru->rfdevice); + ru->rfdevice.trx_end_func = NULL; + } + + if (ru->ifdevice.trx_end_func) { + ru->ifdevice.trx_end_func(&ru->ifdevice); + ru->ifdevice.trx_end_func = NULL; + } + + + + logClean(); + printf("Bye.\n"); + return 0; +} diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 410c41d9b1..5e46f0b6f8 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -131,7 +131,7 @@ void tx_func(void *param) { } void rx_func(void *param) { - //printf("inside rx func. \n"); + processingData_L1_t *info = (processingData_L1_t *) param; PHY_VARS_gNB *gNB = info->gNB; int frame_rx = info->frame_rx; @@ -228,18 +228,6 @@ void rx_func(void *param) { rnti_to_remove_count = 0; if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); - // Call the scheduler - - if(NFAPI_MODE == NFAPI_MONOLITHIC) - { - pthread_mutex_lock(&gNB->UL_INFO_mutex); - gNB->UL_INFO.frame = frame_rx; - gNB->UL_INFO.slot = slot_rx; - gNB->UL_INFO.module_id = gNB->Mod_id; - gNB->UL_INFO.CC_id = gNB->CC_id; - gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); - pthread_mutex_unlock(&gNB->UL_INFO_mutex); - } // RX processing int tx_slot_type; int rx_slot_type; if(NFAPI_MODE != NFAPI_MONOLITHIC) { //slot selection routines not working properly in nfapi, so temporarily hardcoding @@ -277,19 +265,32 @@ void rx_func(void *param) { L1_nr_prach_procedures(gNB,frame_rx,slot_rx); //apply the rx signal rotation here - apply_nr_rotation_ul(&gNB->frame_parms, - gNB->common_vars.rxdataF[0], - slot_rx, - 0, - gNB->frame_parms.Ncp==EXTENDED?12:14, - gNB->frame_parms.ofdm_symbol_size); - + for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) { + apply_nr_rotation_ul(&gNB->frame_parms, + gNB->common_vars.rxdataF[aa], + slot_rx, + 0, + gNB->frame_parms.Ncp==EXTENDED?12:14, + gNB->frame_parms.ofdm_symbol_size); + } phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx); } stop_meas( &softmodem_stats_rxtx_sf ); LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, frame_rx, slot_rx, frame_tx, slot_tx); + // Call the scheduler + + start_meas(&gNB->ul_indication_stats); + pthread_mutex_lock(&gNB->UL_INFO_mutex); + gNB->UL_INFO.frame = frame_rx; + gNB->UL_INFO.slot = slot_rx; + gNB->UL_INFO.module_id = gNB->Mod_id; + gNB->UL_INFO.CC_id = gNB->CC_id; + gNB->if_inst->NR_UL_indication(&gNB->UL_INFO); + pthread_mutex_unlock(&gNB->UL_INFO_mutex); + stop_meas(&gNB->ul_indication_stats); + notifiedFIFO_elt_t *res; if (tx_slot_type == NR_DOWNLINK_SLOT || tx_slot_type == NR_MIXED_SLOT) { @@ -349,18 +350,24 @@ static void *process_stats_thread(void *param) { PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)param; + reset_meas(&gNB->phy_proc_tx); reset_meas(&gNB->dlsch_encoding_stats); - reset_meas(&gNB->dlsch_scrambling_stats); - reset_meas(&gNB->dlsch_modulation_stats); + reset_meas(&gNB->phy_proc_rx); + reset_meas(&gNB->ul_indication_stats); + reset_meas(&gNB->rx_pusch_stats); + reset_meas(&gNB->ulsch_decoding_stats); wait_sync("process_stats_thread"); while(!oai_exit) { sleep(1); - print_meas(&gNB->dlsch_encoding_stats, "pdsch_encoding", NULL, NULL); - print_meas(&gNB->dlsch_scrambling_stats, "pdsch_scrambling", NULL, NULL); - print_meas(&gNB->dlsch_modulation_stats, "pdsch_modulation", NULL, NULL); + print_meas(&gNB->phy_proc_tx, "L1 Tx processing", NULL, NULL); + print_meas(&gNB->dlsch_encoding_stats, "DLSCH encoding", NULL, NULL); + print_meas(&gNB->phy_proc_rx, "L1 Rx processing", NULL, NULL); + print_meas(&gNB->ul_indication_stats, "UL Indication", NULL, NULL); + print_meas(&gNB->rx_pusch_stats, "PUSCH inner-receiver", NULL, NULL); + print_meas(&gNB->ulsch_decoding_stats, "PUSCH decoding", NULL, NULL); } return(NULL); } @@ -373,7 +380,9 @@ void init_gNB_Tpool(int inst) { // ULSCH decoding threadpool gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t)); int numCPU = sysconf(_SC_NPROCESSORS_ONLN); + LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->pusch_proc_threads,numCPU); int threadCnt = min(numCPU, gNB->pusch_proc_threads); + if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt); char ul_pool[80]; sprintf(ul_pool,"-1"); int s_offset = 0; @@ -446,6 +455,8 @@ void init_eNB_afterRU(void) { PHY_VARS_gNB *gNB; LOG_I(PHY,"%s() RC.nb_nr_inst:%d\n", __FUNCTION__, RC.nb_nr_inst); + if(NFAPI_MODE == NFAPI_MODE_PNF) + RC.nb_nr_inst = 1; for (inst=0; instabstraction_flag = 0; gNB->single_thread_flag = single_thread_flag; @@ -535,7 +544,7 @@ void init_gNB(int single_thread_flag,int wait_for_sync) { } - LOG_I(PHY,"[nr-softmodem.c] gNB structure allocated\n"); + LOG_I(PHY,"[nr-gnb.c] gNB structure allocated\n"); } diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 1e8cae3adc..5eff0f35b8 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -89,7 +89,7 @@ static int DEFBFW[] = {0x00007fff}; #include "s1ap_eNB.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" - +#include #include "T.h" @@ -113,6 +113,7 @@ void configure_ru(int idx, void *arg); void configure_rru(int idx, void *arg); int attach_rru(RU_t *ru); int connect_rau(RU_t *ru); +static void NRRCconfig_RU(void); uint16_t sf_ahead; uint16_t slot_ahead; @@ -120,7 +121,6 @@ uint16_t sl_ahead; extern int emulate_rf; extern int numerology; -extern int usrp_tx_thread; /*************************************************************/ /* Functions to attach and configure RRU */ @@ -757,17 +757,25 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) { if (fp->freq_range==nr_FR2) { // the beam index is written in bits 8-10 of the flags // bit 11 enables the gpio programming + // currently we switch beams every 10 slots (should = 1 TDD period in FR2) and we take the beam index of the first symbol of the first slot of this period int beam=0; - //if (slot==0) beam = 11; //3 for boresight & 8 to enable + if (slot%10==0) { + if (ru->common.beam_id[0][slot*fp->symbols_per_slot] < 8) { + beam = ru->common.beam_id[0][slot*fp->symbols_per_slot] | 8; + } + } /* - if (slot==0 || slot==40) beam=0&8; - if (slot==10 || slot==50) beam=1&8; - if (slot==20 || slot==60) beam=2&8; - if (slot==30 || slot==70) beam=3&8; + if (slot==0 || slot==40) beam=0|8; + if (slot==10 || slot==50) beam=1|8; + if (slot==20 || slot==60) beam=2|8; + if (slot==30 || slot==70) beam=3|8; */ flags |= beam<<8; - } + LOG_D(HW,"slot %d, beam %d\n",slot,ru->common.beam_id[0][slot*fp->symbols_per_slot]); + + } + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS, flags ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, slot ); @@ -1370,12 +1378,17 @@ void *ru_thread( void *param ) { for (aa=0;aanb_rx;aa++) memcpy((void*)RC.gNB[0]->common_vars.rxdataF[aa], (void*)ru->common.rxdataF[aa], fp->symbols_per_slot*fp->ofdm_symbol_size*sizeof(int32_t)); - + if (IS_SOFTMODEM_DOSCOPE && RC.gNB[0]->scopeData) + ((scopeData_t*)RC.gNB[0]->scopeData)->slotFunc(ru->common.rxdataF[0],proc->tti_rx, RC.gNB[0]->scopeData); // Do PRACH RU processing int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST); uint8_t prachStartSymbol,N_dur; if (prach_id>=0) { + + T(T_GNB_PHY_PRACH_INPUT_SIGNAL, T_INT(proc->frame_rx), T_INT(proc->tti_rx), T_INT(0), + T_BUFFER(&ru->common.rxdata[0][fp->get_samples_slot_timestamp(proc->tti_rx-1,fp,0)]/*-ru->N_TA_offset*/, fp->get_samples_per_slot(proc->tti_rx,fp)*4*2)); + N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt); /* get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value, @@ -1755,11 +1768,9 @@ void set_function_spec_param(RU_t *ru) { ru->nr_start_if = NULL; // no if interface ru->rfdevice.host_type = RAU_HOST; - // FK this here looks messed up. The following lines should be part of the if (ru->function == gNodeB_3GPP), shouldn't they? - - ru->fh_south_in = rx_rf; // local synchronous RF RX - ru->fh_south_out = tx_rf; // local synchronous RF TX - ru->start_rf = start_rf; // need to start the local RF interface + ru->fh_south_in = rx_rf; // local synchronous RF RX + ru->fh_south_out = tx_rf; // local synchronous RF TX + ru->start_rf = start_rf; // need to start the local RF interface ru->stop_rf = stop_rf; ru->start_write_thread = start_write_thread; // starting RF TX in different thread printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf); @@ -1861,7 +1872,7 @@ void init_NR_RU(char *rf_config_file) pthread_cond_init(&RC.ru_cond,NULL); // read in configuration file) printf("configuring RU from file\n"); - RCconfig_RU(); + NRRCconfig_RU(); LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_nr_L1_inst,RC.nb_RU,get_nprocs()); LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU); @@ -1936,7 +1947,7 @@ void stop_RU(int nb_ru) /* --------------------------------------------------------*/ /* from here function to use configuration module */ -void RCconfig_RU(void) +static void NRRCconfig_RU(void) { int i = 0, j = 0; paramdef_t RUParams[] = RUPARAMS_DESC; diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h index 500819e684..813ffcf8fa 100644 --- a/executables/nr-softmodem-common.h +++ b/executables/nr-softmodem-common.h @@ -68,11 +68,15 @@ #define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n" #define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n" #define CONFIG_HLP_ITTIL "Generate ITTI analyzser logs (similar to wireshark logs but with more details)\n" -#define CONFIG_HLP_DLMCS "Set the maximum downlink MCS\n" +#define CONFIG_HLP_DLMCS_PHYTEST "Set the downlink MCS for PHYTEST mode\n" #define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n" #define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n" #define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n" -#define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n" +#define CONFIG_HLP_ULMCS_PHYTEST "Set the uplink MCS for PHYTEST mode\n" +#define CONFIG_HLP_DLBW_PHYTEST "Set the number of PRBs used for DLSCH in PHYTEST mode\n" +#define CONFIG_HLP_ULBW_PHYTEST "Set the number of PRBs used for ULSCH in PHYTEST mode\n" +#define CONFIG_HLP_DLBM_PHYTEST "Bitmap for DLSCH slots (slot 0 starts at LSB)\n" +#define CONFIG_HLP_ULBM_PHYTEST "Bitmap for ULSCH slots (slot 0 starts at LSB)\n" #define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n" #define CONFIG_HLP_UE "Set the lte softmodem as a UE\n" #define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n" diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 69fc3c554d..353751a66a 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -85,6 +85,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "x2ap_eNB.h" #include "ngap_gNB.h" #include "gnb_paramdef.h" +#include #include "nfapi/oai_integration/vendor_ext.h" pthread_cond_t nfapi_sync_cond; @@ -92,11 +93,12 @@ pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex extern uint8_t nfapi_mode; // Default to monolithic mode - +THREAD_STRUCT thread_struct; pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; +msc_interface_t msc_interface; volatile int start_gNB = 0; volatile int oai_exit = 0; @@ -114,7 +116,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; //Temp fix for inexistent NR upper layer unsigned char NB_gNB_INST = 1; -static char *itti_dump_file = NULL; int UE_scan = 1; int UE_scan_carrier = 0; @@ -160,15 +161,18 @@ int otg_enabled; //static NR_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]; //static nfapi_nr_config_request_t *config[MAX_NUM_CCs]; -uint32_t target_dl_mcs = 28; //maximum allowed mcs -uint32_t target_ul_mcs = 20; uint32_t timing_advance = 0; uint64_t num_missed_slots=0; // counter for the number of missed slots +#include int split73=0; void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) { AssertFatal(false, "Must not be called in this context\n"); } +void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask, uint16_t rnti, int32_t stat) { + AssertFatal(false, "Must not be called in this context\n"); +} + extern void reset_opp_meas(void); extern void print_opp_meas(void); @@ -179,7 +183,6 @@ extern void *udp_eNB_task(void *args_p); int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; static char *parallel_config = NULL; @@ -717,12 +720,11 @@ if(!IS_SOFTMODEM_NOS1) if(IS_SOFTMODEM_NOS1) init_pdcp(); + if (RC.nb_nr_L1_inst > 0) + RCconfig_NR_L1(); if (RC.nb_nr_inst > 0) { // don't create if node doesn't connect to RRC/S1/GTP AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n"); - } else { - printf("No ITTI, Initializing L1\n"); - RCconfig_NR_L1(); } /* Start the agent. If it is turned off in the configuration, it won't start */ @@ -810,7 +812,7 @@ if(!IS_SOFTMODEM_NOS1) printf("RC.nb_RU:%d\n", RC.nb_RU); // once all RUs are ready initialize the rest of the gNBs ((dependence on final RU parameters after configuration) printf("ALL RUs ready - init gNBs\n"); - if(IS_SOFTMODEM_DOFORMS) { + if(IS_SOFTMODEM_DOSCOPE) { sleep(1); scopeParms_t p; p.argc=&argc; diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index d6cfe6b906..928558013c 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -18,19 +18,27 @@ /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define CMDLINE_PARAMS_DESC_GNB { \ - {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ {"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ {"A" , CONFIG_HLP_TADV, 0, uptr:&timing_advance, defintval:0, TYPE_UINT, 0}, \ {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, i8ptr:&threequarter_fs, defintval:0, TYPE_INT8, 0}, \ - {"K" , CONFIG_HLP_ITTIL, PARAMFLAG_NOFREE, strptr:&itti_dump_file, defstrval:"/tmp/itti.dump", TYPE_STRING, 0}, \ - {"m" , CONFIG_HLP_DLMCS, 0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ - {"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ + {"m" , CONFIG_HLP_DLMCS_PHYTEST,0, uptr:&target_dl_mcs, defintval:0, TYPE_UINT, 0}, \ + {"t" , CONFIG_HLP_ULMCS_PHYTEST,0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ + {"M" , CONFIG_HLP_DLBW_PHYTEST,0, uptr:&target_dl_bw, defintval:0, TYPE_UINT, 0}, \ + {"T" , CONFIG_HLP_ULBW_PHYTEST,0, uptr:&target_ul_bw, defintval:0, TYPE_UINT, 0}, \ + {"D" , CONFIG_HLP_DLBM_PHYTEST,0, u64ptr:&dlsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \ + {"U" , CONFIG_HLP_ULBM_PHYTEST,0, u64ptr:&ulsch_slot_bitmap, defintval:0, TYPE_UINT64, 0}, \ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ {"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \ } #include "threads_t.h" extern threads_t threads; +extern uint32_t target_dl_mcs; +extern uint32_t target_ul_mcs; +extern uint32_t target_dl_bw; +extern uint32_t target_ul_bw; +extern uint64_t dlsch_slot_bitmap; +extern uint64_t ulsch_slot_bitmap; // In nr-gnb.c extern void init_gNB(int single_thread_flag,int wait_for_sync); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index f175ab4980..a35a11a033 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -27,6 +27,8 @@ #include "SCHED_NR_UE/phy_frame_config_nr.h" #include "SCHED_NR_UE/defs.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" +#include "executables/softmodem-common.h" +#include "SCHED_NR_UE/pucch_uci_ue_nr.h" /* * NR SLOT PROCESSING SEQUENCE @@ -90,6 +92,8 @@ #else #define DURATION_RX_TO_TX (6) /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */ #endif +#define RX_JOB_ID 0x1010 +#define TX_JOB_ID 100 typedef enum { pss = 0, @@ -107,6 +111,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, ue->Mod_id = UE_id; ue->mac_enabled = 1; ue->if_inst = nr_ue_if_module_init(0); + ue->dci_thres = 0; // Setting UE mode to NOT_SYNCHED by default for (gNB_id = 0; gNB_id < nb_connected_gNB; gNB_id++){ @@ -129,10 +134,7 @@ void init_nr_ue_vars(PHY_VARS_NR_UE *ue, * \param arg is a pointer to a \ref PHY_VARS_NR_UE structure. */ -typedef struct syncData_s { - UE_nr_rxtx_proc_t proc; - PHY_VARS_NR_UE *UE; -} syncData_t; +typedef nr_rxtx_thread_data_t syncData_t; static void UE_synch(void *arg) { syncData_t *syncD=(syncData_t *) arg; @@ -279,7 +281,11 @@ static void UE_synch(void *arg) { } } -void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { +void processSlotTX(void *arg) { + + nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; + UE_nr_rxtx_proc_t *proc = &rxtxD->proc; + PHY_VARS_NR_UE *UE = rxtxD->UE; fapi_nr_config_request_t *cfg = &UE->nrUE_config; int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx); uint8_t gNB_id = 0; @@ -310,10 +316,14 @@ void processSlotTX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { } } -void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { +void processSlotRX(void *arg) { + nr_rxtx_thread_data_t *rxtxD = (nr_rxtx_thread_data_t *) arg; + UE_nr_rxtx_proc_t *proc = &rxtxD->proc; + PHY_VARS_NR_UE *UE = rxtxD->UE; fapi_nr_config_request_t *cfg = &UE->nrUE_config; int rx_slot_type = nr_ue_slot_select(cfg, proc->frame_rx, proc->nr_slot_rx); + int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx); uint8_t gNB_id = 0; if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){ @@ -329,7 +339,7 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { phy_procedures_slot_parallelization_nrUE_RX( UE, proc, 0, 0, 1, no_relay, NULL ); #else uint64_t a=rdtsc(); - phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel); + phy_procedures_nrUE_RX(UE, proc, gNB_id, get_nrUE_params()->nr_dlsch_parallel, &rxtxD->txFifo); LOG_D(PHY, "In %s: slot %d, time %lu\n", __FUNCTION__, proc->nr_slot_rx, (rdtsc()-a)/3500); #endif @@ -338,35 +348,47 @@ void processSlotRX( PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) { protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0); pdcp_run(&ctxt); + + /* send tick to RLC and PDCP every ms */ + if (proc->nr_slot_rx % UE->frame_parms.slots_per_subframe == 0) { + void nr_rlc_tick(int frame, int subframe); + void nr_pdcp_tick(int frame, int subframe); + nr_rlc_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe); + nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe); + } } + + // Wait for PUSCH processing to finish + notifiedFIFO_elt_t *res; + res = pullTpool(&rxtxD->txFifo,&(get_nrUE_params()->Tpool)); + delNotifiedFIFO_elt(res); + + } else { + processSlotTX(rxtxD); } -} + if (tx_slot_type == NR_UPLINK_SLOT || tx_slot_type == NR_MIXED_SLOT){ + if (UE->UE_mode[gNB_id] <= PUSCH) { + if (get_softmodem_params()->usim_test==0) { + pucch_procedures_ue_nr(UE, + gNB_id, + proc, + FALSE); + } -/*! - * \brief This is the UE thread for RX subframe n and TX subframe n+4. - * This thread performs the phy_procedures_UE_RX() on every received slot. - * then, if TX is enabled it performs TX for n+4. - * \param arg is a pointer to a \ref PHY_VARS_NR_UE structure. - * \returns a pointer to an int. The storage is not on the heap and must not be freed. - */ + LOG_D(PHY, "Sending Uplink data \n"); + nr_ue_pusch_common_procedures(UE, + proc->nr_slot_tx, + &UE->frame_parms,1); + } -typedef struct processingData_s { - UE_nr_rxtx_proc_t proc; - PHY_VARS_NR_UE *UE; -} processingData_t; - -void UE_processing(void *arg) { - processingData_t *rxtxD = (processingData_t *) arg; - UE_nr_rxtx_proc_t *proc = &rxtxD->proc; - PHY_VARS_NR_UE *UE = rxtxD->UE; - int slot_tx = proc->nr_slot_tx; - int frame_tx = proc->frame_tx; - - processSlotRX(UE, proc); - processSlotTX(UE, proc); - ue_ta_procedures(UE, slot_tx, frame_tx); + if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) { + nr_ue_prach_procedures(UE, proc, gNB_id); + } + LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx); + } + ue_ta_procedures(UE, proc->nr_slot_tx, proc->frame_tx); } void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) { @@ -483,25 +505,44 @@ void *UE_thread(void *arg) { int start_rx_stream = 0; AssertFatal(0== openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]), ""); UE->rfdevice.host_type = RAU_HOST; + UE->lost_sync = 0; + UE->is_synchronized = 0; AssertFatal(UE->rfdevice.trx_start_func(&UE->rfdevice) == 0, "Could not start the device\n"); + notifiedFIFO_t nf; initNotifiedFIFO(&nf); - int nbSlotProcessing=0; - int thread_idx=0; + notifiedFIFO_t freeBlocks; initNotifiedFIFO_nothreadSafe(&freeBlocks); + + int nbSlotProcessing=0; + int thread_idx=0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); int timing_advance = UE->timing_advance; - for (int i=0; iframe_parms.slots_per_frame; int absolute_slot=0, decoded_frame_rx=INT_MAX, trashed_frames=0; + for (int i=0; itxFifo); + pushNotifiedFIFO_nothreadSafe(&freeBlocks, newElt); + } + while (!oai_exit) { + if (UE->lost_sync) { + int nb = abortTpool(&(get_nrUE_params()->Tpool),RX_JOB_ID); + nb += abortNotifiedFIFO(&nf, RX_JOB_ID); + LOG_I(PHY,"Number of aborted slots %d\n",nb); + for (int i=0; iis_synchronized = 0; + UE->lost_sync = 0; + } + if (syncRunning) { notifiedFIFO_elt_t *res=tryPullTpool(&nf,&(get_nrUE_params()->Tpool)); @@ -511,9 +552,10 @@ void *UE_thread(void *arg) { if (UE->is_synchronized) { decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx); // shift the frame index with all the frames we trashed meanwhile we perform the synch search - decoded_frame_rx=(decoded_frame_rx + (!UE->init_sync_frame) + trashed_frames) % MAX_FRAME_NUMBER; + decoded_frame_rx=(decoded_frame_rx + UE->init_sync_frame + trashed_frames) % MAX_FRAME_NUMBER; } delNotifiedFIFO_elt(res); + start_rx_stream=0; } else { readFrame(UE, ×tamp, true); trashed_frames+=2; @@ -560,13 +602,13 @@ void *UE_thread(void *arg) { // whatever means thread_idx // Fix me: will be wrong when slot 1 is slow, as slot 2 finishes - // Slot 3 will overlap if RX_NB_TH is 2 + // Slot 3 will overlap if NR_RX_NB_TH is 2 // this is general failure in UE !!! - thread_idx = absolute_slot % RX_NB_TH; + thread_idx = absolute_slot % NR_RX_NB_TH; int slot_nr = absolute_slot % nb_slot_frame; notifiedFIFO_elt_t *msgToPush; - AssertFatal((msgToPush=pullNotifiedFIFO_nothreadSafe(&freeBlocks)) != NULL,"chained list failure"); - processingData_t *curMsg=(processingData_t *)NotifiedFifoData(msgToPush); + AssertFatal((msgToPush=pullTpool(&freeBlocks,&(get_nrUE_params()->Tpool))) != NULL,"chained list failure"); + nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(msgToPush); curMsg->UE=UE; // update thread index for received subframe curMsg->proc.thread_id = thread_idx; @@ -594,18 +636,18 @@ void *UE_thread(void *arg) { for (int i=0; iframe_parms.nb_antennas_tx; i++) txp[i] = (void *)&UE->common_vars.txdata[i][UE->frame_parms.get_samples_slot_timestamp( - ((slot_nr + DURATION_RX_TO_TX - RX_NB_TH)%nb_slot_frame),&UE->frame_parms,0)]; + ((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH)%nb_slot_frame),&UE->frame_parms,0)]; int readBlockSize, writeBlockSize; if (slot_nr<(nb_slot_frame - 1)) { readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms); - writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms); + writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH) % nb_slot_frame, &UE->frame_parms); } else { UE->rx_offset_diff = computeSamplesShift(UE); readBlockSize=get_readBlockSize(slot_nr, &UE->frame_parms) - UE->rx_offset_diff; - writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - RX_NB_TH) % nb_slot_frame, &UE->frame_parms)- UE->rx_offset_diff; + writeBlockSize=UE->frame_parms.get_samples_per_slot((slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH) % nb_slot_frame, &UE->frame_parms)- UE->rx_offset_diff; } AssertFatal(readBlockSize == @@ -632,31 +674,33 @@ void *UE_thread(void *arg) { } curMsg->proc.timestamp_tx = timestamp+ - UE->frame_parms.get_samples_slot_timestamp(slot_nr, - &UE->frame_parms,DURATION_RX_TO_TX) - firstSymSamp; + UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX) + - firstSymSamp; notifiedFIFO_elt_t *res; - while (nbSlotProcessing >= RX_NB_TH) { + while (nbSlotProcessing >= NR_RX_NB_TH) { res=pullTpool(&nf, &(get_nrUE_params()->Tpool)); nbSlotProcessing--; - processingData_t *tmp=(processingData_t *)res->msgData; + nr_rxtx_thread_data_t *tmp=(nr_rxtx_thread_data_t *)res->msgData; if (tmp->proc.decoded_frame_rx != -1) decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx); - else + else decoded_frame_rx=-1; pushNotifiedFIFO_nothreadSafe(&freeBlocks,res); } - if ( decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx) + if (decoded_frame_rx>0 && decoded_frame_rx != curMsg->proc.frame_rx) LOG_E(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n", - decoded_frame_rx, curMsg->proc.frame_rx ); + decoded_frame_rx, curMsg->proc.frame_rx); // use previous timing_advance value to compute writeTimestamp - writeTimestamp = timestamp + UE->frame_parms.get_samples_slot_timestamp(slot_nr, &UE->frame_parms,DURATION_RX_TO_TX - RX_NB_TH) - - firstSymSamp - openair0_cfg[0].tx_sample_advance - UE->N_TA_offset - timing_advance; + writeTimestamp = timestamp+ + UE->frame_parms.get_samples_slot_timestamp(slot_nr,&UE->frame_parms,DURATION_RX_TO_TX + - NR_RX_NB_TH) - firstSymSamp - openair0_cfg[0].tx_sample_advance - + UE->N_TA_offset - timing_advance; // but use current UE->timing_advance value to compute writeBlockSize if (UE->timing_advance != timing_advance) { @@ -665,7 +709,7 @@ void *UE_thread(void *arg) { } int flags = 0; - int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH; + int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - NR_RX_NB_TH; if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) { @@ -685,38 +729,21 @@ void *UE_thread(void *arg) { } if (flags || IS_SOFTMODEM_RFSIM) - AssertFatal( writeBlockSize == - UE->rfdevice.trx_write_func(&UE->rfdevice, - writeTimestamp, - txp, - writeBlockSize, - UE->frame_parms.nb_antennas_tx, - flags),""); + AssertFatal(writeBlockSize == + UE->rfdevice.trx_write_func(&UE->rfdevice, + writeTimestamp, + txp, + writeBlockSize, + UE->frame_parms.nb_antennas_tx, + flags),""); for (int i=0; iframe_parms.nb_antennas_tx; i++) memset(txp[i], 0, writeBlockSize); nbSlotProcessing++; - msgToPush->key=slot_nr; + LOG_D(PHY,"Number of slots being processed at the moment: %d\n",nbSlotProcessing); pushTpool(&(get_nrUE_params()->Tpool), msgToPush); - if (IS_SOFTMODEM_RFSIM) { //getenv("RFSIMULATOR") - // FixMe: Wait previous thread is done, because race conditions seems too bad - // in case of actual RF board, the overlap between threads mitigate the issue - // We must receive one message, that proves the slot processing is done - res=pullTpool(&nf, &(get_nrUE_params()->Tpool)); - nbSlotProcessing--; - processingData_t *tmp=(processingData_t *)res->msgData; - - if (tmp->proc.decoded_frame_rx != -1) - decoded_frame_rx=(((mac->mib->systemFrameNumber.buf[0] >> mac->mib->systemFrameNumber.bits_unused)<<4) | tmp->proc.decoded_frame_rx); - else - decoded_frame_rx=-1; - //decoded_frame_rx=tmp->proc.decoded_frame_rx; - - pushNotifiedFIFO_nothreadSafe(&freeBlocks,res); - } - } // while !oai_exit return NULL; @@ -731,23 +758,6 @@ void init_NR_UE(int nb_inst, char* rrc_config_path) { AssertFatal((rrc_inst = nr_l3_init_ue(rrc_config_path)) != NULL, "can not initialize RRC module\n"); AssertFatal((mac_inst = nr_l2_init_ue(rrc_inst)) != NULL, "can not initialize L2 module\n"); AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initialize IF module\n"); - - NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; - if (mac_inst->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac_inst->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup; - } - else if (mac_inst->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { - pusch_TimeDomainAllocationList = mac_inst->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; - } - - if (pusch_TimeDomainAllocationList) { - for(int i = 0; i < pusch_TimeDomainAllocationList->list.count; i++) { - AssertFatal(*pusch_TimeDomainAllocationList->list.array[i]->k2 >= DURATION_RX_TO_TX, - "Slot offset K2 (%ld) cannot be less than DURATION_RX_TO_TX (%d)\n", - *pusch_TimeDomainAllocationList->list.array[i]->k2, - DURATION_RX_TO_TX); - } - } } } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 2854457eee..83b3d433aa 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -82,12 +82,14 @@ unsigned short config_frames[4] = {2,9,11,13}; // current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0) #include "PHY/TOOLS/phy_scope_interface.h" #include "PHY/TOOLS/nr_phy_scope.h" -#define NRUE_MAIN #include #include "executables/softmodem-common.h" #include "executables/thread-common.h" extern const char *duplex_mode[]; +msc_interface_t msc_interface; +THREAD_STRUCT thread_struct; +nrUE_params_t nrUE_params; // Thread variables pthread_cond_t nfapi_sync_cond; @@ -145,7 +147,7 @@ int chain_offset = 0; int card_offset = 0; uint64_t num_missed_slots = 0; // counter for the number of missed slots int transmission_mode = 1; -int usrp_tx_thread = 0; +int numerology = 0; int oaisim_flag = 0; int emulate_rf = 0; @@ -179,6 +181,23 @@ void print_difftimes(void) { LOG_I(HW,"difftimes min = %lu ns ; max = %lu ns\n", min_diff_time.tv_nsec, max_diff_time.tv_nsec); } +int create_tasks_nrue(uint32_t ue_nb) { + LOG_D(NR_RRC, "%s(ue_nb:%d)\n", __FUNCTION__, ue_nb); + itti_wait_ready(1); + + if (ue_nb > 0) { + LOG_I(NR_RRC,"create TASK_RRC_NRUE \n"); + if (itti_create_task (TASK_RRC_NRUE, rrc_nrue_task, NULL) < 0) { + LOG_E(NR_RRC, "Create task for RRC UE failed\n"); + return -1; + } + + } + + itti_wait_ready(0); + return 0; +} + void exit_function(const char *file, const char *function, const int line, const char *s) { int CC_id; @@ -213,9 +232,16 @@ nrUE_params_t *get_nrUE_params(void) { } /* initialie thread pools used for NRUE processing paralleliation */ void init_tpools(uint8_t nun_dlsch_threads) { - char *params=calloc(1,(RX_NB_TH*3)+1); - for (int i=0; i TO TERMINATE\n"); + + if (create_tasks_nrue(1) < 0) { + printf("cannot create ITTI tasks\n"); + exit(-1); // need a softer mode + } + // Sleep a while before checking all parameters have been used // Some are used directly in external threads, asynchronously sleep(20); diff --git a/executables/nr-uesoftmodem.h b/executables/nr-uesoftmodem.h index 5902c8cca8..5c082b7bbb 100644 --- a/executables/nr-uesoftmodem.h +++ b/executables/nr-uesoftmodem.h @@ -72,9 +72,6 @@ extern uint64_t get_nrUE_optmask(void); extern uint64_t set_nrUE_optmask(uint64_t bitmask); extern nrUE_params_t *get_nrUE_params(void); -#ifdef NRUE_MAIN -nrUE_params_t nrUE_params; -#endif // In nr-ue.c extern int setup_nr_ue_buffers(PHY_VARS_NR_UE **phy_vars_ue, openair0_config_t *openair0_cfg); diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index 4ddc7870d9..326f7d277f 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -61,8 +61,6 @@ uint32_t do_forms=0; unsigned int mmapped_dma=0; int8_t threequarter_fs=0; -uint32_t target_dl_mcs = 28; //maximum allowed mcs -uint32_t target_ul_mcs = 20; int chain_offset=0; uint16_t sl_ahead=6; uint16_t sf_ahead=6; @@ -70,16 +68,15 @@ uint32_t timing_advance = 0; int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; int config_sync_var=-1; pthread_mutex_t nfapi_sync_mutex; pthread_cond_t nfapi_sync_cond; int nfapi_sync_var=-1; -uint8_t nfapi_mode = NFAPI_MONOLITHIC; // Default to monolithic mode double cpuf; +THREAD_STRUCT thread_struct; pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; @@ -95,7 +92,8 @@ time_stats_t nfapi_meas; // total tx time time_stats_t softmodem_stats_rx_sf; // total rx time // not used but needed for link openair0_config_t openair0_cfg[MAX_CARDS]; - +uint16_t slot_ahead=6; +msc_interface_t msc_interface; AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]; AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; int flexran_agent_start(mid_t mod_id) { @@ -122,7 +120,6 @@ int restart_L1L2(module_id_t gnb_id) { } static int wait_for_sync = 0; -static char *itti_dump_file = NULL; static double snr_dB=20; static int DEFBANDS[] = {7}; static int DEFENBS[] = {0}; @@ -996,7 +993,7 @@ int main( int argc, char **argv ) { (void *)NULL, "time_meas", -1, OAI_PRIORITY_RT_LOW); } - if(IS_SOFTMODEM_DOFORMS) { + if(IS_SOFTMODEM_DOSCOPE) { scopeParms_t tmp= {&argc, argv, &ru, RC.gNB[0]}; load_softscope("nr",&tmp); } diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index 1077c0e1ac..fa6b674765 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -45,6 +45,8 @@ static softmodem_params_t softmodem_params; char *parallel_config=NULL; char *worker_config=NULL; +msc_interface_t msc_interface; +int usrp_tx_thread = 0; uint8_t nfapi_mode=0; @@ -86,7 +88,7 @@ char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) { void get_common_options(uint32_t execmask) { uint32_t online_log_messages=0; uint32_t glog_level=0 ; - uint32_t start_telnetsrv = 0; + uint32_t start_telnetsrv = 0, start_telnetclt = 0; uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0; uint32_t rfsim = 0, basicsim = 0, do_forms = 0; char *logmem_filename = NULL; @@ -95,21 +97,26 @@ void get_common_options(uint32_t execmask) { checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC; check_execmask(execmask); config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); - config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams, - sizeof(cmdline_logparams)/sizeof(paramdef_t)); - config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL); - - if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) { + + int numparams=sizeof(cmdline_logparams)/sizeof(paramdef_t); + config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,numparams); + config_get( cmdline_logparams,numparams,NULL); + + if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_FLOG_OPT))) { set_glog_onlinelog(online_log_messages); } - if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) { + if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_LOGL_OPT))) { set_glog(glog_level); } if (start_telnetsrv) { load_module_shlib("telnetsrv",NULL,0,NULL); } + + if (start_telnetclt) { + set_softmodem_optmask(SOFTMODEM_TELNETCLT_BIT); + } if (logmem_filename != NULL && strlen(logmem_filename) > 0) { log_mem_filename = &logmem_filename[0]; @@ -140,7 +147,7 @@ void get_common_options(uint32_t execmask) { } if (do_forms) { - set_softmodem_optmask(SOFTMODEM_DOFORMS_BIT); + set_softmodem_optmask(SOFTMODEM_DOSCOPE_BIT); } if(parallel_config != NULL) set_parallel_conf(parallel_config); diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 7a7be1de96..ad349d4d01 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -73,6 +73,7 @@ extern "C" #define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n" #define CONFIG_HLP_256QAM "Use the 256 QAM mcs table for PDSCH\n" +#define CONFIG_HLP_NONSTOP "Go back to frame sync mode after 100 consecutive PBCH failures\n" //#define CONFIG_HLP_NUMUES "Set the number of UEs for the emulation" #define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n" #define CONFIG_HLP_ULMCS "Set the maximum uplink MCS\n" @@ -87,10 +88,13 @@ extern "C" #define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n" #define CONFIG_HLP_PARALLEL_CMD "three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'\n" #define CONFIG_HLP_WORKER_CMD "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n" +#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" + #define CONFIG_HLP_NOS1 "Disable s1 interface\n" #define CONFIG_HLP_RFSIM "Run in rf simulator mode (also known as basic simulator)\n" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" +#define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" #define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -114,9 +118,11 @@ extern "C" #define USIM_TEST softmodem_params.usim_test #define USE_256QAM_TABLE softmodem_params.use_256qam_table #define NFAPI softmodem_params.nfapi +#define NON_STOP softmodem_params.non_stop #define DEFAULT_RFCONFIG_FILE "/usr/local/etc/syriq/ue.band7.tm1.PRB100.NR40.dat"; +extern int usrp_tx_thread; #define CMDLINE_PARAMS_DESC { \ {"rf-config-file", CONFIG_HLP_RFCFGF, 0, strptr:(char **)&RF_CONFIG_FILE, defstrval:NULL, TYPE_STRING, sizeof(RF_CONFIG_FILE)},\ {"split73", CONFIG_HLP_SPLIT73, 0, strptr:(char **)&SPLIT73, defstrval:NULL, TYPE_STRING, sizeof(SPLIT73)},\ @@ -144,7 +150,9 @@ extern "C" {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \ {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \ {"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \ + {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ + {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \ } @@ -153,23 +161,22 @@ extern "C" #define CONFIG_HLP_LOGV "Set the global log verbosity \n" #define CONFIG_HLP_TELN "Start embedded telnet server \n" #define CONFIG_HLP_MSC "Enable the MSC tracing utility \n" -/*----------------------------------------------------------------------------------------------------------------------------*/ -/* command line parameters for LOG utility */ -/* optname helpstr paramflags XXXptr defXXXval type numelt */ -/*----------------------------------------------------------------------------------------------------------------------------*/ +#define CONFIG_FLOG_OPT "R" +#define CONFIG_LOGL_OPT "g" +/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* command line parameters for LOG utility */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ #define START_MSC softmodem_params.start_msc #define CMDLINE_LOGPARAMS_DESC { \ - {"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ - {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ - {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ - {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ - {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \ + {CONFIG_FLOG_OPT , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ + {CONFIG_LOGL_OPT , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ + {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ + {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ + {"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \ + {"telnetclt", NULL, 0, uptr:&start_telnetclt, defstrval:NULL, TYPE_UINT, 0}, \ } -#define CMDLINE_ONLINELOG_IDX 0 -#define CMDLINE_GLOGLEVEL_IDX 1 -#define CMDLINE_GLOGVERBO_IDX 2 -#define CMDLINE_STARTTELN_IDX 3 /* check function for global log level */ #define CMDLINE_LOGPARAMS_CHECK_DESC { \ @@ -178,6 +185,7 @@ extern "C" { .s5= {NULL} } , \ { .s5= {NULL} } , \ { .s5= {NULL} } , \ + { .s5= {NULL} } , \ } /***************************************************************************************************************************************/ @@ -188,8 +196,9 @@ extern "C" #define SOFTMODEM_RFSIM_BIT (1<<10) #define SOFTMODEM_BASICSIM_BIT (1<<11) #define SOFTMODEM_SIML1_BIT (1<<12) -#define SOFTMODEM_DOFORMS_BIT (1<<15) +#define SOFTMODEM_DOSCOPE_BIT (1<<15) #define SOFTMODEM_RECPLAY_BIT (1<<16) +#define SOFTMODEM_TELNETCLT_BIT (1<<17) #define SOFTMODEM_ENB_BIT (1<<20) #define SOFTMODEM_GNB_BIT (1<<21) #define SOFTMODEM_4GUE_BIT (1<<22) @@ -204,8 +213,9 @@ extern "C" #define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT) #define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT) #define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT) -#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT) +#define IS_SOFTMODEM_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_BIT) #define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT) +#define IS_SOFTMODEM_TELNETCLT_BIT ( get_softmodem_optmask() & SOFTMODEM_TELNETCLT_BIT) #define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT) #define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT) #define IS_SOFTMODEM_4GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT) @@ -233,6 +243,7 @@ typedef struct { uint32_t send_dmrs_sync; int use_256qam_table; uint8_t nfapi; + int non_stop; } softmodem_params_t; extern uint64_t get_softmodem_optmask(void); @@ -244,6 +255,7 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr); extern void set_softmodem_sighandler(void); extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; +extern int usrp_tx_thread; extern uint16_t sl_ahead; extern uint16_t sf_ahead; extern volatile int oai_exit; diff --git a/executables/thread-common.h b/executables/thread-common.h index 6f3af3cfc0..0aaeb3c30e 100644 --- a/executables/thread-common.h +++ b/executables/thread-common.h @@ -3,7 +3,7 @@ #include "PHY/defs_common.h" -THREAD_STRUCT thread_struct; +extern THREAD_STRUCT thread_struct; static inline void set_parallel_conf(char *parallel_conf) { mapping config[]= { diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index e744fcbb24..a2d2a2863e 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -73,7 +73,6 @@ extern pthread_mutex_t nfapi_sync_mutex; extern int nfapi_sync_var; extern int sync_var; -char uecap_xer_in; extern void init_eNB_afterRU(void); extern void init_UE_stub(int nb_inst,int,int); @@ -2202,7 +2201,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add pnf.phys[0].udp.tx_port = vnf_p7_port; strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr); strcpy(pnf.phys[0].local_addr, pnf_ip_addr); - printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n", + printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n", __FUNCTION__,config->vnf_ip_addr, config->vnf_p5_port, pnf.phys[0].local_addr, pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port, @@ -2253,7 +2252,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, pnf.phys[0].udp.tx_port = vnf_p7_port; strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr); strcpy(pnf.phys[0].local_addr, pnf_ip_addr); - printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n", + printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n", __FUNCTION__, config->vnf_ip_addr, config->vnf_p5_port, pnf.phys[0].local_addr, diff --git a/nfapi/oai_integration/nfapi_pnf.h b/nfapi/oai_integration/nfapi_pnf.h index b3ab7cbdbc..61d4847eba 100644 --- a/nfapi/oai_integration/nfapi_pnf.h +++ b/nfapi/oai_integration/nfapi_pnf.h @@ -21,6 +21,7 @@ #if !defined(NFAPI_PNF_H__) #define NFAPI_PNF_H__ +extern nfapi_ue_release_request_body_t release_rntis; int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind); void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 485f17922f..7bbe51f3f0 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -239,6 +239,18 @@ void oai_enb_init(void) { void oai_create_gnb(void) { int bodge_counter=0; + + if (RC.gNB == NULL) { + RC.gNB = (PHY_VARS_gNB **) calloc(1, sizeof(PHY_VARS_gNB *)); + LOG_I(PHY,"gNB L1 structure RC.gNB allocated @ %p\n",RC.gNB); + } + + + if (RC.gNB[0] == NULL) { + RC.gNB[0] = (PHY_VARS_gNB *) calloc(1, sizeof(PHY_VARS_gNB)); + LOG_I(PHY,"[nr-gnb.c] gNB structure RC.gNB[%d] allocated @ %p\n",0,RC.gNB[0]); + } + PHY_VARS_gNB *gNB = RC.gNB[0]; RC.nb_nr_CC = (int *)malloc(sizeof(int)); // TODO: find a better function to place this in diff --git a/nfapi/open-nFAPI/common/src/debug.c b/nfapi/open-nFAPI/common/src/debug.c index a45d41d7d7..f53be43223 100644 --- a/nfapi/open-nFAPI/common/src/debug.c +++ b/nfapi/open-nFAPI/common/src/debug.c @@ -1,76 +1,76 @@ -/* - * Copyright 2017 Cisco Systems, Inc. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define MAX_MSG_LENGTH 2096 -#define TRACE_HEADER_LENGTH 44 - -void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...); - -// initialize the trace function to 0 -void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg; - -nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO; -//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN; - -void nfapi_set_trace_level(nfapi_trace_level_t new_level) -{ - nfapi_trace_level_g = new_level; -} - -void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...) -{ - char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH]; - uint32_t num_chars; - va_list p_args; - struct timeval tv; - pthread_t tid = pthread_self(); - - (void)gettimeofday(&tv, NULL); - - num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid); - - if (num_chars > TRACE_HEADER_LENGTH) - { - printf("trace_dbg: Error, num_chars is too large: %d", num_chars); - return; - } - - va_start(p_args, format); - if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args))) - { - if (level <= NFAPI_TRACE_WARN) - { - printf("%s", trace_buff); - } - printf("%s", trace_buff); - } - va_end(p_args); -} +/* + * Copyright 2017 Cisco Systems, Inc. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define MAX_MSG_LENGTH 2096 +#define TRACE_HEADER_LENGTH 44 + +void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...); + +// initialize the trace function to 0 +void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg; + +nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO; +//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN; + +void nfapi_set_trace_level(nfapi_trace_level_t new_level) +{ + nfapi_trace_level_g = new_level; +} + +void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...) +{ + char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH]; + uint32_t num_chars; + va_list p_args; + struct timeval tv; + pthread_t tid = pthread_self(); + + (void)gettimeofday(&tv, NULL); + + num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid); + + if (num_chars > TRACE_HEADER_LENGTH) + { + printf("trace_dbg: Error, num_chars is too large: %u", num_chars); + return; + } + + va_start(p_args, format); + if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args))) + { + if (level <= NFAPI_TRACE_WARN) + { + printf("%s", trace_buff); + } + printf("%s", trace_buff); + } + va_end(p_args); +} diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 9df9be4cbd..0436f92a8d 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -972,7 +972,7 @@ typedef struct typedef struct { - uint32_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm) + int ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm) uint8_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload uint8_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3 @@ -1058,12 +1058,6 @@ typedef struct { fapi_nr_tdd_table_t tdd_table; fapi_nr_prach_config_t prach_config; - fapi_nr_dl_bwp_common_config_t dl_bwp_common; - fapi_nr_dl_bwp_dedicated_config_t dl_bwp_dedicated; - - fapi_nr_ul_bwp_common_config_t ul_bwp_common; - fapi_nr_ul_bwp_dedicated_config_t ul_bwp_dedicated; - } fapi_nr_config_request_t; #endif diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index bc5e7af45f..bcb0a94ca8 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -357,7 +357,7 @@ typedef struct //table 3-23 typedef struct { - nfapi_uint32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm) + nfapi_int32_tlv_t ss_pbch_power;//SSB Block Power Value: TBD (-60..50 dBm) nfapi_uint8_tlv_t bch_payload;//Defines option selected for generation of BCH payload, see Table 3-13 (v0.0.011 Value: 0: MAC generates the full PBCH payload 1: PHY generates the timing PBCH bits 2: PHY generates the full PBCH payload nfapi_uint8_tlv_t scs_common;//subcarrierSpacing for common, used for initial access and broadcast message. [38.211 sec 4.2] Value:0->3 @@ -398,13 +398,13 @@ typedef struct { nfapi_uint32_tlv_t ssb_mask;//Bitmap for actually transmitted SSB. MSB->LSB of first 32 bit number corresponds to SSB 0 to SSB 31 MSB->LSB of second 32 bit number corresponds to SSB 32 to SSB 63 Value for each bit: 0: not transmitted 1: transmitted -} nfapi_nr_ssb_mask_size_2_t; +} nfapi_nr_ssb_mask_list_t; typedef struct { - nfapi_uint8_tlv_t beam_id[64];//BeamID for each SSB in SsbMask. For example, if SSB mask bit 26 is set to 1, then BeamId[26] will be used to indicate beam ID of SSB 26. Value: from 0 to 63 + nfapi_uint8_tlv_t beam_id;//BeamID for each SSB in SsbMask. For example, if SSB mask bit 26 is set to 1, then BeamId[26] will be used to indicate beam ID of SSB 26. Value: from 0 to 63 -} nfapi_nr_ssb_mask_size_64_t; +} nfapi_nr_ssb_beam_id_list_t; typedef struct { @@ -413,8 +413,8 @@ typedef struct nfapi_uint8_tlv_t ssb_period;//SSB periodicity in msec Value: 0: ms5 1: ms10 2: ms20 3: ms40 4: ms80 5: ms160 nfapi_uint8_tlv_t ssb_subcarrier_offset;//ssbSubcarrierOffset or 𝑘𝑆𝑆𝐵 (38.211, section 7.4.3.1) Value: 0->31 nfapi_uint32_tlv_t MIB;//MIB payload, where the 24 MSB are used and represent the MIB in [38.331 MIB IE] and represent 0 1 2 3 1 , , , ,..., A− a a a a a [38.212, sec 7.1.1] - nfapi_nr_ssb_mask_size_2_t ssb_mask_list[2]; - nfapi_nr_ssb_mask_size_64_t* ssb_beam_id_list;//64 + nfapi_nr_ssb_mask_list_t ssb_mask_list[2]; + nfapi_nr_ssb_beam_id_list_t ssb_beam_id_list[64]; nfapi_uint8_tlv_t ss_pbch_multiple_carriers_in_a_band;//0 = disabled 1 = enabled nfapi_uint8_tlv_t multiple_cells_ss_pbch_in_a_carrier;//Indicates that multiple cells will be supported in a single carrier 0 = disabled 1 = enabled @@ -678,7 +678,7 @@ typedef struct { } nfapi_nr_slot_indication_scf_t; -// 3.4.2 +// 3.4.2 //for pdcch_pdu: @@ -691,11 +691,10 @@ typedef struct typedef struct { uint16_t pm_idx;//Index to precoding matrix (PM) pre-stored at cell configuration. Note: If precoding is not used this parameter should be set to 0. Value: 0->65535. - nfapi_nr_dig_bf_interface_t* dig_bf_interface_list; + nfapi_nr_dig_bf_interface_t dig_bf_interface_list[1];//max dig_bf_interfaces }nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t; -/* //table 3-43 typedef struct { @@ -703,23 +702,10 @@ typedef struct uint16_t prg_size;//Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275 //watchout: dig_bf_interfaces here, in table 3-53 it's dig_bf_interface uint8_t dig_bf_interfaces;//Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255 - nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t* prgs_list;// + nfapi_nr_tx_precoding_and_beamforming_number_of_prgs_t prgs_list[1];//max prg_size }nfapi_nr_tx_precoding_and_beamforming_t; -*/ -typedef struct { - /// Number of PRGs spanning this allocation. Value : 1->275 - uint16_t numPRGs; - /// Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275 - uint16_t prgSize; - /// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255 - uint8_t digBFInterfaces; - // Depends on numPRGs - uint16_t PMIdx[275]; - // Depends on digBFInterfaces - uint16_t beamIdx[256]; -} nfapi_nr_tx_precoding_and_beamforming_t; //table 3-37 @@ -755,16 +741,6 @@ typedef struct { } nfapi_nr_dl_dci_pdu_t; -typedef struct { - /// Number of PRGs spanning this allocation. Value : 1->275 - uint16_t numPRGs; - /// Size in RBs of a precoding resource block group (PRG) – to which same precoding and digital beamforming gets applied. Value: 1->275 - uint16_t prgSize; - /// Number of STD ant ports (parallel streams) feeding into the digBF Value: 0->255 - uint8_t digBFInterfaces; - uint16_t PMIdx[275]; - uint16_t *beamIdx[275]; -} nr_beamforming_t; typedef struct { ///Bandwidth part size [TS38.213 sec12]. Number of contiguous PRBs allocated to the BWP,Value: 1->275 @@ -1028,7 +1004,7 @@ typedef struct { typedef struct { uint16_t PDUType; - uint16_t PDUSize; + uint32_t PDUSize; union { nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu; diff --git a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c index 5f8e6b52b4..8f6a736a14 100755 --- a/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c +++ b/nfapi/open-nFAPI/nfapi/src/nfapi_p7.c @@ -1,8271 +1,8271 @@ -/* - * Copyright 2017 Cisco Systems, Inc. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "nfapi_nr_interface_scf.h" - -extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data); -extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data); - -uint32_t nfapi_calculate_checksum(uint8_t* buffer, uint16_t len) -{ - uint32_t chksum = 0; - // calcaulte upto the checksum - chksum = crc32(chksum, buffer, 8); - - // skip the checksum - uint8_t zeros[4] = {0, 0, 0, 0}; - chksum = crc32(chksum, zeros, 4); - - // continu with the rest of the mesage - chksum = crc32(chksum, &buffer[NFAPI_P7_HEADER_LENGTH], len - NFAPI_P7_HEADER_LENGTH); - - // return the inverse - return ~(chksum); -} - -int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len) -{ - uint32_t checksum = nfapi_calculate_checksum(buffer, len); - - uint8_t* p_write = &buffer[8]; - return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1); -} - -int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp) -{ - uint8_t* p_write = &buffer[12]; - return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1); -} - -uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len) -{ - return nfapi_calculate_checksum(buffer, len); -} - -void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config) -{ - if(size == 0) - return 0; - - void* buffer_p = NULL; - if(config && config->allocate) - { - buffer_p = (config->allocate)(size); - if(buffer_p != NULL){ - memset(buffer_p,0,size); - } - return buffer_p; - } - else - { - buffer_p = calloc(1, size); - return buffer_p; - } -} - -void nfapi_p7_deallocate(void* ptr, nfapi_p7_codec_config_t* config) -{ - if(ptr == NULL) - return; - - if(config && config->deallocate) - { - return (config->deallocate)(ptr); - } - else - { - return free(ptr); - } -} -// Pack routines - - -static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv; - - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format); - - return ( push8(value->dci_format, ppWritePackedMsg, end) && - push8(value->cce_idx, ppWritePackedMsg, end) && - push8(value->aggregation_level, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->resource_allocation_type, ppWritePackedMsg, end) && - push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && - push32(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->mcs_1, ppWritePackedMsg, end) && - push8(value->redundancy_version_1, ppWritePackedMsg, end) && - push8(value->new_data_indicator_1, ppWritePackedMsg, end) && - push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && - push8(value->mcs_2, ppWritePackedMsg, end) && - push8(value->redundancy_version_2, ppWritePackedMsg, end) && - push8(value->new_data_indicator_2, ppWritePackedMsg, end) && - push8(value->harq_process, ppWritePackedMsg, end) && - push8(value->tpmi, ppWritePackedMsg, end) && - push8(value->pmi, ppWritePackedMsg, end) && - push8(value->precoding_information, ppWritePackedMsg, end) && - push8(value->tpc, ppWritePackedMsg, end) && - push8(value->downlink_assignment_index, ppWritePackedMsg, end) && - push8(value->ngap, ppWritePackedMsg, end) && - push8(value->transport_block_size_index, ppWritePackedMsg, end) && - push8(value->downlink_power_offset, ppWritePackedMsg, end) && - push8(value->allocate_prach_flag, ppWritePackedMsg, end) && - push8(value->preamble_index, ppWritePackedMsg, end) && - push8(value->prach_mask_index, ppWritePackedMsg, end) && - push8(value->rnti_type, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_dci_dl_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel9_t* value = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv; - - return( push8(value->mcch_flag, ppWritePackedMsg, end) && - push8(value->mcch_change_notification, ppWritePackedMsg, end) && - push8(value->scrambling_identity, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_dci_dl_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel10_t* value = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv; - - return ( push8(value->cross_carrier_scheduling_flag, ppWritePackedMsg, end) && - push8(value->carrier_indicator, ppWritePackedMsg, end) && - push8(value->srs_flag, ppWritePackedMsg, end) && - push8(value->srs_request, ppWritePackedMsg, end) && - push8(value->antenna_ports_scrambling_and_layers, ppWritePackedMsg, end) && - push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) && - push8(value->n_dl_rb, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_dci_dl_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel11_t* value = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv; - - return ( push8(value->harq_ack_resource_offset, ppWritePackedMsg, end) && - push8(value->pdsch_re_mapping_quasi_co_location_indicator, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_dci_dl_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel12_t* value = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv; - - return ( push8(value->primary_cell_type, ppWritePackedMsg, end) && - push8(value->ul_dl_configuration_flag, ppWritePackedMsg, end) && - push8(value->number_ul_dl_configurations, ppWritePackedMsg, end) && - pusharray8(value->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, value->number_ul_dl_configurations, ppWritePackedMsg, end)); -} - -static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t* value, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - if (!( push8(value->num_prb_per_subband, ppWritePackedMsg, end) && - push8(value->number_of_subbands, ppWritePackedMsg, end) && - push8(value->num_antennas, ppWritePackedMsg, end))) - return 0; - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_subbands; ++idx) - { - nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]); - - if(!(push8(subband_info->subband_index, ppWritePackedMsg, end) && - push8(subband_info->scheduled_ues, ppWritePackedMsg, end))) - return 0; - - - uint8_t antenna_idx = 0; - uint8_t scheduled_ue_idx = 0; - - for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx) - { - for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx) - { - if(!push16(subband_info->precoding_value[antenna_idx][scheduled_ue_idx], ppWritePackedMsg, end)) - return 0; - } - } - - } - - - return 1; - -} - - -static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv; - - return( - push16(value->bwp_size, ppWritePackedMsg, end) && - push16(value->bwp_start, ppWritePackedMsg, end) && - - push8(value->subcarrier_spacing, ppWritePackedMsg, end) && - push8(value->cyclic_prefix, ppWritePackedMsg, end) && - - push16(value->start_rb, ppWritePackedMsg, end) && - push16(value->nr_of_rbs, ppWritePackedMsg, end) && - - push8(value->csi_type, ppWritePackedMsg, end) && - push8(value->row, ppWritePackedMsg, end) && - - push16(value->freq_domain, ppWritePackedMsg, end) && - push8(value->symb_l0, ppWritePackedMsg, end) && - - push8(value->symb_l1, ppWritePackedMsg, end) && - push8(value->cdm_type, ppWritePackedMsg, end) && - - push8(value->freq_density, ppWritePackedMsg, end) && - push16(value->scramb_id, ppWritePackedMsg, end) && - - push8(value->power_control_offset, ppWritePackedMsg, end) && - push8(value->power_control_offset_ss, ppWritePackedMsg, end) - ); - -} - - -static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv; - - for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) - { - if(!(push16(value->dci_pdu[i].RNTI, ppWritePackedMsg, end) && - push16(value->dci_pdu[i].ScramblingId, ppWritePackedMsg, end) && - - push16(value->dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) && - push8(value->dci_pdu[i].CceIndex, ppWritePackedMsg, end) && - push8(value->dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) && - push8(value->dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) && - - push8(value->dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) && - push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) && - pusharray8(value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end))) - return 0; - - } - - // TODO: resolve the packaging of array (currently sending a single element) - return( - push16(value->BWPSize, ppWritePackedMsg, end) && - push16(value->BWPStart, ppWritePackedMsg, end) && - push8(value->SubcarrierSpacing, ppWritePackedMsg, end) && - push8(value->CyclicPrefix, ppWritePackedMsg, end) && - - push8(value->StartSymbolIndex, ppWritePackedMsg, end) && - push8(value->DurationSymbols, ppWritePackedMsg, end) && - pusharray8(value->FreqDomainResource, 6, 6, ppWritePackedMsg, end) && - push8(value->CceRegMappingType, ppWritePackedMsg, end) && - - push8(value->RegBundleSize, ppWritePackedMsg, end) && - push8(value->InterleaverSize, ppWritePackedMsg, end) && - push8(value->CoreSetType, ppWritePackedMsg, end) && - push16(value->ShiftIndex, ppWritePackedMsg, end) && - - push8(value->precoderGranularity, ppWritePackedMsg, end) && - push16(value->numDlDci, ppWritePackedMsg, end)); - -} - - -static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv; - - // TODO: resolve the packaging of array (currently sending a single element) - return( - push16(value->pduBitmap, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push16(value->pduIndex, ppWritePackedMsg, end) && - push16(value->BWPSize, ppWritePackedMsg, end) && - - push16(value->BWPStart, ppWritePackedMsg, end) && - push8(value->SubcarrierSpacing, ppWritePackedMsg, end) && - push8(value->CyclicPrefix, ppWritePackedMsg, end) && - push8(value->NrOfCodewords, ppWritePackedMsg, end) && - - pusharray16(value->targetCodeRate, 2, 1, ppWritePackedMsg, end) && - pusharray8(value->qamModOrder, 2, 1, ppWritePackedMsg, end) && - pusharray8(value->mcsIndex, 2, 1, ppWritePackedMsg, end) && - pusharray8(value->mcsTable, 2, 1, ppWritePackedMsg, end) && - - pusharray8(value->rvIndex, 2, 1, ppWritePackedMsg, end) && - pusharray32(value->TBSize, 2, 1, ppWritePackedMsg, end) && - push16(value->dataScramblingId, ppWritePackedMsg, end) && - push8(value->nrOfLayers, ppWritePackedMsg, end) && - - push8(value->transmissionScheme, ppWritePackedMsg, end) && - push8(value->refPoint, ppWritePackedMsg, end) && - push16(value->dlDmrsSymbPos, ppWritePackedMsg, end) && - push8(value->dmrsConfigType, ppWritePackedMsg, end) && - - push16(value->dlDmrsScramblingId, ppWritePackedMsg, end) && - push8(value->SCID, ppWritePackedMsg, end) && - push8(value->numDmrsCdmGrpsNoData, ppWritePackedMsg, end) && - push16(value->dmrsPorts, ppWritePackedMsg, end) && - - push8(value->resourceAlloc, ppWritePackedMsg, end) && - push16(value->rbStart, ppWritePackedMsg, end) && - push16(value->rbSize, ppWritePackedMsg, end) && - - push8(value->VRBtoPRBMapping, ppWritePackedMsg, end) && - push8(value->StartSymbolIndex, ppWritePackedMsg, end) && - push8(value->NrOfSymbols, ppWritePackedMsg, end) && - push8(value->PTRSPortIndex, ppWritePackedMsg, end) && - - push8(value->PTRSTimeDensity, ppWritePackedMsg, end) && - push8(value->PTRSFreqDensity, ppWritePackedMsg, end) && - push8(value->PTRSReOffset, ppWritePackedMsg, end) - ); - -} - - -static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - printf("Packing ssb. \n"); - nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv; - - return( - push16(value->PhysCellId, ppWritePackedMsg, end) && - push8(value->BetaPss, ppWritePackedMsg, end) && - push8(value->SsbBlockIndex, ppWritePackedMsg, end) && - push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) && - push16(value->ssbOffsetPointA, ppWritePackedMsg, end) && - push8(value->bchPayloadFlag, ppWritePackedMsg, end) && - push32(value->bchPayload, ppWritePackedMsg, end) - // TODO: pack precoding_and_beamforming too - ); - -} - - -static uint8_t pack_dl_config_dci_dl_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel13_t* value = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv; - - return( push8(value->laa_end_partial_sf_flag, ppWritePackedMsg, end) && - push8(value->laa_end_partial_sf_configuration, ppWritePackedMsg, end) && - push8(value->initial_lbt_sf, ppWritePackedMsg, end) && - push8(value->codebook_size_determination, ppWritePackedMsg, end) && - push8(value->drms_table_flag, ppWritePackedMsg, end) && - push8(value->tpm_struct_flag, ppWritePackedMsg, end) && - (value->tpm_struct_flag == 1 ? pack_tpm_value(&(value->tpm), ppWritePackedMsg, end) : 1)); -} - -static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv; - - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__); - - return( push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_mch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_mch_pdu_rel8_t* value = (nfapi_dl_config_mch_pdu_rel8_t*)tlv; - - return ( push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->resource_allocation_type, ppWritePackedMsg, end) && - push32(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->modulation, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push16(value->mbsfn_area_id, ppWritePackedMsg, end)); -} - -static uint8_t pack_bf_vector_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_bf_vector_t* bf = (nfapi_bf_vector_t*)elem; - - return ( push8(bf->subband_index, ppWritePackedMsg, end) && - push8(bf->num_antennas, ppWritePackedMsg, end) && - pusharray16(bf->bf_value, NFAPI_MAX_NUM_ANTENNAS, bf->num_antennas, ppWritePackedMsg, end)); - - -} -static uint8_t pack_dl_config_dlsch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel8_t* value = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv; - - return ( push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->resource_allocation_type, ppWritePackedMsg, end) && - push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && - push32(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->modulation, ppWritePackedMsg, end) && - push8(value->redundancy_version, ppWritePackedMsg, end) && - push8(value->transport_blocks, ppWritePackedMsg, end) && - push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && - push8(value->transmission_scheme, ppWritePackedMsg, end) && - push8(value->number_of_layers, ppWritePackedMsg, end) && - push8(value->number_of_subbands, ppWritePackedMsg, end) && - pusharray8(value->codebook_index, NFAPI_MAX_NUM_SUBBANDS, value->number_of_subbands, ppWritePackedMsg, end) && - push8(value->ue_category_capacity, ppWritePackedMsg, end) && - push8(value->pa, ppWritePackedMsg, end) && - push8(value->delta_power_offset_index, ppWritePackedMsg, end) && - push8(value->ngap, ppWritePackedMsg, end) && - push8(value->nprb, ppWritePackedMsg, end) && - push8(value->transmission_mode, ppWritePackedMsg, end) && - push8(value->num_bf_prb_per_subband, ppWritePackedMsg, end) && - push8(value->num_bf_vector, ppWritePackedMsg, end) && - packarray(value->bf_vector, sizeof(nfapi_bf_vector_t), NFAPI_MAX_BF_VECTORS, value->num_bf_vector, ppWritePackedMsg, end, &pack_bf_vector_info)); - -} -static uint8_t pack_dl_config_dlsch_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel9_t* value = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv; - return ( push8(value->nscid, ppWritePackedMsg, end) ); -} -static uint8_t pack_dl_config_dlsch_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel10_t* value = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv; - - return ( push8(value->csi_rs_flag, ppWritePackedMsg, end) && - push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) && - push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) && - push8(value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) && - pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) && - push8(value->pdsch_start, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_dlsch_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel11_t* value = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv; - - return( push8(value->drms_config_flag, ppWritePackedMsg, end) && - push16(value->drms_scrambling, ppWritePackedMsg, end) && - push8(value->csi_config_flag, ppWritePackedMsg, end) && - push16(value->csi_scrambling, ppWritePackedMsg, end) && - push8(value->pdsch_re_mapping_flag, ppWritePackedMsg, end) && - push8(value->pdsch_re_mapping_atenna_ports, ppWritePackedMsg, end) && - push8(value->pdsch_re_mapping_freq_shift, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_dlsch_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel12_t* value = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv; - - return( push8(value->altcqi_table_r12, ppWritePackedMsg, end) && - push8(value->maxlayers, ppWritePackedMsg, end) && - push8(value->n_dl_harq, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_dlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel13_t* value = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv; - - return( push8(value->dwpts_symbols, ppWritePackedMsg, end) && - push8(value->initial_lbt_sf, ppWritePackedMsg, end) && - push8(value->ue_type, ppWritePackedMsg, end) && - push8(value->pdsch_payload_type, ppWritePackedMsg, end) && - push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) && - push8(value->drms_table_flag, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_pch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_pch_pdu_rel8_t* value = (nfapi_dl_config_pch_pdu_rel8_t*)tlv; - - return( push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->p_rnti, ppWritePackedMsg, end) && - push8(value->resource_allocation_type, ppWritePackedMsg, end) && - push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && - push32(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->mcs, ppWritePackedMsg, end) && - push8(value->redundancy_version, ppWritePackedMsg, end) && - push8(value->number_of_transport_blocks, ppWritePackedMsg, end) && - push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && - push8(value->transmission_scheme, ppWritePackedMsg, end) && - push8(value->number_of_layers, ppWritePackedMsg, end) && - push8(value->codebook_index, ppWritePackedMsg, end) && - push8(value->ue_category_capacity, ppWritePackedMsg, end) && - push8(value->pa, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push8(value->nprb, ppWritePackedMsg, end) && - push8(value->ngap, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_pch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_pch_pdu_rel13_t* value = (nfapi_dl_config_pch_pdu_rel13_t*)tlv; - - return ( push8(value->ue_mode, ppWritePackedMsg, end) && - push16(value->initial_transmission_sf_io, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_prs_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_prs_pdu_rel9_t* value = (nfapi_dl_config_prs_pdu_rel9_t*)tlv; - - return( push16(value->transmission_power, ppWritePackedMsg, end) && - push8(value->prs_bandwidth, ppWritePackedMsg, end) && - push8(value->prs_cyclic_prefix_type, ppWritePackedMsg, end) && - push8(value->prs_muting, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_csi_rs_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_csi_rs_pdu_rel10_t* value = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv; - - return( push8(value->csi_rs_antenna_port_count_r10, ppWritePackedMsg, end) && - push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) && - push8(value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end) && - pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_csi_rs_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_csi_rs_pdu_rel13_t* value = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv; - - if(!(push8(value->csi_rs_class, ppWritePackedMsg, end) && - push8(value->cdm_type, ppWritePackedMsg, end) && - push8(value->num_bf_vector, ppWritePackedMsg, end))) - { - return 0; - } - - uint16_t i; - for(i = 0; i < value->num_bf_vector; ++i) - { - if(!(push8(value->bf_vector[i].csi_rs_resource_index, ppWritePackedMsg, end) && - pusharray16(value->bf_vector[i].bf_value, NFAPI_MAX_ANTENNA_PORT_COUNT, NFAPI_MAX_ANTENNA_PORT_COUNT, ppWritePackedMsg, end))) - return 0; - } - - return 1; -} -static uint8_t pack_bf_vector(nfapi_bf_vector_t* vector, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(vector->subband_index, ppWritePackedMsg, end) && - push8(vector->num_antennas, ppWritePackedMsg, end) && - pusharray16(vector->bf_value, NFAPI_MAX_NUM_ANTENNAS, vector->num_antennas, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_epdcch_parameters_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_epdcch_parameters_rel11_t* value = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv; - - return ( push8(value->epdcch_resource_assignment_flag, ppWritePackedMsg, end) && - push16(value->epdcch_id, ppWritePackedMsg, end) && - push8(value->epdcch_start_symbol, ppWritePackedMsg, end) && - push8(value->epdcch_num_prb, ppWritePackedMsg, end) && - pusharray8(value->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, value->epdcch_num_prb, ppWritePackedMsg, end) && - pack_bf_vector(&value->bf_vector, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_epdcch_parameters_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_epdcch_parameters_rel13_t* value = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv; - - return (push8(value->dwpts_symbols, ppWritePackedMsg, end) && - push8(value->initial_lbt_sf, ppWritePackedMsg, end)); -} -static uint8_t pack_dl_config_mpdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_mpdcch_pdu_rel13_t* value = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv; - - return ( push8(value->mpdcch_narrow_band, ppWritePackedMsg, end) && - push8(value->number_of_prb_pairs, ppWritePackedMsg, end) && - push8(value->resource_block_assignment, ppWritePackedMsg, end) && - push8(value->mpdcch_tansmission_type, ppWritePackedMsg, end) && - push8(value->start_symbol, ppWritePackedMsg, end) && - push8(value->ecce_index, ppWritePackedMsg, end) && - push8(value->aggregation_level, ppWritePackedMsg, end) && - push8(value->rnti_type, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->ce_mode, ppWritePackedMsg, end) && - push16(value->drms_scrambling_init, ppWritePackedMsg, end) && - push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push8(value->dci_format, ppWritePackedMsg, end) && - push16(value->resource_block_coding, ppWritePackedMsg, end) && - push8(value->mcs, ppWritePackedMsg, end) && - push8(value->pdsch_reptition_levels, ppWritePackedMsg, end) && - push8(value->redundancy_version, ppWritePackedMsg, end) && - push8(value->new_data_indicator, ppWritePackedMsg, end) && - push8(value->harq_process, ppWritePackedMsg, end) && - push8(value->tpmi_length, ppWritePackedMsg, end) && - push8(value->tpmi, ppWritePackedMsg, end) && - push8(value->pmi_flag, ppWritePackedMsg, end) && - push8(value->pmi, ppWritePackedMsg, end) && - push8(value->harq_resource_offset, ppWritePackedMsg, end) && - push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) && - push8(value->tpc, ppWritePackedMsg, end) && - push8(value->downlink_assignment_index_length, ppWritePackedMsg, end) && - push8(value->downlink_assignment_index, ppWritePackedMsg, end) && - push8(value->allocate_prach_flag, ppWritePackedMsg, end) && - push8(value->preamble_index, ppWritePackedMsg, end) && - push8(value->prach_mask_index, ppWritePackedMsg, end) && - push8(value->starting_ce_level, ppWritePackedMsg, end) && - push8(value->srs_request, ppWritePackedMsg, end) && - push8(value->antenna_ports_and_scrambling_identity_flag, ppWritePackedMsg, end) && - push8(value->antenna_ports_and_scrambling_identity, ppWritePackedMsg, end) && - push8(value->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && - push8(value->paging_direct_indication_differentiation_flag, ppWritePackedMsg, end) && - push8(value->direct_indication, ppWritePackedMsg, end) && - push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) && - push8(value->number_of_tx_antenna_ports, ppWritePackedMsg, end) && - pusharray16(value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, ppWritePackedMsg, end)); -} - - -static uint8_t pack_dl_config_nbch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_nbch_pdu_rel13_t* value = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv; - - return (push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push16(value->transmission_power, ppWritePackedMsg, end) && - push16(value->hyper_sfn_2_lsbs, ppWritePackedMsg, end)); -} - - -static uint8_t pack_dl_config_npdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_npdcch_pdu_rel13_t* value = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv; - - return (push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push8(value->ncce_index, ppWritePackedMsg, end) && - push8(value->aggregation_level, ppWritePackedMsg, end) && - push8(value->start_symbol, ppWritePackedMsg, end) && - push8(value->rnti_type, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push8(value->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) && - push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) && - push8(value->dci_format, ppWritePackedMsg, end) && - push8(value->scheduling_delay, ppWritePackedMsg, end) && - push8(value->resource_assignment, ppWritePackedMsg, end) && - push8(value->repetition_number, ppWritePackedMsg, end) && - push8(value->mcs, ppWritePackedMsg, end) && - push8(value->new_data_indicator, ppWritePackedMsg, end) && - push8(value->harq_ack_resource, ppWritePackedMsg, end) && - push8(value->npdcch_order_indication, ppWritePackedMsg, end) && - push8(value->starting_number_of_nprach_repetitions, ppWritePackedMsg, end) && - push8(value->subcarrier_indication_of_nprach, ppWritePackedMsg, end) && - push8(value->paging_direct_indication_differentation_flag, ppWritePackedMsg, end) && - push8(value->direct_indication, ppWritePackedMsg, end) && - push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) && - push8(value->total_dci_length_including_padding, ppWritePackedMsg, end)); -} - -static uint8_t pack_dl_config_ndlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_ndlsch_pdu_rel13_t* value = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv; - - return (push16(value->length, ppWritePackedMsg, end) && - push16(value->pdu_index, ppWritePackedMsg, end) && - push8(value->start_symbol, ppWritePackedMsg, end) && - push8(value->rnti_type, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) && - push16(value->resource_assignment, ppWritePackedMsg, end) && - push16(value->repetition_number, ppWritePackedMsg, end) && - push8(value->modulation, ppWritePackedMsg, end) && - push8(value->number_of_subframes_for_resource_assignment, ppWritePackedMsg, end) && - push8(value->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) && - push16(value->sf_idx, ppWritePackedMsg, end) && - push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end)); -} - - -static uint8_t pack_dl_tti_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)tlv; - - if(!(push16(value->PDUSize, ppWritePackedMsg, end) && - push16(value->PDUType, ppWritePackedMsg, end) )) - return 0; - - - // first match the pdu type, then call the respective function - switch(value->PDUType) - { - case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: - { - if(!(pack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppWritePackedMsg,end))) - return 0; - } - break; - - case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: - { - if(!(pack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppWritePackedMsg,end))) - return 0; - } - break; - case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: - { - if(!(pack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppWritePackedMsg,end))) - return 0; - } - break; - case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: - { - if(!(pack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppWritePackedMsg,end))) - return 0; - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType ); - } - break; - } - - return 1; -} - -static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv; - - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich); - - if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) && - push8(value->number_dci, ppWritePackedMsg, end) && - push16(value->number_pdu, ppWritePackedMsg, end) && - push8(value->number_pdsch_rnti, ppWritePackedMsg, end) && - push16(value->transmission_power_pcfich, ppWritePackedMsg, end))) - { - return 0; - } - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_pdu; - for(; i < total_number_of_pdus; ++i) - { - nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]); - - if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: - { - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__); - - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value))) - { - return 0; - } - } - break; - case NFAPI_DL_CONFIG_BCH_PDU_TYPE: - { - //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__); - - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_MCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_mch_pdu_rel8_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel8_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel9_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel10_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel11_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel12_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_PCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel8_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_PRS_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_prs_pdu_rel9_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel10_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value) && - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel11_value) & - pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_mpdcch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_nbch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_npdcch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_ndlsch_pdu_rel13_value))) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - } - - return 1; -} - - -static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg; - - if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) && - push16(pNfapiMsg->Slot , ppWritePackedMsg, end) && - push8(pNfapiMsg->dl_tti_request_body.nGroup , ppWritePackedMsg, end) && - push8(pNfapiMsg->dl_tti_request_body.nPDUs , ppWritePackedMsg, end) && - pusharray8(pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end) - //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end) - )) - return 0; - - int arr[12]; - for(int i=0;idl_tti_request_body.nGroup;i++) - { - for(int j=0;jdl_tti_request_body.nUe[i];j++) - { - arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j]; - } - if(!(pusharrays32(arr,12,pNfapiMsg->dl_tti_request_body.nUe[i],ppWritePackedMsg, end))) - return 0; - } - - for(int i=0;idl_tti_request_body.nPDUs;i++) - { - if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end)) - return 0; - } - -return 1; -} - - -static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg; - - //return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) && - //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - { - uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); - uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value); - uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - - if (!x || !y || !z) - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z); - } - - return x && y && z; - } -} - - - - -static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end) -{ - nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv; - - return( push32(ulsch_pdu_rel8->handle, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel8->size, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel8->rnti, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->modulation_type, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->new_data_indication, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->redundancy_version, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->harq_process_number, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->ul_tx_mode, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->current_tx_nb, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel8->n_srs, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_ulsch_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv; - - return (push8(ulsch_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) && - push32(ulsch_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->transport_blocks, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->transmission_scheme, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->number_of_layers, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->codebook_index, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel10->disable_sequence_hopping_flag, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_ulsch_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv; - - return (push8(ulsch_pdu_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel11->npusch_identity, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel11->dmrs_config_flag, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel11->ndmrs_csh_identity, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_ulsch_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv; - - return (push8(ulsch_pdu_rel13->ue_type, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel13->total_number_of_repetitions, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) && - push16(ulsch_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) && - push8(ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, ppWritePackedMsg, end)); -} - -//Pack fns for ul_tti PDUS - - -static uint8_t pack_ul_tti_request_prach_pdu(nfapi_nr_prach_pdu_t* prach_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return( - push16(prach_pdu->phys_cell_id, ppWritePackedMsg, end) && - push8(prach_pdu->num_prach_ocas, ppWritePackedMsg, end) && - push8(prach_pdu->prach_format, ppWritePackedMsg, end) && - push8(prach_pdu->num_ra, ppWritePackedMsg, end) && - push8(prach_pdu->prach_start_symbol, ppWritePackedMsg, end) && - push16(prach_pdu->num_cs, ppWritePackedMsg, end) - // TODO: ignoring beamforming tlv for now - ); - -} - -static uint8_t pack_ul_tti_request_pucch_pdu(nfapi_nr_pucch_pdu_t* pucch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return( - push16(pucch_pdu->rnti, ppWritePackedMsg, end) && - push32(pucch_pdu->handle, ppWritePackedMsg, end) && - push16(pucch_pdu->bwp_size, ppWritePackedMsg, end) && - push16(pucch_pdu->bwp_start, ppWritePackedMsg, end) && - push8(pucch_pdu->subcarrier_spacing, ppWritePackedMsg, end) && - push8(pucch_pdu->cyclic_prefix, ppWritePackedMsg, end) && - push8(pucch_pdu->format_type, ppWritePackedMsg, end) && - push8(pucch_pdu->multi_slot_tx_indicator, ppWritePackedMsg, end) && - push16(pucch_pdu->prb_start, ppWritePackedMsg, end) && - push16(pucch_pdu->prb_size, ppWritePackedMsg, end) && - push8(pucch_pdu->start_symbol_index, ppWritePackedMsg, end) && - push8(pucch_pdu->nr_of_symbols, ppWritePackedMsg, end) && - push8(pucch_pdu->freq_hop_flag, ppWritePackedMsg, end) && - push16(pucch_pdu->second_hop_prb, ppWritePackedMsg, end) && - push8(pucch_pdu->group_hop_flag, ppWritePackedMsg, end) && - push8(pucch_pdu->sequence_hop_flag, ppWritePackedMsg, end) && - push16(pucch_pdu->hopping_id, ppWritePackedMsg, end) && - push16(pucch_pdu->initial_cyclic_shift, ppWritePackedMsg, end) && - push16(pucch_pdu->data_scrambling_id, ppWritePackedMsg, end) && - push8(pucch_pdu->time_domain_occ_idx, ppWritePackedMsg, end) && - push8(pucch_pdu->pre_dft_occ_idx, ppWritePackedMsg, end) && - push8(pucch_pdu->pre_dft_occ_len, ppWritePackedMsg, end) && - push8(pucch_pdu->add_dmrs_flag, ppWritePackedMsg, end) && - push16(pucch_pdu->dmrs_scrambling_id, ppWritePackedMsg, end) && - push8(pucch_pdu->dmrs_cyclic_shift, ppWritePackedMsg, end) && - push8(pucch_pdu->sr_flag, ppWritePackedMsg, end) && - push8(pucch_pdu->bit_len_harq, ppWritePackedMsg, end) && - push16(pucch_pdu->bit_len_csi_part1, ppWritePackedMsg, end) && - push16(pucch_pdu->bit_len_csi_part2, ppWritePackedMsg, end) - // TODO: ignoring beamforming tlv for now - ); - -} - - -static uint8_t pack_ul_tti_request_pusch_pdu(nfapi_nr_pusch_pdu_t* pusch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - - if (!( - push16(pusch_pdu->pdu_bit_map, ppWritePackedMsg, end) && - push16(pusch_pdu->rnti, ppWritePackedMsg, end) && - push32(pusch_pdu->handle, ppWritePackedMsg, end) && - push16(pusch_pdu->bwp_size, ppWritePackedMsg, end) && - push16(pusch_pdu->bwp_start, ppWritePackedMsg, end) && - push8(pusch_pdu->subcarrier_spacing, ppWritePackedMsg, end) && - push8(pusch_pdu->cyclic_prefix, ppWritePackedMsg, end) && - push16(pusch_pdu->target_code_rate, ppWritePackedMsg, end) && - push8(pusch_pdu->qam_mod_order, ppWritePackedMsg, end) && - push8(pusch_pdu->mcs_index, ppWritePackedMsg, end) && - push8(pusch_pdu->mcs_table, ppWritePackedMsg, end) && - push8(pusch_pdu->transform_precoding, ppWritePackedMsg, end) && - push16(pusch_pdu->data_scrambling_id, ppWritePackedMsg, end) && - push8(pusch_pdu->nrOfLayers, ppWritePackedMsg, end) && - push16(pusch_pdu->ul_dmrs_symb_pos, ppWritePackedMsg, end) && - push8(pusch_pdu->dmrs_config_type, ppWritePackedMsg, end) && - push16(pusch_pdu->ul_dmrs_scrambling_id, ppWritePackedMsg, end) && - push8(pusch_pdu->scid, ppWritePackedMsg, end) && - push8(pusch_pdu->num_dmrs_cdm_grps_no_data, ppWritePackedMsg, end) && - push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) && - push8(pusch_pdu->resource_alloc, ppWritePackedMsg, end) && - push8(pusch_pdu->resource_alloc,ppWritePackedMsg, end) && - push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) && - push16(pusch_pdu->rb_start, ppWritePackedMsg, end) && - push16(pusch_pdu->rb_size, ppWritePackedMsg, end) && - push8(pusch_pdu->vrb_to_prb_mapping, ppWritePackedMsg, end) && - push8(pusch_pdu->frequency_hopping, ppWritePackedMsg, end) && - push16(pusch_pdu->tx_direct_current_location, ppWritePackedMsg, end) && - push8(pusch_pdu->uplink_frequency_shift_7p5khz, ppWritePackedMsg, end) && - push8(pusch_pdu->start_symbol_index, ppWritePackedMsg, end) && - push8(pusch_pdu->nr_of_symbols, ppWritePackedMsg, end) - // TODO: ignoring beamforming tlv for now - )) - return 0; - - - //Pack Optional Data only included if indicated in pduBitmap - switch(pusch_pdu->pdu_bit_map){ - case PUSCH_PDU_BITMAP_PUSCH_DATA: - { - // pack optional TLVs - return( - push8(pusch_pdu->pusch_data.rv_index, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_data.harq_process_id, ppWritePackedMsg, end) && - push32(pusch_pdu->pusch_data.tb_size, ppWritePackedMsg, end) && - push16(pusch_pdu->pusch_data.num_cb, ppWritePackedMsg, end) && - pusharray8(pusch_pdu->pusch_data.cb_present_and_position,1,1,ppWritePackedMsg, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_PUSCH_UCI: - { - return( - push16(pusch_pdu->pusch_uci.harq_ack_bit_length, ppWritePackedMsg, end) && - push16(pusch_pdu->pusch_uci.csi_part1_bit_length, ppWritePackedMsg, end) && - push16(pusch_pdu->pusch_uci.csi_part2_bit_length, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_uci.alpha_scaling, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_uci.beta_offset_harq_ack, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_uci.beta_offset_csi1, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_uci.beta_offset_csi2, ppWritePackedMsg, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_PUSCH_PTRS: - { - return( - push8(pusch_pdu->pusch_ptrs.num_ptrs_ports, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, ppWritePackedMsg, end) && - push16(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ptrs_time_density, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ptrs_freq_density, ppWritePackedMsg, end) && - push8(pusch_pdu->pusch_ptrs.ul_ptrs_power, ppWritePackedMsg, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_DFTS_OFDM: - { - return( - push8(pusch_pdu->dfts_ofdm.low_papr_group_number, ppWritePackedMsg, end) && - push16(pusch_pdu->dfts_ofdm.low_papr_sequence_number, ppWritePackedMsg, end) && - push8(pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, ppWritePackedMsg, end) && - push8(pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, ppWritePackedMsg, end) - ); - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map ); - } - } - - return 1; -} - -static uint8_t pack_ul_tti_request_srs_pdu(nfapi_nr_srs_pdu_t* srs_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return( - push16(srs_pdu->rnti, ppWritePackedMsg, end) && - push32(srs_pdu->handle, ppWritePackedMsg, end) && - push16(srs_pdu->bwp_size, ppWritePackedMsg, end) && - push16(srs_pdu->bwp_start, ppWritePackedMsg, end) && - push8(srs_pdu->subcarrier_spacing, ppWritePackedMsg, end) && - push8(srs_pdu->cyclic_prefix, ppWritePackedMsg, end) && - push8(srs_pdu->num_ant_ports, ppWritePackedMsg, end) && - push8(srs_pdu->num_symbols, ppWritePackedMsg, end) && - push8(srs_pdu->num_repetitions, ppWritePackedMsg, end) && - push8(srs_pdu->time_start_position, ppWritePackedMsg, end) && - push8(srs_pdu->config_index, ppWritePackedMsg, end) && - push16(srs_pdu->sequence_id, ppWritePackedMsg, end) && - push8(srs_pdu->bandwidth_index, ppWritePackedMsg, end) && - push8(srs_pdu->comb_size, ppWritePackedMsg, end) && - push8(srs_pdu->comb_offset, ppWritePackedMsg, end) && - push8(srs_pdu->cyclic_shift, ppWritePackedMsg, end) && - push8(srs_pdu->frequency_position, ppWritePackedMsg, end) && - push8(srs_pdu->frequency_shift, ppWritePackedMsg, end) && - push8(srs_pdu->frequency_hopping, ppWritePackedMsg, end) && - push8(srs_pdu->group_or_sequence_hopping, ppWritePackedMsg, end) && - push8(srs_pdu->resource_type, ppWritePackedMsg, end) && - push16(srs_pdu->t_srs, ppWritePackedMsg, end) && - push16(srs_pdu->t_offset, ppWritePackedMsg, end) - - // TODO: ignoring beamforming tlv for now - ); - -} - -static uint8_t pack_ul_config_request_ulsch_pdu(nfapi_ul_config_ulsch_pdu* ulsch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &ulsch_pdu->ulsch_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &ulsch_pdu->ulsch_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel10_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &ulsch_pdu->ulsch_pdu_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel11_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &ulsch_pdu->ulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel13_value)); -} - -static uint8_t pack_ul_config_request_cqi_ri_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv; - - return ( push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel8->ri_size, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel8->delta_offset_cqi, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel8->delta_offset_ri, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv; - - if(!(push8(cqi_ri_info_rel9->report_type, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel9->delta_offset_cqi, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel9->delta_offset_ri, ppWritePackedMsg, end))) - { - return 0; - } - - switch(cqi_ri_info_rel9->report_type) - { - case NFAPI_CSI_REPORT_TYPE_PERIODIC: - { - if(!(push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, ppWritePackedMsg, end) && - push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, ppWritePackedMsg, end))) - { - return 0; - } - } - break; - case NFAPI_CSI_REPORT_TYPE_APERIODIC: - { - if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, ppWritePackedMsg, end) == 0) - return 0; - - uint8_t i; - for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i) - { - if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0) - return 0; - - uint8_t j; - for(j = 0; j < 8; ++j) - { - if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0) - return 0; - } - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type ); - } - break; - }; - - return 1; -} - -static uint8_t pack_ul_config_request_cqi_ri_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv; - - switch(cqi_ri_info_rel13->report_type) - { - case NFAPI_CSI_REPORT_TYPE_PERIODIC: - { - if(push16(cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, ppWritePackedMsg, end) == 0) - return 0; - } - break; - case NFAPI_CSI_REPORT_TYPE_APERIODIC: - { - // No parameters - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel13->report_type ); - } - break; - }; - - return 1; -} - -static uint8_t pack_ul_config_request_cqi_ri_information(nfapi_ul_config_cqi_ri_information* cqi_ri_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return (pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &cqi_ri_info->cqi_ri_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &cqi_ri_info->cqi_ri_information_rel9, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel9_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &cqi_ri_info->cqi_ri_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel13_value)); - -} - -static uint8_t pack_ul_config_request_init_tx_params_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv; - - return (push8(init_tx_params_rel8->n_srs_initial, ppWritePackedMsg, end) && - push8(init_tx_params_rel8->initial_number_of_resource_blocks, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_initial_transmission_parameters(nfapi_ul_config_initial_transmission_parameters* init_tx_params, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return pack_tlv(NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &init_tx_params->initial_transmission_parameters_rel8, ppWritePackedMsg, end, &pack_ul_config_request_init_tx_params_rel8_value); -} - -static uint8_t pack_ul_config_request_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv; - - return (push8(harq_info_rel10->harq_size, ppWritePackedMsg, end) && - push8(harq_info_rel10->delta_offset_harq, ppWritePackedMsg, end) && - push8(harq_info_rel10->ack_nack_mode, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv; - - return (push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) && - push8(harq_info_rel13->delta_offset_harq_2, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_ulsch_harq_information(nfapi_ul_config_ulsch_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &harq_info->harq_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel10_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel13_value)); -} - -static uint8_t pack_ul_config_request_ue_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv; - - return ( push32(ue_info_rel8->handle, ppWritePackedMsg, end) && - push16(ue_info_rel8->rnti, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_ue_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv; - - return ( push8(ue_info_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) && - push16(ue_info_rel11->npusch_identity, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_ue_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv; - - return ( push8(ue_info_rel13->ue_type, ppWritePackedMsg, end) && - push8(ue_info_rel13->empty_symbols, ppWritePackedMsg, end) && - push16(ue_info_rel13->total_number_of_repetitions, ppWritePackedMsg, end) && - push16(ue_info_rel13->repetition_number, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_ue_information(nfapi_ul_config_ue_information* ue_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &ue_info->ue_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &ue_info->ue_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel11_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &ue_info->ue_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel13_value)); -} - -static uint8_t pack_ul_config_request_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_rel10_tdd = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv; - - return ( push8(harq_info_rel10_tdd->harq_size, ppWritePackedMsg, end) && - push8(harq_info_rel10_tdd->ack_nack_mode, ppWritePackedMsg, end) && - push8(harq_info_rel10_tdd->number_of_pucch_resources, ppWritePackedMsg, end) && - push16(harq_info_rel10_tdd->n_pucch_1_0, ppWritePackedMsg, end) && - push16(harq_info_rel10_tdd->n_pucch_1_1, ppWritePackedMsg, end) && - push16(harq_info_rel10_tdd->n_pucch_1_2, ppWritePackedMsg, end) && - push16(harq_info_rel10_tdd->n_pucch_1_3, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_rel8_fdd = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv; - - return ( push16(harq_info_rel8_fdd->n_pucch_1_0, ppWritePackedMsg, end) && - push8(harq_info_rel8_fdd->harq_size, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_rel9_fdd = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv; - - return ( push8(harq_info_rel9_fdd->harq_size, ppWritePackedMsg, end) && - push8(harq_info_rel9_fdd->ack_nack_mode, ppWritePackedMsg, end) && - push8(harq_info_rel9_fdd->number_of_pucch_resources, ppWritePackedMsg, end) && - push16(harq_info_rel9_fdd->n_pucch_1_0, ppWritePackedMsg, end) && - push16(harq_info_rel9_fdd->n_pucch_1_1, ppWritePackedMsg, end) && - push16(harq_info_rel9_fdd->n_pucch_1_2, ppWritePackedMsg, end) && - push16(harq_info_rel9_fdd->n_pucch_1_3, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_harq_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv; - - return ( push8(harq_info_rel11->num_ant_ports, ppWritePackedMsg, end) && - push16(harq_info_rel11->n_pucch_2_0, ppWritePackedMsg, end) && - push16(harq_info_rel11->n_pucch_2_1, ppWritePackedMsg, end) && - push16(harq_info_rel11->n_pucch_2_2, ppWritePackedMsg, end) && - push16(harq_info_rel11->n_pucch_2_3, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv; - - return ( push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) && - push8(harq_info_rel13->starting_prb, ppWritePackedMsg, end) && - push8(harq_info_rel13->n_prb, ppWritePackedMsg, end) && - push8(harq_info_rel13->cdm_index, ppWritePackedMsg, end) && - push8(harq_info_rel13->n_srs, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_harq_information(nfapi_ul_config_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &harq_info->harq_information_rel10_tdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel10_tdd_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &harq_info->harq_information_rel8_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel8_fdd_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &harq_info->harq_information_rel9_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel9_fdd_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &harq_info->harq_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel11_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel13_value)); - -} - -static uint8_t pack_ul_config_request_cqi_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv; - - return ( push16(cqi_info_rel8->pucch_index, ppWritePackedMsg, end) && - push8(cqi_info_rel8->dl_cqi_pmi_size, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_cqi_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv; - - return ( push8(cqi_info_rel10->number_of_pucch_resource, ppWritePackedMsg, end) && - push16(cqi_info_rel10->pucch_index_p1, ppWritePackedMsg, end)); -} -static uint8_t pack_ul_config_request_cqi_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv; - - return ( push8(cqi_info_rel13->csi_mode, ppWritePackedMsg, end) && - push16(cqi_info_rel13->dl_cqi_pmi_size_2, ppWritePackedMsg, end) && - push8(cqi_info_rel13->starting_prb, ppWritePackedMsg, end) && - push8(cqi_info_rel13->n_prb, ppWritePackedMsg, end) && - push8(cqi_info_rel13->cdm_index, ppWritePackedMsg, end) && - push8(cqi_info_rel13->n_srs, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_cqi_information(nfapi_ul_config_cqi_information* cqi_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &cqi_info->cqi_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &cqi_info->cqi_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel10_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &cqi_info->cqi_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel13_value)); - -} - -static uint8_t pack_ul_config_request_sr_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv; - return push16(sr_info_rel8->pucch_index, ppWritePackedMsg, end); -} -static uint8_t pack_ul_config_request_sr_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv; - - return ( push8(sr_info_rel10->number_of_pucch_resources, ppWritePackedMsg, end) && - push16(sr_info_rel10->pucch_index_p1, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_sr_information(nfapi_ul_config_sr_information* sr_info, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &sr_info->sr_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &sr_info->sr_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel10_value)); -} - -static uint8_t pack_ul_config_request_srs_pdu_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv; - - return (push32(srs_pdu_rel8->handle, ppWritePackedMsg, end) && - push16(srs_pdu_rel8->size, ppWritePackedMsg, end) && - push16(srs_pdu_rel8->rnti, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->srs_bandwidth, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->frequency_domain_position, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->srs_hopping_bandwidth, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->transmission_comb, ppWritePackedMsg, end) && - push16(srs_pdu_rel8->i_srs, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->sounding_reference_cyclic_shift, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_srs_pdu_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv; - return push8(srs_pdu_rel10->antenna_port, ppWritePackedMsg, end); -} - -static uint8_t pack_ul_config_request_srs_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv; - - return ( push8(srs_pdu_rel13->number_of_combs, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_nb_harq_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_pdu_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv; - - return ( push8(nb_harq_pdu_rel13->harq_ack_resource, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_config_request_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv; - - return (push8(nulsch_pdu_rel13->nulsch_format, ppWritePackedMsg, end) && - push32(nulsch_pdu_rel13->handle, ppWritePackedMsg, end) && - push16(nulsch_pdu_rel13->size, ppWritePackedMsg, end) && - push16(nulsch_pdu_rel13->rnti, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->resource_assignment, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->mcs, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->redudancy_version, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->new_data_indication, ppWritePackedMsg, end) && - push8(nulsch_pdu_rel13->n_srs, ppWritePackedMsg, end) && - push16(nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) && - push16(nulsch_pdu_rel13->sf_idx, ppWritePackedMsg, end) && - pack_ul_config_request_ue_information(&(nulsch_pdu_rel13->ue_information), ppWritePackedMsg, end) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, ppWritePackedMsg, end, &pack_ul_config_request_nb_harq_rel13_value)); -} -static uint8_t pack_ul_config_request_nrach_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv; - - return ( push8(nrach_pdu_rel13->nprach_config_0, ppWritePackedMsg, end) && - push8(nrach_pdu_rel13->nprach_config_1, ppWritePackedMsg, end) && - push8(nrach_pdu_rel13->nprach_config_2, ppWritePackedMsg, end)); - -} - - - -static uint8_t pack_ul_tti_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_ul_tti_request_number_of_pdus_t* value = (nfapi_nr_ul_tti_request_number_of_pdus_t*)tlv; - - if(!(push16(value->pdu_size, ppWritePackedMsg, end) && - push16(value->pdu_type, ppWritePackedMsg, end) )) - return 0; - - - // first match the pdu type, then call the respective function - switch(value->pdu_type) - { - case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE: - { - if(!pack_ul_tti_request_prach_pdu(&value->prach_pdu, ppWritePackedMsg, end)) - return 0; - } - break; - - case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: - { - if(!pack_ul_tti_request_pucch_pdu(&value->pucch_pdu, ppWritePackedMsg, end)) - return 0; - } - break; - case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: - { - if(!pack_ul_tti_request_pusch_pdu(&value->pusch_pdu, ppWritePackedMsg, end)) - return 0; - } - break; - case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE: - { - if(!pack_ul_tti_request_srs_pdu(&value->srs_pdu, ppWritePackedMsg, end)) - return 0; - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", value->pdu_type ); - } - break; - } - - return 1; -} - -static uint8_t pack_ul_tti_groups_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_ul_tti_request_number_of_groups_t* value = (nfapi_nr_ul_tti_request_number_of_groups_t*)tlv; - - if(!push8(value->n_ue, ppWritePackedMsg, end)) - return 0; - for(int i=0; in_ue;i++) - { - if(!push8(value->ue_list[i].pdu_idx, ppWritePackedMsg, end)) - return 0; - } - return 1; -} - -static uint8_t pack_ul_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv; - - if(!(push8(value->number_of_pdus, ppWritePackedMsg, end) && - push8(value->rach_prach_frequency_resources, ppWritePackedMsg, end) && - push8(value->srs_present, ppWritePackedMsg, end))) - return 0; - - uint16_t i = 0; - for(i = 0; i < value->number_of_pdus; ++i) - { - nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]); - - if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: - { - if(!pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_pdu), ppWritePackedMsg, end)) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) && - pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_harq_pdu.harq_information), ppWritePackedMsg, end) && - pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_harq_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) && - pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_cqi_harq_ri_pdu.harq_information), ppWritePackedMsg, end) && - pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->uci_cqi_pdu.cqi_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_sr_information(&(pdu->uci_sr_pdu.sr_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_harq_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->uci_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_harq_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_sr_information(&(pdu->uci_sr_harq_pdu.sr_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->uci_sr_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_harq_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->uci_cqi_harq_pdu.cqi_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->uci_cqi_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_pdu.cqi_information), ppWritePackedMsg, end) && - pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_pdu.sr_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_harq_pdu.ue_information), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_harq_pdu.cqi_information), ppWritePackedMsg, end) && - pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_harq_pdu.sr_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->uci_cqi_sr_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_SRS_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &pdu->srs_pdu.srs_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel8_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &pdu->srs_pdu.srs_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel10_value) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &pdu->srs_pdu.srs_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: - { - if(!(pack_ul_config_request_ue_information(&(pdu->harq_buffer_pdu.ue_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_csi_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->ulsch_uci_csi_pdu.csi_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->ulsch_uci_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: - { - if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && - pack_ul_config_request_cqi_information(&(pdu->ulsch_csi_uci_harq_pdu.csi_information), ppWritePackedMsg, end) && - pack_ul_config_request_harq_information(&(pdu->ulsch_csi_uci_harq_pdu.harq_information), ppWritePackedMsg, end))) - return 0; - } - break; - case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &pdu->nulsch_pdu.nulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nulsch_pdu_rel13_value))) - return 0; - } - break; - case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &pdu->nrach_pdu.nrach_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nrach_pdu_rel13_value))) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - - } - return 1; -} - - -static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg; - - if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) && - push16(pNfapiMsg->Slot , ppWritePackedMsg, end) && - push8(pNfapiMsg->n_pdus , ppWritePackedMsg, end) && - push8(pNfapiMsg->rach_present, ppWritePackedMsg, end) && - push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end) && - push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end) && - push8(pNfapiMsg->n_group, ppWritePackedMsg, end) )) - return 0; - - for(int i=0; in_pdus; i++) - { - if(!pack_ul_tti_pdu_list_value(&pNfapiMsg->pdus_list[i], ppWritePackedMsg, end)) - return 0; - } - - for(int i=0; in_group; i++) - { - if(!pack_ul_tti_groups_list_value(&pNfapiMsg->groups_list[i], ppWritePackedMsg, end)) - return 0; - - } - - return 1; -} - - -static uint8_t pack_ul_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, ppWritePackedMsg, end, &pack_ul_config_request_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) ; -} - -static uint8_t pack_hi_dci0_hi_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv; - - return ( push8(hi_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && - push8(hi_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && - push8(hi_pdu_rel8->hi_value, ppWritePackedMsg, end) && - push8(hi_pdu_rel8->i_phich, ppWritePackedMsg, end) && - push16(hi_pdu_rel8->transmission_power, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_hi_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv; - - return ( push8(hi_pdu_rel10->flag_tb2, ppWritePackedMsg, end) && - push8(hi_pdu_rel10->hi_value_2, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_dci_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv; - - return ( push8(dci_pdu_rel8->dci_format, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->cce_index, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->aggregation_level, ppWritePackedMsg, end) && - push16(dci_pdu_rel8->rnti, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->number_of_resource_block, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->mcs_1, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->new_data_indication_1, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->ue_tx_antenna_seleciton, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->tpc, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->cqi_csi_request, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->ul_index, ppWritePackedMsg, end) && - push8(dci_pdu_rel8->dl_assignment_index, ppWritePackedMsg, end) && - push32(dci_pdu_rel8->tpc_bitmap, ppWritePackedMsg, end) && - push16(dci_pdu_rel8->transmission_power, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_dci_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv; - - return ( push8(dci_pdu_rel10->cross_carrier_scheduling_flag, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->carrier_indicator, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->size_of_cqi_csi_feild, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->srs_flag, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->srs_request, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->resource_allocation_flag, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) && - push32(dci_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->mcs_2, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->new_data_indication_2, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->number_of_antenna_ports, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->tpmi, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->total_dci_length_including_padding, ppWritePackedMsg, end) && - push8(dci_pdu_rel10->n_ul_rb, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_dci_rel12_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv; - - return ( push8(dci_pdu_rel12->pscch_resource, ppWritePackedMsg, end) && - push8(dci_pdu_rel12->time_resource_pattern, ppWritePackedMsg, end)); -} - -static uint8_t pack_hi_dci0_mpdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* mpdcch_dci_pdu_rel13 = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv; - - return ( push8(mpdcch_dci_pdu_rel13->mpdcch_narrowband, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->number_of_prb_pairs, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->resource_block_assignment, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->mpdcch_transmission_type, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->ecce_index, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->aggreagation_level, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->rnti_type, ppWritePackedMsg, end) && - push16(mpdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->ce_mode, ppWritePackedMsg, end) && - push16(mpdcch_dci_pdu_rel13->drms_scrambling_init, ppWritePackedMsg, end) && - push16(mpdcch_dci_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) && - push16(mpdcch_dci_pdu_rel13->transmission_power, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->dci_format, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->resource_block_start, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->number_of_resource_blocks, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->pusch_repetition_levels, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->frequency_hopping_flag, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->new_data_indication, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->harq_process, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->redudency_version, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->tpc, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->csi_request, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->ul_inex, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->dai_presence_flag, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->dl_assignment_index, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->srs_request, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end) && - push32(mpdcch_dci_pdu_rel13->tcp_bitmap, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->total_dci_length_include_padding, ppWritePackedMsg, end) && - push8(mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end) && - pusharray16(mpdcch_dci_pdu_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end)); - -} - -static uint8_t pack_hi_dci0_npdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* npdcch_dci_pdu_rel13 = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv; - - return ( push8(npdcch_dci_pdu_rel13->ncce_index, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->aggregation_level, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) && - push16(npdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->resource_assignment, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->scheduling_delay, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->redudancy_version, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->repetition_number, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->new_data_indicator, ppWritePackedMsg, end) && - push8(npdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end)); -} - - -static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv; - - if(!(push16(value->sfnsf, ppWritePackedMsg, end) && - push8(value->number_of_dci, ppWritePackedMsg, end) && - push8(value->number_of_hi, ppWritePackedMsg, end))) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_dci + value->number_of_hi; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]); - - if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_HI_DCI0_HI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_hi_rel8_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_hi_rel10_pdu_value))) - return 0; - } - break; - case NFAPI_HI_DCI0_DCI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, ppWritePackedMsg, end, pack_hi_dci0_dci_rel12_pdu_value))) - return 0; - } - break; - case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, ppWritePackedMsg, end, pack_dl_config_epdcch_parameters_rel11_value))) - return 0; - } - break; - case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_mpdcch_dci_rel13_pdu_value))) - return 0; - } - break; - case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: - { - if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_npdcch_dci_rel13_pdu_value))) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - - } - - return 1; -} - -static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)tlv; - - for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) - { - if(!(push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, ppWritePackedMsg, end) && - - push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) && - - push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) && - - pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end))) - - return 0; - } - - return (push16(value->PDUType, ppWritePackedMsg, end) && - push16(value->PDUSize, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, ppWritePackedMsg, end) && - - push8(value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, ppWritePackedMsg, end) && - pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, ppWritePackedMsg, end) && - - push8(value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, ppWritePackedMsg, end) && - push8(value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, ppWritePackedMsg, end) && - push16(value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, ppWritePackedMsg, end)); - -} - -static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg; - - if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && - push16(pNfapiMsg->Slot, ppWritePackedMsg, end) && - push8(pNfapiMsg->numPdus, ppWritePackedMsg, end) - )) - return 0; - - for(int i=0; inumPdus; i++) - { - if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end)) - return 0; - } - return 1; - - -} - - - -static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, ppWritePackedMsg, end, &pack_hi_dci0_request_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -//pack_tx_data_pdu_list_value -static uint8_t pack_tx_data_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nr_pdu_t* value = (nfapi_nr_pdu_t*)tlv; - - if(!(push32(value->num_TLV, ppWritePackedMsg, end) && - push16(value->PDU_index, ppWritePackedMsg, end) && - push16(value->PDU_length, ppWritePackedMsg, end) - )) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_tlvs = value->num_TLV; - for(; i < total_number_of_tlvs; ++i) - { - - if (!(push16(value->TLVs[i].length, ppWritePackedMsg, end) && - push16(value->TLVs[i].tag, ppWritePackedMsg, end))) - return 0; - - switch(value->TLVs[i].tag) - { - case 0: - { - if(!pusharray32(value->TLVs[i].value.direct, 16384, value->TLVs[i].length, ppWritePackedMsg, end)) - return 0; - break; - - } - - case 1: - { - if(!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length , value->TLVs[i].length, ppWritePackedMsg, end)) - return 0; - break; - - } - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", value->TLVs[i].tag ); - break; - } - - } - } - return 1; -} - -static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_tx_request_body_t* value = (nfapi_tx_request_body_t*)tlv; - - if(push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(; i < total_number_of_pdus; ++i) - { - nfapi_tx_request_pdu_t* pdu = &(value->tx_pdu_list[i]); - - if(!(push16(pdu->pdu_length, ppWritePackedMsg, end) && - push16(pdu->pdu_index, ppWritePackedMsg, end))) - return 0; - - uint8_t j; - for(j = 0; j < pdu->num_segments; ++j) - { - // Use -1 as it is unbounded - // DJP - does not handle -1 - // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0) - int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end); - - if (pdu->segments[j].segment_length == 3) - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, - pdu->segments[j].segment_data[0], - pdu->segments[j].segment_data[1], - pdu->segments[j].segment_data[2] - ); - } - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret); - - if (push_ret == 0) - { - return 0; - } - } - } - - return 1; -} - -static uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg; - - if (!( - push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && - push16(pNfapiMsg->Slot, ppWritePackedMsg, end) && - push16(pNfapiMsg->Number_of_PDUs, ppWritePackedMsg, end) - )) - return 0; - - for(int i=0; iNumber_of_PDUs; i++) - { - if(!pack_tx_data_pdu_list_value(&pNfapiMsg->pdu_list[i], ppWritePackedMsg, end)) - return 0; - } - - return 1; -} - -static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg; - - int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); - int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value); - int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z); - - return x && y && z; -} - -static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv; - if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){ - return 0; - } - - uint8_t j; - uint16_t num = value->number_of_TLVs; - for(j = 0; j < num; ++j){ - if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){ - return 0; - } - } - return 1; -} - -static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; - int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); - int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value); - int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - return x && y && z; -} - -static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - - nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; - - int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end); - int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); - return x && z; -} - -static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push16(value->rnti, ppWritePackedMsg, end) ); -} - -static uint8_t unpack_rx_ue_information_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv; - - return ( pull32(ppReadPackedMsg, &value->handle, end) && - pull16(ppReadPackedMsg, &value->rnti, end)); -} - -static uint8_t pack_harq_indication_tdd_harq_data_bundling(nfapi_harq_indication_tdd_harq_data_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(data->value_0, ppWritePackedMsg, end) && - push8(data->value_1, ppWritePackedMsg, end)); -} - -static uint8_t pack_harq_indication_tdd_harq_data_multiplexing(nfapi_harq_indication_tdd_harq_data_multiplexing_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(data->value_0, ppWritePackedMsg, end) && - push8(data->value_1, ppWritePackedMsg, end) && - push8(data->value_2, ppWritePackedMsg, end) && - push8(data->value_3, ppWritePackedMsg, end)); -} - -static uint8_t pack_harq_indication_tdd_harq_data_special_bundling(nfapi_harq_indication_tdd_harq_data_special_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(data->value_0, ppWritePackedMsg, end) ); -} - -static uint8_t pack_harq_indication_tdd_harq_data(nfapi_harq_indication_tdd_harq_data_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - return ( push8(data->value_0, ppWritePackedMsg, end) ); -} - -static uint8_t pack_harq_indication_tdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel8_t* harq_indication_tdd_rel8 = (nfapi_harq_indication_tdd_rel8_t*)tlv; - - if(!(push8(harq_indication_tdd_rel8->mode, ppWritePackedMsg, end) && - push8(harq_indication_tdd_rel8->number_of_ack_nack, ppWritePackedMsg, end))) - return 0; - - uint8_t result = 0; - switch(harq_indication_tdd_rel8->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = pack_harq_indication_tdd_harq_data_bundling(&harq_indication_tdd_rel8->harq_data.bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = pack_harq_indication_tdd_harq_data_multiplexing(&harq_indication_tdd_rel8->harq_data.multiplex, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel8->harq_data.special_bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = 1; - break; - default: - // err.... - break; - } - - return result; - -} - -static uint8_t pack_harq_indication_tdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel9_t* harq_indication_tdd_rel9 = (nfapi_harq_indication_tdd_rel9_t*)tlv; - - if(!(push8(harq_indication_tdd_rel9->mode, ppWritePackedMsg, end) && - push8(harq_indication_tdd_rel9->number_of_ack_nack, ppWritePackedMsg, end))) - return 0; - - uint8_t idx; - for(idx = 0; idx < harq_indication_tdd_rel9->number_of_ack_nack; ++idx) - { - uint8_t result = 0; - - switch(harq_indication_tdd_rel9->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = pack_harq_indication_tdd_harq_data(&(harq_indication_tdd_rel9->harq_data[idx].bundling), ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].multiplex, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel9->harq_data[idx].special_bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].channel_selection, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].format_3, ppWritePackedMsg, end); - break; - default: - // err.... - break; - } - - if(result == 0) - return 0; - } - - return 1; -} - -static uint8_t pack_harq_indication_tdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel13_t* harq_indication_tdd_rel13 = (nfapi_harq_indication_tdd_rel13_t*)tlv; - - if(!(push8(harq_indication_tdd_rel13->mode, ppWritePackedMsg, end) && - push16(harq_indication_tdd_rel13->number_of_ack_nack, ppWritePackedMsg, end))) - return 0; - - uint8_t idx; - for(idx = 0; idx < harq_indication_tdd_rel13->number_of_ack_nack; ++idx) - { - uint8_t result = 0; - switch(harq_indication_tdd_rel13->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].multiplex, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel13->harq_data[idx].special_bundling, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].channel_selection, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_3, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_4, ppWritePackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5: - result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_5, ppWritePackedMsg, end); - break; - default: - // err.... - break; - } - - if(result == 0) - return 0; - } - - return 1; -} - -static uint8_t pack_harq_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel8_t* harq_indication_fdd_rel8 = (nfapi_harq_indication_fdd_rel8_t*)tlv; - - return ( push8(harq_indication_fdd_rel8->harq_tb1, ppWritePackedMsg, end) && - push8(harq_indication_fdd_rel8->harq_tb2, ppWritePackedMsg, end)); -} - -static uint8_t pack_harq_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel9_t* harq_indication_fdd_rel9 = (nfapi_harq_indication_fdd_rel9_t*)tlv; - - return ( push8(harq_indication_fdd_rel9->mode, ppWritePackedMsg, end) && - push8(harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end) && - pusharray8(harq_indication_fdd_rel9->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end)); -} - -static uint8_t pack_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel13_t* harq_indication_fdd_rel13 = (nfapi_harq_indication_fdd_rel13_t*)tlv; - - return ( push8(harq_indication_fdd_rel13->mode, ppWritePackedMsg, end) && - push16(harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end) && - pusharray8(harq_indication_fdd_rel13->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end)); -} - -static uint8_t pack_ul_cqi_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv; - - return ( push8(value->ul_cqi, ppWritePackedMsg, end) && - push8(value->channel, ppWritePackedMsg, end)); - -} - -static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv; - - if(push16(value->number_of_harqs, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_harqs; - for(; i < total_number_of_pdus; ++i) - { - nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, ppWritePackedMsg, end, pack_harq_indication_tdd_rel8_value) && - pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, ppWritePackedMsg, end, pack_harq_indication_tdd_rel9_value) && - pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, ppWritePackedMsg, end, pack_harq_indication_tdd_rel13_value) && - pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, ppWritePackedMsg, end, pack_harq_indication_fdd_rel8_value) && - pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, ppWritePackedMsg, end, pack_harq_indication_fdd_rel9_value) && - pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_harq_indication_fdd_rel13_value) && - pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - - return 1; -} - -static uint8_t pack_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, ppWritePackedMsg, end, pack_harq_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_crc_indication_rel8_body(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_crc_indication_rel8_t* crc_indication_rel8 = (nfapi_crc_indication_rel8_t*)tlv; - - return ( push8(crc_indication_rel8->crc_flag, ppWritePackedMsg, end) ); -} - -static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv; - - if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_crcs; - for(; i < total_number_of_pdus; ++i) - { - nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - return 1; -} - -static uint8_t pack_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, ppWritePackedMsg, end, &pack_crc_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - -} -static uint8_t pack_rx_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv; - - return ( push16(value->length, ppWritePackedMsg, end) && - push16(value->offset, ppWritePackedMsg, end) && - push8(value->ul_cqi, ppWritePackedMsg, end) && - push16(value->timing_advance, ppWritePackedMsg, end)); -} -static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv; - - return ( push16(value->timing_advance_r9, ppWritePackedMsg, end)); -} - -static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv; - - //printf("RX ULSCH BODY\n"); - - if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) - return 0; - - // need to calculate the data offset's. - uint16_t i = 0; - uint16_t offset = 2; // taking into account the number_of_pdus - uint16_t total_number_of_pdus = value->number_of_pdus; - //printf("ULSCH:pdus:%d\n", total_number_of_pdus); - - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); - if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG) - { - //printf("NFAPI_RX_UE_INFORMATION_TAG\n"); - offset += 4 + 6; - } - - if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) - { - //printf("NFAPI_RX_INDICATION_REL8_TAG\n"); - offset += 4 + 7; - } - - if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG) - { - //printf("NFAPI_RX_INDICATION_REL9_TAG\n"); - offset += 4 + 2; - } - } - - // Now update the structure to include the offset - for(i =0; i < total_number_of_pdus; ++i) - { - nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); - - if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) - { - if(pdu->rx_indication_rel8.offset == 1) - { - pdu->rx_indication_rel8.offset = offset; - offset += pdu->rx_indication_rel8.length; - } - } - } - - // Write out the pdu - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) && - pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value))) - return 0; - } - - // Write out the pdu data - for(i = 0; i < total_number_of_pdus; ++i) - { - uint16_t length = 0; - nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); - - if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) - { - length = pdu->rx_indication_rel8.length; - } - - if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0) - return 0; - } - return 1; -} - - -static uint8_t pack_rx_ulsch_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, ppWritePackedMsg, end, pack_rx_ulsch_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_preamble_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel8_t* preamble_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv; - - return ( push16(preamble_rel8->rnti, ppWritePackedMsg, end) && - push8(preamble_rel8->preamble, ppWritePackedMsg, end) && - push16(preamble_rel8->timing_advance, ppWritePackedMsg, end)); -} -static uint8_t pack_preamble_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel9_t* preamble_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv; - - return ( push16(preamble_rel9->timing_advance_r9, ppWritePackedMsg, end) ); -} -static uint8_t pack_preamble_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel13_t* preamble_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv; - - return ( push8(preamble_rel13->rach_resource_type, ppWritePackedMsg, end) ); -} - -static uint8_t pack_rach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv; - - if( push16(value->number_of_preambles, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_preambles; - for(; i < total_number_of_pdus; ++i) - { - nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, ppWritePackedMsg, end, pack_preamble_pdu_rel8_value) && - pack_tlv(NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, ppWritePackedMsg, end, pack_preamble_pdu_rel9_value) && - pack_tlv(NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, ppWritePackedMsg, end, pack_preamble_pdu_rel13_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - - return 1; -} - -static uint8_t pack_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, ppWritePackedMsg, end, pack_rach_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel8_t* srs_pdu_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv; - - return ( push16(srs_pdu_rel8->doppler_estimation, ppWritePackedMsg, end) && - push16(srs_pdu_rel8->timing_advance, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) && - push8(srs_pdu_rel8->rb_start, ppWritePackedMsg, end) && - pusharray8(srs_pdu_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end)); -} - -static uint8_t pack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel9_t* srs_pdu_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv; - - return ( push16(srs_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end) ); -} - -static uint8_t pack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_ttd_rel10_t* srs_pdu_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv; - - return ( push8(srs_pdu_rel10->uppts_symbol, ppWritePackedMsg, end) ); - -} - -static uint8_t pack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel11_t* srs_pdu_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv; - - return ( push16(srs_pdu_rel11->ul_rtoa, ppWritePackedMsg, end) ) ; -} - -static uint8_t pack_tdd_channel_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv; - - if(!(push8(value->num_prb_per_subband, ppWritePackedMsg, end) && - push8(value->number_of_subbands, ppWritePackedMsg, end) && - push8(value->num_atennas, ppWritePackedMsg, end))) - return 0; - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_subbands; ++idx) - { - if(!(push8(value->subands[idx].subband_index, ppWritePackedMsg, end) && - pusharray16(value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, ppWritePackedMsg, end))) - return 0; - } - - return 1; -} - -static uint8_t pack_srs_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_srs_indication_body_t *value = (nfapi_srs_indication_body_t*)tlv; - - if( push8(value->number_of_ues, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_ues; - for(; i < total_number_of_pdus; ++i) - { - nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, &pack_rx_ue_information_value) && - pack_tlv(NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel8_value) && - pack_tlv(NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel9_value) && - pack_tlv(NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, ppWritePackedMsg, end, &pack_srs_indication_tdd_rel10_value) && - pack_tlv(NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel11_value) && - pack_tlv(NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, ppWritePackedMsg, end, &pack_tdd_channel_measurement_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - - return 1; -} - -static uint8_t pack_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, ppWritePackedMsg, end, &pack_srs_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - -} - -static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv; - - if(push16(value->number_of_srs, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_srs; - for(; i < total_number_of_pdus; ++i) - { - nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - return 1; -} - -static uint8_t pack_sr_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, ppWritePackedMsg, end, &pack_sr_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - -} - -static uint8_t pack_cqi_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv; - - return ( push16(cqi_pdu_rel8->length, ppWritePackedMsg, end) && - push16(cqi_pdu_rel8->data_offset, ppWritePackedMsg, end) && - push8(cqi_pdu_rel8->ul_cqi, ppWritePackedMsg, end) && - push8(cqi_pdu_rel8->ri, ppWritePackedMsg, end) && - push16(cqi_pdu_rel8->timing_advance, ppWritePackedMsg, end)); -} - -static uint8_t pack_cqi_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv; - - return ( push16(cqi_pdu_rel9->length, ppWritePackedMsg, end) && - push16(cqi_pdu_rel9->data_offset, ppWritePackedMsg, end) && - push8(cqi_pdu_rel9->ul_cqi, ppWritePackedMsg, end) && - push8(cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) && - pusharray8(cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) && - push16(cqi_pdu_rel9->timing_advance, ppWritePackedMsg, end) && - push16(cqi_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end)); -} - -static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv; - - if( push16(value->number_of_cqis, ppWritePackedMsg, end) == 0) - return 0; - - // need to calculate the data offset's. This very bittle due the hardcoding - // of the sizes. can not use the sizeof as we have an array for the Rel9 - // info - uint16_t i = 0; - uint16_t offset = 2; // taking into account the number_of_cqis - uint16_t total_number_of_pdus = value->number_of_cqis; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - - offset += 2; // for the instance length - - if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG) - { - offset += 4 + 6; // sizeof(nfapi_rx_ue_information) - sizeof(nfapi_tl_t) - } - - if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) - { - offset += 4 + 8; - } - - if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) - { - offset += 4 + 10 + pdu->cqi_indication_rel9.number_of_cc_reported; - } - - if(pdu->ul_cqi_information.tl.tag == NFAPI_UL_CQI_INFORMATION_TAG) - { - offset += 4 + 2; - } - } - - // Now update the structure to include the offset - for(i =0; i < total_number_of_pdus; ++i) - { - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - - if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) - { - if(pdu->cqi_indication_rel8.data_offset == 1) - { - pdu->cqi_indication_rel8.data_offset = offset; - offset += pdu->cqi_indication_rel8.length; - } - } - - if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) - { - if(pdu->cqi_indication_rel9.data_offset == 1) - { - pdu->cqi_indication_rel9.data_offset = offset; - offset += pdu->cqi_indication_rel9.length; - } - } - - } - - // Write out the cqi information - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end ,pack_rx_ue_information_value) && - pack_tlv(NFAPI_CQI_INDICATION_REL8_TAG, &pdu->cqi_indication_rel8, ppWritePackedMsg, end, pack_cqi_indication_rel8_value) && - pack_tlv(NFAPI_CQI_INDICATION_REL9_TAG, &pdu->cqi_indication_rel9, ppWritePackedMsg, end, pack_cqi_indication_rel9_value) && - pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - - } - - // Write out the cqi raw data - for(i = 0; i < total_number_of_pdus; ++i) - { - uint16_t length = 0; - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - - if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) - { - length = pdu->cqi_indication_rel8.length; - } - - if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) - { - length = pdu->cqi_indication_rel9.length; - } - - if( pusharray8(value->cqi_raw_pdu_list[i].pdu, NFAPI_CQI_RAW_MAX_LEN, length, ppWritePackedMsg, end) == 0) - return 0; - } - - return 1; -} - -static uint8_t pack_cqi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, ppWritePackedMsg, end, pack_cqi_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); - -} - -static uint8_t pack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push32(value->mp_cca, ppWritePackedMsg, end) && - push32(value->n_cca, ppWritePackedMsg, end) && - push32(value->offset, ppWritePackedMsg, end) && - push32(value->lte_txop_sf, ppWritePackedMsg, end) && - push16(value->txop_sfn_sf_end, ppWritePackedMsg, end) && - push32(value->lbt_mode, ppWritePackedMsg, end)); -} - -static uint8_t pack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push32(value->offset, ppWritePackedMsg, end) && - push16(value->sfn_sf_end, ppWritePackedMsg, end) && - push32(value->lbt_mode, ppWritePackedMsg, end)); -} - -static uint8_t pack_lbt_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv; - - if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(; i < total_number_of_pdus; ++i) - { - nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]); - - if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - if( push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE: - { - if( pack_tlv(NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_req_pdu_rel13_value) == 0) - return 0; - } - break; - case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE: - { - if(pack_tlv(NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_req_pdu_rel13_value) == 0) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - } - - return 1; -} - -static uint8_t pack_lbt_pdsch_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push32(value->result, ppWritePackedMsg, end) && - push32(value->lte_txop_symbols, ppWritePackedMsg, end) && - push32(value->initial_partial_sf, ppWritePackedMsg, end)); -} - -static uint8_t pack_lbt_drs_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv; - - return ( push32(value->handle, ppWritePackedMsg, end) && - push32(value->result, ppWritePackedMsg, end)); -} - -static uint8_t pack_lbt_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, ppWritePackedMsg, end, &pack_lbt_dl_config_request_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_lbt_dl_config_indication_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv; - - if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(; i < total_number_of_pdus; ++i) - { - nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]); - - if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) - return 0; - - // Put a 0 size in and then determine the size after the pdu - // has been writen and write the calculated size - uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; - pdu->pdu_size = 0; - - if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE: - { - if( pack_tlv(NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_rsp_pdu_rel13_value) == 0) - return 0; - } - break; - case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE: - { - if( pack_tlv(NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_rsp_pdu_rel13_value) == 0) - return 0; - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - - // add 1 for the pdu_type. The delta will include the pdu_size - pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); - push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); - } - - return 1; -} - -static uint8_t pack_lbt_dl_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, ppWritePackedMsg, end, &pack_lbt_dl_config_indication_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nb_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nb_harq_indication_fdd_rel13_t* nb_harq_indication_fdd_rel13 = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv; - - return ( push8(nb_harq_indication_fdd_rel13->harq_tb1, ppWritePackedMsg, end) ); -} - -static uint8_t pack_nb_harq_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv; - - if( push16(value->number_of_harqs, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_harqs = value->number_of_harqs; - for(; i < total_number_of_harqs; ++i) - { - nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]); - - uint8_t* instance_length_p = *ppWritePackedMsg; - if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - return 0; - - if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && - pack_tlv(NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_nb_harq_indication_fdd_rel13_value) && - pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - push16(instance_length, &instance_length_p, end); - } - - return 1; -} - - -static uint8_t pack_nb_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, ppWritePackedMsg, end, &pack_nb_harq_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nrach_indication_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nrach_indication_pdu_rel13_t* nrach_indication_fdd_rel13 = (nfapi_nrach_indication_pdu_rel13_t*)tlv; - - return ( push16(nrach_indication_fdd_rel13->rnti, ppWritePackedMsg, end) && - push8(nrach_indication_fdd_rel13->initial_sc, ppWritePackedMsg, end) && - push16(nrach_indication_fdd_rel13->timing_advance, ppWritePackedMsg, end) && - push8(nrach_indication_fdd_rel13->nrach_ce_level, ppWritePackedMsg, end)); -} - - -static uint8_t pack_nrach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) -{ - nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv; - - if( push8(value->number_of_initial_scs_detected, ppWritePackedMsg, end) == 0) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_initial_scs_detected = value->number_of_initial_scs_detected; - for(; i < total_number_of_initial_scs_detected; ++i) - { - nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]); - - //uint8_t* instance_length_p = *ppWritePackedMsg; - //if(!push16(pdu->instance_length, ppWritePackedMsg, end)) - // return 0; - - if(!(pack_tlv(NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, ppWritePackedMsg, end, pack_nrach_indication_rel13_value))) - return 0; - - // calculate the instance length subtracting the size of the instance - // length feild - //uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; - //push16(instance_length, &instance_length_p, end); - } - - return 1; -} - -static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg; - - return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && - pack_tlv(NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, ppWritePackedMsg, end, &pack_nrach_indication_body_value) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg; - - return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg; - - return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->delta_sfn_sf, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg; - - return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && - push32(pNfapiMsg->t2, ppWritePackedMsg, end) && - push32(pNfapiMsg->t3, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg; - - return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && - push32(pNfapiMsg->t2, ppWritePackedMsg, end) && - push32(pNfapiMsg->t3, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg; - - return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) && - push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) && - push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->tx_request_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->ul_config_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->hi_dci0_jitter, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->dl_config_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->tx_request_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_config_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->hi_dci0_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->dl_config_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->tx_request_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - -static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg; - - return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) && - push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) && - push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) && - push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) && - push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) && - pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) && - pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); -} - - - -// Main pack function - public - -int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config) -{ - nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; - uint8_t *pWritePackedMessage = pPackedBuf; - uint8_t *pPackedLengthField = &pWritePackedMessage[4]; - uint8_t *end = pPackedBuf + packedBufLen; - - if (pMessageBuf == NULL || pPackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); - return -1; - } - /* - printf("\n P7 MESSAGE SENT: \n"); - for(int i=0; i< packedBufLen; i++){ - printf("%d", *(uint8_t *)(pMessageBuf + i)); - } - printf("\n"); - */ - // process the header - if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) && - push16(pMessageHeader->message_id, &pWritePackedMessage, end) && - push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) && - push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) && - push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) && - push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end))) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n"); - return -1; - } - - if (pMessageHeader->message_id != NFAPI_TIMING_INFO) - { - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp); - } - // look for the specific message - uint8_t result = 0; - switch (pMessageHeader->message_id) - { - case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: - result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: - result = pack_ul_tti_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: - result = pack_tx_data_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: - result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UE_RELEASE_REQUEST: - result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UE_RELEASE_RESPONSE: - result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_HARQ_INDICATION: - result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_CRC_INDICATION: - result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_ULSCH_INDICATION: - //printf("RX ULSCH\n"); - result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RACH_INDICATION: - result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_SRS_INDICATION: - result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_SR_INDICATION: - result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_CQI_INDICATION: - result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_LBT_DL_INDICATION: - result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NB_HARQ_INDICATION: - result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NRACH_INDICATION: - result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: - result = pack_nr_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: - result = pack_nr_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_TIMING_INFO: - result = pack_nr_timing_info(pMessageHeader, &pWritePackedMessage, end, config); - break; - - default: - { - if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && - pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) - { - if(config && config->pack_p7_vendor_extension) - { - result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config); - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); - } - } - break; - } - - if(result == 0) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n"); - return -1; - } - - // check for a valid message length - uintptr_t msgHead = (uintptr_t)pPackedBuf; - uintptr_t msgEnd = (uintptr_t)pWritePackedMessage; - uint32_t packedMsgLen = msgEnd - msgHead; - uint16_t packedMsgLen16; - if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen); - return -1; - } - else - { - packedMsgLen16 = (uint16_t)packedMsgLen; - } - - // Update the message length in the header - pMessageHeader->message_length = packedMsgLen16; - - if(!push16(packedMsgLen16, &pPackedLengthField, end)) - return -1; - - if(1) - { - //quick test - if(pMessageHeader->message_length != packedMsgLen) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id); - } - } - - return (packedMsgLen); -} - -int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config) -{ - nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; - uint8_t *pWritePackedMessage = pPackedBuf; - uint8_t *pPackedLengthField = &pWritePackedMessage[4]; - uint8_t *end = pPackedBuf + packedBufLen; - - if (pMessageBuf == NULL || pPackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); - return -1; - } - /* - printf("\n P7 MESSAGE SENT: \n"); - for(int i=0; i< packedBufLen; i++){ - printf("%d", *(uint8_t *)(pMessageBuf + i)); - } - printf("\n"); - */ - // process the header - if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) && - push16(pMessageHeader->message_id, &pWritePackedMessage, end) && - push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) && - push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) && - push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) && - push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end))) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n"); - return -1; - } - - if (pMessageHeader->message_id != NFAPI_TIMING_INFO) - { - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp); - } - // look for the specific message - uint8_t result = 0; - switch (pMessageHeader->message_id) - { - case NFAPI_DL_CONFIG_REQUEST: - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__); - result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UL_CONFIG_REQUEST: - result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - case NFAPI_TX_REQUEST: - //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__); - result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - case NFAPI_HI_DCI0_REQUEST: - result = pack_hi_dci0_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UE_RELEASE_REQUEST: - result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UE_RELEASE_RESPONSE: - result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_HARQ_INDICATION: - result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_CRC_INDICATION: - result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_ULSCH_INDICATION: - //printf("RX ULSCH\n"); - result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RACH_INDICATION: - result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_SRS_INDICATION: - result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_SR_INDICATION: - result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_RX_CQI_INDICATION: - result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_LBT_DL_INDICATION: - result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NB_HARQ_INDICATION: - result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_NRACH_INDICATION: - result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_DL_NODE_SYNC: - result = pack_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_UL_NODE_SYNC: - result = pack_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config); - break; - - case NFAPI_TIMING_INFO: - result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config); - break; - - default: - { - if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && - pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) - { - if(config && config->pack_p7_vendor_extension) - { - result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config); - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); - } - } - break; - } - - if(result == 0) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n"); - return -1; - } - - // check for a valid message length - uintptr_t msgHead = (uintptr_t)pPackedBuf; - uintptr_t msgEnd = (uintptr_t)pWritePackedMessage; - uint32_t packedMsgLen = msgEnd - msgHead; - uint16_t packedMsgLen16; - if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen); - return -1; - } - else - { - packedMsgLen16 = (uint16_t)packedMsgLen; - } - - // Update the message length in the header - pMessageHeader->message_length = packedMsgLen16; - - if(!push16(packedMsgLen16, &pPackedLengthField, end)) - return -1; - - if(1) - { - //quick test - if(pMessageHeader->message_length != packedMsgLen) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id); - } - } - - return (packedMsgLen); -} - -// Unpack routines -// NR: -static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv; - - return( - pull16(ppReadPackedMsg, &value->bwp_size, end) && - pull16(ppReadPackedMsg, &value->bwp_start, end) && - - pull8(ppReadPackedMsg, &value->subcarrier_spacing, end) && - pull8(ppReadPackedMsg, &value->cyclic_prefix, end) && - - pull16(ppReadPackedMsg, &value->start_rb, end) && - pull16(ppReadPackedMsg, &value->nr_of_rbs, end) && - - pull8(ppReadPackedMsg, &value->csi_type, end) && - pull8(ppReadPackedMsg, &value->row, end) && - - pull16(ppReadPackedMsg, &value->freq_domain, end) && - pull8(ppReadPackedMsg, &value->symb_l0, end) && - - pull8(ppReadPackedMsg, &value->symb_l1, end) && - pull8(ppReadPackedMsg, &value->cdm_type, end) && - - pull8(ppReadPackedMsg, &value->freq_density, end) && - pull16(ppReadPackedMsg, &value->scramb_id, end) && - - pull8(ppReadPackedMsg, &value->power_control_offset, end) && - pull8(ppReadPackedMsg, &value->power_control_offset_ss, end) - ); - -} - - -static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv; - - for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) - { - if(!(pull16(ppReadPackedMsg, &value->dci_pdu[i].RNTI, end) && - pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingId, end) && - - pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingRNTI, end) && - pull8(ppReadPackedMsg, &value->dci_pdu[i].CceIndex, end) && - pull8(ppReadPackedMsg, &value->dci_pdu[i].AggregationLevel, end) && - pull8(ppReadPackedMsg, &value->dci_pdu[i].beta_PDCCH_1_0, end) && - - pull8(ppReadPackedMsg, &value->dci_pdu[i].powerControlOffsetSS, end) && - pull16(ppReadPackedMsg, &value->dci_pdu[i].PayloadSizeBits, end) && - - pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, end))) - - return 0; - } - - // TODO: resolve the packaging of array (currently sending a single element) - return( - pull16(ppReadPackedMsg, &value->BWPSize, end) && - pull16(ppReadPackedMsg, &value->BWPStart, end) && - pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) && - pull8(ppReadPackedMsg, &value->CyclicPrefix, end) && - - pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) && - pull8(ppReadPackedMsg, &value->DurationSymbols, end) && - pullarray8(ppReadPackedMsg, value->FreqDomainResource, 6, 6, end) && - pull8(ppReadPackedMsg, &value->CceRegMappingType, end) && - - pull8(ppReadPackedMsg, &value->RegBundleSize, end) && - pull8(ppReadPackedMsg, &value->InterleaverSize, end) && - pull8(ppReadPackedMsg, &value->CoreSetType, end) && - pull16(ppReadPackedMsg, &value->ShiftIndex, end) && - - pull8(ppReadPackedMsg, &value->precoderGranularity, end) && - pull16(ppReadPackedMsg, &value->numDlDci, end)); - -} - - -static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv; - - // TODO: resolve the packaging of array (currently sending a single element) - return( - pull16(ppReadPackedMsg, &value->pduBitmap, end) && - pull16(ppReadPackedMsg, &value->rnti, end) && - pull16(ppReadPackedMsg, &value->pduIndex, end) && - pull16(ppReadPackedMsg, &value->BWPSize, end) && - - pull16(ppReadPackedMsg, &value->BWPStart, end) && - pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) && - pull8(ppReadPackedMsg, &value->CyclicPrefix, end) && - pull8(ppReadPackedMsg, &value->NrOfCodewords, end) && - - pullarray16(ppReadPackedMsg, value->targetCodeRate, 2, 1, end) && - pullarray8(ppReadPackedMsg, value->qamModOrder, 2, 1, end) && - pullarray8(ppReadPackedMsg, value->mcsIndex, 2, 1, end) && - pullarray8(ppReadPackedMsg, value->mcsTable, 2, 1, end) && - - pullarray8(ppReadPackedMsg, value->rvIndex, 2, 1, end) && - pullarray32(ppReadPackedMsg, value->TBSize, 2, 1, end) && - pull16(ppReadPackedMsg, &value->dataScramblingId, end) && - pull8(ppReadPackedMsg, &value->nrOfLayers, end) && - - pull8(ppReadPackedMsg, &value->transmissionScheme, end) && - pull8(ppReadPackedMsg, &value->refPoint, end) && - pull16(ppReadPackedMsg, &value->dlDmrsSymbPos, end) && - pull8(ppReadPackedMsg, &value->dmrsConfigType, end) && - - pull16(ppReadPackedMsg, &value->dlDmrsScramblingId, end) && - pull8(ppReadPackedMsg, &value->SCID, end) && - pull8(ppReadPackedMsg, &value->numDmrsCdmGrpsNoData, end) && - pull16(ppReadPackedMsg, &value->dmrsPorts, end) && - - pull8(ppReadPackedMsg, &value->resourceAlloc, end) && - pull16(ppReadPackedMsg, &value->rbStart, end) && - pull16(ppReadPackedMsg, &value->rbSize, end) && - - pull8(ppReadPackedMsg, &value->VRBtoPRBMapping, end) && - pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) && - pull8(ppReadPackedMsg, &value->NrOfSymbols, end) && - pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) && - - pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end) && - pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) && - pull8(ppReadPackedMsg, &value->PTRSReOffset, end) - ); - -} - - -static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - printf("ssb received and unpacked. \n"); - nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv; - - return( - pull16(ppReadPackedMsg, &value->PhysCellId, end) && - pull8(ppReadPackedMsg, &value->BetaPss, end) && - pull8(ppReadPackedMsg, &value->SsbBlockIndex, end) && - pull8(ppReadPackedMsg, &value->SsbSubcarrierOffset, end) && - pull16(ppReadPackedMsg, &value->ssbOffsetPointA, end) && - pull8(ppReadPackedMsg, &value->bchPayloadFlag, end) && - pull32(ppReadPackedMsg, &value->bchPayload, end) - // TODO: pack precoding_and_beamforming too - ); - -} - - -// LTE: -static uint8_t unpack_dl_config_dci_dl_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel8_t* dci_dl_pdu_rel8 = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->dci_format, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->cce_idx, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->aggregation_level, end) && - pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_allocation_type, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->virtual_resource_block_assignment_flag, end) && - pull32(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_block_coding, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_1, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_1, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_1, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_to_codeword_swap_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_2, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_2, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_2, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->harq_process, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpmi, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->pmi, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->precoding_information, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpc, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_assignment_index, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->ngap, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_size_index, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_power_offset, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->allocate_prach_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->preamble_index, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->prach_mask_index, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti_type, end) && - pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->transmission_power, end)); - -} - -static uint8_t unpack_dl_config_dci_dl_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel9_t* dci_dl_pdu_rel9 = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_change_notification, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->scrambling_identity, end)); -} - -static uint8_t unpack_dl_config_dci_dl_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel10_t* dci_dl_pdu_rel10 = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->cross_carrier_scheduling_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->carrier_indicator, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_request, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->antenna_ports_scrambling_and_layers, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->total_dci_length_including_padding, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->n_dl_rb, end)); -} - -static uint8_t unpack_dl_config_dci_dl_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel11_t* dci_dl_pdu_rel11 = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->harq_ack_resource_offset, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->pdsch_re_mapping_quasi_co_location_indicator, end)); -} - -static uint8_t unpack_dl_config_dci_dl_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel12_t* dci_dl_pdu_rel12 = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->primary_cell_type, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->ul_dl_configuration_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->number_ul_dl_configurations, end) && - pullarray8(ppReadPackedMsg, dci_dl_pdu_rel12->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, dci_dl_pdu_rel12->number_ul_dl_configurations, end)); -} - -static uint8_t unpack_tpm_value(uint8_t **ppReadPackedMsg, nfapi_dl_config_dci_dl_tpm_t *value, uint8_t *end) -{ - if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) && - pull8(ppReadPackedMsg, &value->number_of_subbands, end) && - pull8(ppReadPackedMsg, &value->num_antennas, end))) - return 0; - - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_subbands; ++idx) - { - nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]); - - if(!(pull8(ppReadPackedMsg, &subband_info->subband_index, end) && - pull8(ppReadPackedMsg, &subband_info->scheduled_ues, end))) - return 0; - - uint8_t antenna_idx = 0; - uint8_t scheduled_ue_idx = 0; - - for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx) - { - for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx) - { - if(!pull16(ppReadPackedMsg, &(subband_info->precoding_value[antenna_idx][scheduled_ue_idx]), end)) - return 0; - } - } - - } - - - return 1; - -} - - -static uint8_t unpack_dl_config_dci_dl_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dci_dl_pdu_rel13_t* dci_dl_pdu_rel13 = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv; - - // If the length is greater than 5 then the TPM struct flag and possiably the TPM structure have been - // added - uint8_t tpm_struct_flag_present = dci_dl_pdu_rel13->tl.length > 5; - dci_dl_pdu_rel13->tpm_struct_flag = 0; - - return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_flag, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_configuration, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->initial_lbt_sf, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->codebook_size_determination, end) && - pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->drms_table_flag, end) && - ( (tpm_struct_flag_present == 1) ? pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm_struct_flag, end) : 1) && - ( (tpm_struct_flag_present == 1 && dci_dl_pdu_rel13->tpm_struct_flag == 1) ? unpack_tpm_value(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm, end) : 1)); - -} - -static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv; - - return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&bch_pdu_rel8->pdu_index, end) && - pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end)); -} - -static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv; - - return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&mch_pdu_rel8->pdu_index, end) && - pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) && - pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) && - pull8(ppReadPackedMsg, &mch_pdu_rel8->modulation, end) && - pull16(ppReadPackedMsg, &mch_pdu_rel8->transmission_power, end) && - pull16(ppReadPackedMsg, &mch_pdu_rel8->mbsfn_area_id, end)); -} - -static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv; - - if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&dlsch_pdu_rel8->pdu_index, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) && - pull32(ppReadPackedMsg, &dlsch_pdu_rel8->resource_block_coding, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->modulation, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->redundancy_version, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_blocks, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_block_to_codeword_swap_flag, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_scheme, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_layers, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_subbands, end) && - pullarray8(ppReadPackedMsg, dlsch_pdu_rel8->codebook_index, NFAPI_MAX_NUM_SUBBANDS, dlsch_pdu_rel8->number_of_subbands, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ue_category_capacity, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->pa, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->delta_power_offset_index, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ngap, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->nprb, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_mode, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_prb_per_subband, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_vector, end))) - return 0; - - uint16_t j = 0; - for(j = 0; j < dlsch_pdu_rel8->num_bf_vector; ++j) - { - if(!(pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].subband_index, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].num_antennas, end) && - pullarray16(ppReadPackedMsg, dlsch_pdu_rel8->bf_vector[j].bf_value, NFAPI_MAX_NUM_ANTENNAS, dlsch_pdu_rel8->bf_vector[j].num_antennas, end))) - return 0; - } - return 1; -} -static uint8_t unpack_dl_config_dlsch_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel9_t* dlsch_pdu_rel9 = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv; - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel9->nscid, end) ); -} -static uint8_t unpack_dl_config_dlsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel10_t* dlsch_pdu_rel10 = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_flag, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_resource_config_r10, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) && - pullarray8(ppReadPackedMsg, dlsch_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel10->pdsch_start, end)) ; -} -static uint8_t unpack_dl_config_dlsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel11_t* dlsch_pdu_rel11 = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel11->drms_config_flag, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel11->drms_scrambling, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel11->csi_config_flag, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel11->csi_scrambling, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_flag, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_atenna_ports, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_freq_shift, end)); -} -static uint8_t unpack_dl_config_dlsch_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel12_t* dlsch_pdu_rel12 = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel12->altcqi_table_r12, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel12->maxlayers, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel12->n_dl_harq, end)); -} -static uint8_t unpack_dl_config_dlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_dlsch_pdu_rel13_t* dlsch_pdu_rel13 = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel13->dwpts_symbols, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel13->initial_lbt_sf, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel13->ue_type, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel13->pdsch_payload_type, end) && - pull16(ppReadPackedMsg, &dlsch_pdu_rel13->initial_transmission_sf_io, end) && - pull8(ppReadPackedMsg, &dlsch_pdu_rel13->drms_table_flag, end)); -} - -static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv; - - return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&pch_pdu_rel8->pdu_index, end) && - pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) && - pull32(ppReadPackedMsg, &pch_pdu_rel8->resource_block_coding, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->mcs, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->redundancy_version, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_transport_blocks, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->transport_block_to_codeword_swap_flag, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->transmission_scheme, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_layers, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->codebook_index, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->ue_category_capacity, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->pa, end) && - pull16(ppReadPackedMsg, &pch_pdu_rel8->transmission_power, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->nprb, end) && - pull8(ppReadPackedMsg, &pch_pdu_rel8->ngap, end)); -} -static uint8_t unpack_dl_config_pch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_pch_pdu_rel13_t* pch_pdu_rel13 = (nfapi_dl_config_pch_pdu_rel13_t*)tlv; - - return ( pull8(ppReadPackedMsg, &pch_pdu_rel13->ue_mode, end) && - pull16(ppReadPackedMsg, &pch_pdu_rel13->initial_transmission_sf_io, end)); -} - -static uint8_t unpack_dl_config_prs_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_prs_pdu_rel9_t* prs_pdu_rel9 = (nfapi_dl_config_prs_pdu_rel9_t*)tlv; - - return ( pull16(ppReadPackedMsg, &prs_pdu_rel9->transmission_power, end) && - pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_bandwidth, end) && - pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_cyclic_prefix_type, end) && - pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_muting, end)); -} - -static uint8_t unpack_dl_config_csi_rs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_csi_rs_pdu_rel10_t* csi_rs_pdu_rel10 = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv; - - return ( pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_antenna_port_count_r10, end) && - pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_resource_config_r10, end) && - pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->transmission_power, end) && - pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) && - pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end) && - pullarray8(ppReadPackedMsg, csi_rs_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end)); -} - -static uint8_t unpack_dl_config_csi_rs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_csi_rs_pdu_rel13_t* csi_rs_pdu_rel13 = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv; - - if (!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->csi_rs_class, end) && - pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->cdm_type, end) && - pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->num_bf_vector, end))) - return 0; - - - uint16_t idx =0; - for(idx = 0; idx < csi_rs_pdu_rel13->num_bf_vector; ++idx) - { - if(!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].csi_rs_resource_index, end))) - return 0; - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : HOW TO DECODE BF VALUE \n"); - //pullarray16(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].bf_vector, ??); - } - return 1; -} - -static uint8_t unpack_dl_config_epdcch_params_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_epdcch_parameters_rel11_t* epdcch_params_rel11 = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv; - - return (pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_resource_assignment_flag, end) && - pull16(ppReadPackedMsg, &epdcch_params_rel11->epdcch_id, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_start_symbol, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_num_prb, end) && - pullarray8(ppReadPackedMsg, epdcch_params_rel11->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, epdcch_params_rel11->epdcch_num_prb, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.subband_index, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.num_antennas, end) && - pullarray16(ppReadPackedMsg, epdcch_params_rel11->bf_vector.bf_value, NFAPI_MAX_NUM_ANTENNAS, epdcch_params_rel11->bf_vector.num_antennas, end)); -} - -static uint8_t unpack_dl_config_epdcch_params_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_epdcch_parameters_rel13_t* epdcch_params_rel13 = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv; - - return ( pull8(ppReadPackedMsg, &epdcch_params_rel13->dwpts_symbols, end) && - pull8(ppReadPackedMsg, &epdcch_params_rel13->initial_lbt_sf, end)); -} - -static uint8_t unpack_dl_config_mpdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_mpdcch_pdu_rel13_t* mpdcch_params_rel13 = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv; - - - return ( pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_narrow_band, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_prb_pairs, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_assignment, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_tansmission_type, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->start_symbol, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->ecce_index, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->aggregation_level, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->rnti_type, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->rnti, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->ce_mode, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->drms_scrambling_init, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->initial_transmission_sf_io, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->transmission_power, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_format, end) && - pull16(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_coding, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->mcs, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->pdsch_reptition_levels, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->redundancy_version, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->new_data_indicator, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_process, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi_length, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_resource_offset, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_subframe_repetition_number, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpc, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index_length, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->allocate_prach_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->preamble_index, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->prach_mask_index, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->starting_ce_level, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->srs_request, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->frequency_hopping_enabled_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->paging_direct_indication_differentiation_flag, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->direct_indication, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->total_dci_length_including_padding, end) && - pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_tx_antenna_ports, end) && - pullarray16(ppReadPackedMsg, mpdcch_params_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_params_rel13->number_of_tx_antenna_ports, end)); -} - - -static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv; - - return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&nbch_params_rel13->pdu_index, end) && - pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) && - pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end)); -} - -static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv; - - return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&npdcch_params_rel13->pdu_index, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->rnti_type, end) && - pull16(ppReadPackedMsg, &npdcch_params_rel13->rnti, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->scrambling_reinitialization_batch_index, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_format, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->scheduling_delay, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->resource_assignment, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->repetition_number, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->mcs, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->new_data_indicator, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->harq_ack_resource, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->npdcch_order_indication, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->starting_number_of_nprach_repetitions, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->subcarrier_indication_of_nprach, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->paging_direct_indication_differentation_flag, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->direct_indication, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_subframe_repetition_number, end) && - pull8(ppReadPackedMsg, &npdcch_params_rel13->total_dci_length_including_padding, end)); -} - -static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv; - - return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) && - pull16(ppReadPackedMsg, (uint16_t *)&ndlsch_params_rel13->pdu_index, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) && - pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) && - pull16(ppReadPackedMsg, &ndlsch_params_rel13->resource_assignment, end) && - pull16(ppReadPackedMsg, &ndlsch_params_rel13->repetition_number, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->modulation, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->number_of_subframes_for_resource_assignment, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->scrambling_sequence_initialization_cinit, end) && - pull16(ppReadPackedMsg, &ndlsch_params_rel13->sf_idx, end) && - pull8(ppReadPackedMsg, &ndlsch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end)); -} - - -static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)msg; - - if(!(pull16(ppReadPackedMsg, &value->PDUSize, end) && - pull16(ppReadPackedMsg, &value->PDUType, end) )) - return 0; - - - // first match the pdu type, then call the respective function - switch(value->PDUType) - { - case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: - { - if(!(unpack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppReadPackedMsg,end))) - return 0; - } - break; - - case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: - { - if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end))) - return 0; - } - break; - case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: - { - if(!(unpack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppReadPackedMsg,end))) - return 0; - } - break; - case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: - { - if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end))) - return 0; - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType ); - } - break; - } - - return 1; -} - - - - -static uint8_t unpack_dl_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->number_pdcch_ofdm_symbols, end) && - pull8(ppReadPackedMsg, &value->number_dci, end) && - pull16(ppReadPackedMsg, &value->number_pdu, end) && - pull8(ppReadPackedMsg, &value->number_pdsch_rnti, end) && - pull16(ppReadPackedMsg, &value->transmission_power_pcfich, end))) - return 0; - - if(value->number_pdu > NFAPI_DL_CONFIG_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_pdu, NFAPI_DL_CONFIG_MAX_PDU); - return 0; - } - - if(value->number_pdu) - { - value->dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_dl_config_request_pdu_t) * value->number_pdu, config); - if(value->dl_config_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate dl config pdu list (count:%d)\n", __FUNCTION__, value->number_pdu); - return 0; - } - } - else - { - value->dl_config_pdu_list = 0; - } - - uint16_t i; - uint16_t total_number_of_pdus = value->number_pdu; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - { - // pdu end of beyond buffer end - return 0; - } - - switch(pdu->pdu_type) - { - case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value}, - { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_BCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, &unpack_dl_config_bch_pdu_rel8_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_MCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, &unpack_dl_config_mch_pdu_rel8_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, &unpack_dl_config_dlsch_pdu_rel8_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, &unpack_dl_config_dlsch_pdu_rel9_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, &unpack_dl_config_dlsch_pdu_rel10_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, &unpack_dl_config_dlsch_pdu_rel11_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, &unpack_dl_config_dlsch_pdu_rel12_value}, - { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, &unpack_dl_config_dlsch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_PCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, &unpack_dl_config_pch_pdu_rel8_value}, - { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, &unpack_dl_config_pch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_PRS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, &unpack_dl_config_prs_pdu_rel9_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, &unpack_dl_config_csi_rs_pdu_rel10_value}, - { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, &unpack_dl_config_csi_rs_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, &unpack_dl_config_epdcch_params_rel11_value}, - { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, &unpack_dl_config_epdcch_params_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, &unpack_dl_config_mpdcch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, &unpack_dl_config_nbch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, &unpack_dl_config_npdcch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - - } - break; - case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, &unpack_dl_config_ndlsch_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - - } - break; - default: - // Need to log an error - break; - } - } - - return 1; -} - - -static uint8_t unpack_dl_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg; - - if (!(pull16(ppReadPackedMsg,&pNfapiMsg->SFN, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nGroup, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nPDUs, end) && - pullarray8(ppReadPackedMsg,pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, end) - //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end) - )) - return 0; - - int arr[12]; - for(int i=0;idl_tti_request_body.nGroup;i++) - { - for(int j=0;jdl_tti_request_body.nUe[i];j++) - { - arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j]; - } - if(!(pullarrays32(ppReadPackedMsg,arr,12,pNfapiMsg->dl_tti_request_body.nUe[i], end))) - return 0; - } - - for(int i=0;idl_tti_request_body.nPDUs;i++) - { - if(!unpack_dl_tti_request_body_value(ppReadPackedMsg, end, &pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i])) - return 0; - } - -return 1; -} - - -static uint8_t unpack_ul_tti_request_prach_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_prach_pdu_t* prach_pdu = (nfapi_nr_prach_pdu_t*)tlv; - - return( - pull16(ppReadPackedMsg, &prach_pdu->phys_cell_id, end) && - pull8(ppReadPackedMsg, &prach_pdu->num_prach_ocas, end) && - pull8(ppReadPackedMsg, &prach_pdu->prach_format, end) && - pull8(ppReadPackedMsg, &prach_pdu->num_ra, end) && - pull8(ppReadPackedMsg, &prach_pdu->prach_start_symbol, end) && - pull16(ppReadPackedMsg, &prach_pdu->num_cs, end) - // TODO: ignoring beamforming tlv for now - ); -} - - -static uint8_t unpack_ul_tti_request_pucch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_pucch_pdu_t* pucch_pdu = (nfapi_nr_pucch_pdu_t*)tlv; - - return( - pull16(ppReadPackedMsg, &pucch_pdu->rnti, end) && - pull32(ppReadPackedMsg, &pucch_pdu->handle, end) && - pull16(ppReadPackedMsg, &pucch_pdu->bwp_size, end) && - pull16(ppReadPackedMsg, &pucch_pdu->bwp_start, end) && - pull8(ppReadPackedMsg, &pucch_pdu->subcarrier_spacing, end) && - pull8(ppReadPackedMsg, &pucch_pdu->cyclic_prefix, end) && - pull8(ppReadPackedMsg, &pucch_pdu->format_type, end) && - pull8(ppReadPackedMsg, &pucch_pdu->multi_slot_tx_indicator, end) && - pull16(ppReadPackedMsg, &pucch_pdu->prb_start, end) && - pull16(ppReadPackedMsg, &pucch_pdu->prb_size, end) && - pull8(ppReadPackedMsg, &pucch_pdu->start_symbol_index, end) && - pull8(ppReadPackedMsg, &pucch_pdu->nr_of_symbols, end) && - pull8(ppReadPackedMsg, &pucch_pdu->freq_hop_flag, end) && - pull16(ppReadPackedMsg, &pucch_pdu->second_hop_prb, end) && - pull8(ppReadPackedMsg, &pucch_pdu->group_hop_flag, end) && - pull8(ppReadPackedMsg, &pucch_pdu->sequence_hop_flag, end) && - pull16(ppReadPackedMsg, &pucch_pdu->hopping_id, end) && - pull16(ppReadPackedMsg, &pucch_pdu->initial_cyclic_shift, end) && - pull16(ppReadPackedMsg, &pucch_pdu->data_scrambling_id, end) && - pull8(ppReadPackedMsg, &pucch_pdu->time_domain_occ_idx, end) && - pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_idx, end) && - pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_len, end) && - pull8(ppReadPackedMsg, &pucch_pdu->add_dmrs_flag, end) && - pull16(ppReadPackedMsg, &pucch_pdu->dmrs_scrambling_id, end) && - pull8(ppReadPackedMsg, &pucch_pdu->dmrs_cyclic_shift, end) && - pull8(ppReadPackedMsg, &pucch_pdu->sr_flag, end) && - pull8(ppReadPackedMsg, &pucch_pdu->bit_len_harq, end) && - pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part1, end) && - pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part2, end) - // TODO: ignoring beamforming tlv for now - ); -} - - -static uint8_t unpack_ul_tti_request_pusch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_pusch_pdu_t* pusch_pdu = (nfapi_nr_pusch_pdu_t*)tlv; - - if (!( - pull16(ppReadPackedMsg, &pusch_pdu->pdu_bit_map, end) && - pull16(ppReadPackedMsg, &pusch_pdu->rnti, end) && - pull32(ppReadPackedMsg, &pusch_pdu->handle, end) && - pull16(ppReadPackedMsg, &pusch_pdu->bwp_size, end) && - pull16(ppReadPackedMsg, &pusch_pdu->bwp_start, end) && - pull8(ppReadPackedMsg, &pusch_pdu->subcarrier_spacing, end) && - pull8(ppReadPackedMsg, &pusch_pdu->cyclic_prefix, end) && - pull16(ppReadPackedMsg, &pusch_pdu->target_code_rate, end) && - pull8(ppReadPackedMsg, &pusch_pdu->qam_mod_order, end) && - pull8(ppReadPackedMsg, &pusch_pdu->mcs_index, end) && - pull8(ppReadPackedMsg, &pusch_pdu->mcs_table, end) && - pull8(ppReadPackedMsg, &pusch_pdu->transform_precoding, end) && - pull16(ppReadPackedMsg, &pusch_pdu->data_scrambling_id, end) && - pull8(ppReadPackedMsg, &pusch_pdu->nrOfLayers, end) && - pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_symb_pos, end) && - pull8(ppReadPackedMsg, &pusch_pdu->dmrs_config_type, end) && - pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_scrambling_id, end) && - pull8(ppReadPackedMsg, &pusch_pdu->scid, end) && - pull8(ppReadPackedMsg, &pusch_pdu->num_dmrs_cdm_grps_no_data, end) && - pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) && - pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc, end) && - pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc,end) && - pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) && - pull16(ppReadPackedMsg, &pusch_pdu->rb_start, end) && - pull16(ppReadPackedMsg, &pusch_pdu->rb_size, end) && - pull8(ppReadPackedMsg, &pusch_pdu->vrb_to_prb_mapping, end) && - pull8(ppReadPackedMsg, &pusch_pdu->frequency_hopping, end) && - pull16(ppReadPackedMsg, &pusch_pdu->tx_direct_current_location, end) && - pull8(ppReadPackedMsg, &pusch_pdu->uplink_frequency_shift_7p5khz, end) && - pull8(ppReadPackedMsg, &pusch_pdu->start_symbol_index, end) && - pull8(ppReadPackedMsg, &pusch_pdu->nr_of_symbols, end) - // TODO: ignoring beamforming tlv for now - )) - return 0; - - - //Pack Optional Data only included if indicated in pduBitmap - switch(pusch_pdu->pdu_bit_map){ - case PUSCH_PDU_BITMAP_PUSCH_DATA: - { - // pack optional TLVs - return( - pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.rv_index, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.harq_process_id, end) && - pull32(ppReadPackedMsg, &pusch_pdu->pusch_data.tb_size, end) && - pull16(ppReadPackedMsg, &pusch_pdu->pusch_data.num_cb, end) && - pullarray8(ppReadPackedMsg, pusch_pdu->pusch_data.cb_present_and_position,1,1,end) - ); - } - break; - - case PUSCH_PDU_BITMAP_PUSCH_UCI: - { - return( - pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.harq_ack_bit_length, end) && - pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part1_bit_length, end) && - pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part2_bit_length, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.alpha_scaling, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_harq_ack, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi1, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi2, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_PUSCH_PTRS: - { - return( - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.num_ptrs_ports, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, end) && -+ pull16(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, end) && -+ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_time_density, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_freq_density, end) && - pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ul_ptrs_power, end) - ); - } - break; - - case PUSCH_PDU_BITMAP_DFTS_OFDM: - { - return( - pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_group_number, end) && - pull16(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_sequence_number, end) && - pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, end) && - pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, end) - ); - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map ); - } - } - - return 1; -} - - -static uint8_t unpack_ul_tti_request_srs_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nr_srs_pdu_t* srs_pdu = (nfapi_nr_srs_pdu_t*)tlv; - - return( - pull16(ppReadPackedMsg, &srs_pdu->rnti, end) && - pull32(ppReadPackedMsg, &srs_pdu->handle, end) && - pull16(ppReadPackedMsg, &srs_pdu->bwp_size, end) && - pull16(ppReadPackedMsg, &srs_pdu->bwp_start, end) && - pull8(ppReadPackedMsg, &srs_pdu->subcarrier_spacing, end) && - pull8(ppReadPackedMsg, &srs_pdu->cyclic_prefix, end) && - pull8(ppReadPackedMsg, &srs_pdu->num_ant_ports, end) && - pull8(ppReadPackedMsg, &srs_pdu->num_symbols, end) && - pull8(ppReadPackedMsg, &srs_pdu->num_repetitions, end) && - pull8(ppReadPackedMsg, &srs_pdu->time_start_position, end) && - pull8(ppReadPackedMsg, &srs_pdu->config_index, end) && - pull16(ppReadPackedMsg, &srs_pdu->sequence_id, end) && - pull8(ppReadPackedMsg, &srs_pdu->bandwidth_index, end) && - pull8(ppReadPackedMsg, &srs_pdu->comb_size, end) && - pull8(ppReadPackedMsg, &srs_pdu->comb_offset, end) && - pull8(ppReadPackedMsg, &srs_pdu->cyclic_shift, end) && - pull8(ppReadPackedMsg, &srs_pdu->frequency_position, end) && - pull8(ppReadPackedMsg, &srs_pdu->frequency_shift, end) && - pull8(ppReadPackedMsg, &srs_pdu->frequency_hopping, end) && - pull8(ppReadPackedMsg, &srs_pdu->group_or_sequence_hopping, end) && - pull8(ppReadPackedMsg, &srs_pdu->resource_type, end) && - pull16(ppReadPackedMsg, &srs_pdu->t_srs, end) && - pull16(ppReadPackedMsg, &srs_pdu->t_offset, end) - // TODO: ignoring beamforming tlv for now - ); -} - - -static uint8_t unpack_ul_tti_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_ul_tti_request_number_of_pdus_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_pdus_t*)msg; - - if(!(pull16(ppReadPackedMsg, &pNfapiMsg->pdu_size, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->pdu_type, end) )) - return 0; - - - // first natch the pdu type, then call the respective function - switch(pNfapiMsg->pdu_type) - { - - case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE: - { - if(!unpack_ul_tti_request_prach_pdu(&pNfapiMsg->prach_pdu, ppReadPackedMsg, end)) - return 0; - } - break; - - case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: - { - if(!unpack_ul_tti_request_pucch_pdu(&pNfapiMsg->pucch_pdu, ppReadPackedMsg, end)) - return 0; - } - break; - - case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: - { - if(!unpack_ul_tti_request_pusch_pdu(&pNfapiMsg->pusch_pdu, ppReadPackedMsg, end)) - return 0; - } - break; - - case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE: - { - if(!unpack_ul_tti_request_srs_pdu(&pNfapiMsg->srs_pdu, ppReadPackedMsg, end)) - return 0; - } - break; - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", pNfapiMsg->pdu_type ); - } - break; - - - } - - return 1; -} - - -static uint8_t unpack_ul_tti_groups_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_ul_tti_request_number_of_groups_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_groups_t*)msg; - - if(!pull8(ppReadPackedMsg, &pNfapiMsg->n_ue, end)) - return 0; - for (int i = 0; i < pNfapiMsg->n_ue; i++) - { - if(!pull8(ppReadPackedMsg, &pNfapiMsg->ue_list[i].pdu_idx ,end) ) - return 0; - } - return 1; -} - - -static uint8_t unpack_ul_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg; - - if (!( - pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end) )) - return 0; - - for(int i=0; i< pNfapiMsg->n_pdus; i++) - { - if (!unpack_ul_tti_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdus_list[i])) - return 0; - } - - for(int i=0; i< pNfapiMsg->n_group; i++) - { - if (!unpack_ul_tti_groups_list_value(ppReadPackedMsg, end, &pNfapiMsg->groups_list[i])) - return 0; - } - - return 1; -} - - - -static uint8_t unpack_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, &unpack_dl_config_request_body_value}, - }; - - return ( pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_ul_config_ulsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - - - - nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv; - - return (pull32(ppReadPackedMsg, &ulsch_pdu_rel8->handle, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel8->size, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->resource_block_start, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->number_of_resource_blocks, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->modulation_type, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->cyclic_shift_2_for_drms, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_enabled_flag, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_bits, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->new_data_indication, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->redundancy_version, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->harq_process_number, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->ul_tx_mode, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->current_tx_nb, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel8->n_srs, end )); -} - -static uint8_t unpack_ul_config_ulsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &ulsch_pdu_rel10->resource_allocation_type, end) && - pull32(ppReadPackedMsg, &ulsch_pdu_rel10->resource_block_coding, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transport_blocks, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transmission_scheme, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->number_of_layers, end) & - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->codebook_index, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel10->disable_sequence_hopping_flag, end)); -} -static uint8_t unpack_ul_config_ulsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv; - - return ( pull8(ppReadPackedMsg, &ulsch_pdu_rel11->virtual_cell_id_enabled_flag, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel11->npusch_identity, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel11->dmrs_config_flag, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel11->ndmrs_csh_identity, end)); -} -static uint8_t unpack_ul_config_ulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &ulsch_pdu_rel13->ue_type, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel13->total_number_of_repetitions, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel13->repetition_number, end) && - pull16(ppReadPackedMsg, &ulsch_pdu_rel13->initial_transmission_sf_io, end) && - pull8(ppReadPackedMsg, &ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, end)); -} -static uint8_t unpack_ul_config_cqi_ri_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv; - - return (pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel8->ri_size, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_cqi, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_ri, end)); -} - -static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->report_type, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_cqi, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_ri, end))) - return 0; - - switch(cqi_ri_info_rel9->report_type) - { - case NFAPI_CSI_REPORT_TYPE_PERIODIC: - { - if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, end) && - pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, end))) - return 0; - } - break; - case NFAPI_CSI_REPORT_TYPE_APERIODIC: - { - if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, end) ==0) - return 0; - - uint8_t i; - for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i) - { - if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0) - return 0; - - uint8_t j; - for(j = 0; j < 8; ++j) - { - if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0) - return 0; - } - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type ); - return 0; - } - break; - }; - return 1; -} - -// NOTE : This function is a little unconventional as we uese the side to -// determine the report type -static uint8_t unpack_ul_config_cqi_ri_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv; - if(cqi_ri_info_rel13->tl.length == 0) - { - cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_APERIODIC; - } - else - { - cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_PERIODIC; - if(pull16(ppReadPackedMsg, &cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, end) == 0) - return 0; - } - return 1; -} -static uint8_t unpack_ul_config_cqi_init_tx_params_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv; - - return (pull8(ppReadPackedMsg, &init_tx_params_rel8->n_srs_initial, end) && - pull8(ppReadPackedMsg, &init_tx_params_rel8->initial_number_of_resource_blocks, end)); -} -static uint8_t unpack_ul_config_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &harq_info_rel10->harq_size, end) && - pull8(ppReadPackedMsg, &harq_info_rel10->delta_offset_harq, end) && - pull8(ppReadPackedMsg, &harq_info_rel10->ack_nack_mode, end)); -} - -static uint8_t unpack_ul_config_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv; - - return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->delta_offset_harq_2, end)); -} - -static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv; - - return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) && - pull16(ppReadPackedMsg, (uint16_t *)&ue_info_rel8->rnti, end)); -} -static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv; - - return (pull8(ppReadPackedMsg, &ue_info_rel11->virtual_cell_id_enabled_flag, end) && - pull16(ppReadPackedMsg, &ue_info_rel11->npusch_identity, end)); -} -static uint8_t unpack_ul_config_ue_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &ue_info_rel13->ue_type, end) && - pull8(ppReadPackedMsg, &ue_info_rel13->empty_symbols, end) && - pull16(ppReadPackedMsg, &ue_info_rel13->total_number_of_repetitions, end) && - pull16(ppReadPackedMsg, &ue_info_rel13->repetition_number, end)); -} - -static uint8_t unpack_ul_config_cqi_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv; - - return ( pull16(ppReadPackedMsg, &cqi_info_rel8->pucch_index, end) && - pull8(ppReadPackedMsg, &cqi_info_rel8->dl_cqi_pmi_size, end)); -} -static uint8_t unpack_ul_config_cqi_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &cqi_info_rel10->number_of_pucch_resource, end) && - pull16(ppReadPackedMsg, &cqi_info_rel10->pucch_index_p1, end)); -} -static uint8_t unpack_ul_config_cqi_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &cqi_info_rel13->csi_mode, end) && - pull16(ppReadPackedMsg, &cqi_info_rel13->dl_cqi_pmi_size_2, end) && - pull8(ppReadPackedMsg, &cqi_info_rel13->starting_prb, end) && - pull8(ppReadPackedMsg, &cqi_info_rel13->n_prb, end) && - pull8(ppReadPackedMsg, &cqi_info_rel13->cdm_index, end) && - pull8(ppReadPackedMsg, &cqi_info_rel13->n_srs, end)); -} - -static uint8_t unpack_ul_config_sr_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv; - - return ( pull16(ppReadPackedMsg, &sr_info_rel8->pucch_index, end)); -} - -static uint8_t unpack_ul_config_sr_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &sr_info_rel10->number_of_pucch_resources, end) && - pull16(ppReadPackedMsg, &sr_info_rel10->pucch_index_p1, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_tdd_rel10 = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv; - - return (pull8(ppReadPackedMsg, &harq_info_tdd_rel10->harq_size, end) && - pull8(ppReadPackedMsg, &harq_info_tdd_rel10->ack_nack_mode, end) && - pull8(ppReadPackedMsg, &harq_info_tdd_rel10->number_of_pucch_resources, end) && - pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_0, end) && - pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_1, end) && - pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_2, end) && - pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_3, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_fdd_rel8 = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv; - - return (pull16(ppReadPackedMsg, &harq_info_fdd_rel8->n_pucch_1_0, end) && - pull8(ppReadPackedMsg, &harq_info_fdd_rel8->harq_size, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_fdd_rel9 = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv; - - return (pull8(ppReadPackedMsg, &harq_info_fdd_rel9->harq_size, end) && - pull8(ppReadPackedMsg, &harq_info_fdd_rel9->ack_nack_mode, end) && - pull8(ppReadPackedMsg, &harq_info_fdd_rel9->number_of_pucch_resources, end) && - pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_0, end) && - pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_1, end) && - pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_2, end) && - pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_3, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv; - - return (pull8(ppReadPackedMsg, &harq_info_rel11->num_ant_ports, end) && - pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_0, end) && - pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_1, end) && - pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_2, end) && - pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_3, end)); -} - -static uint8_t unpack_ul_config_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv; - - return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->starting_prb, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->n_prb, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->cdm_index, end) && - pull8(ppReadPackedMsg, &harq_info_rel13->n_srs, end)); -} - - -static uint8_t unpack_ul_config_srs_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv; - - return (pull32(ppReadPackedMsg, &srs_pdu_rel8->handle, end) && - pull16(ppReadPackedMsg, &srs_pdu_rel8->size, end) && - pull16(ppReadPackedMsg, &srs_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_bandwidth, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->frequency_domain_position, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_hopping_bandwidth, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->transmission_comb, end) && - pull16(ppReadPackedMsg, &srs_pdu_rel8->i_srs, end) && - pull8(ppReadPackedMsg, &srs_pdu_rel8->sounding_reference_cyclic_shift, end)); -} - -static uint8_t unpack_ul_config_srs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv; - return pull8(ppReadPackedMsg, &srs_pdu_rel10->antenna_port, end); -} - -static uint8_t unpack_ul_config_srs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &srs_pdu_rel13->number_of_combs, end)); -} - -static uint8_t unpack_ul_nb_harq_info_rel13_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_info_fdd_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv; - - return (pull8(ppReadPackedMsg, &nb_harq_info_fdd_rel13->harq_ack_resource, end)); -} - -static uint8_t unpack_ul_config_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &nulsch_pdu_rel13->nulsch_format, end) && - pull32(ppReadPackedMsg, &nulsch_pdu_rel13->handle, end) && - pull16(ppReadPackedMsg, &nulsch_pdu_rel13->size, end) && - pull16(ppReadPackedMsg, &nulsch_pdu_rel13->rnti, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->subcarrier_indication, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->resource_assignment, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->mcs, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->redudancy_version, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->repetition_number, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->new_data_indication, end) && - pull8(ppReadPackedMsg, &nulsch_pdu_rel13->n_srs, end) && - pull16(ppReadPackedMsg, &nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, end) && - pull16(ppReadPackedMsg, &nulsch_pdu_rel13->sf_idx, end))) - return 0; - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value}, - { NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, &unpack_ul_nb_harq_info_rel13_fdd_value}, - }; - - return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, 0, 0); -} - -static uint8_t unpack_ul_config_nrach_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_0, end) && - pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_1, end) && - pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_2, end)); -} - - -static uint8_t unpack_ul_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - #define UL_CONFIG_ULSCH_PDU_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &_pdu.ulsch_pdu_rel8, &unpack_ul_config_ulsch_pdu_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &_pdu.ulsch_pdu_rel10, &unpack_ul_config_ulsch_pdu_rel10_value}, \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &_pdu.ulsch_pdu_rel11, &unpack_ul_config_ulsch_pdu_rel11_value}, \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &_pdu.ulsch_pdu_rel13, &unpack_ul_config_ulsch_pdu_rel13_value}, - - #define UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &_pdu.cqi_ri_information_rel8, &unpack_ul_config_cqi_ri_info_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &_pdu.cqi_ri_information_rel9, &unpack_ul_config_cqi_ri_info_rel9_value}, \ - { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &_pdu.cqi_ri_information_rel13, &unpack_ul_config_cqi_ri_info_rel13_value}, - - #define UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &_pdu.harq_information_rel10, &unpack_ul_config_ulsch_harq_info_rel10_value},\ - { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_ulsch_harq_info_rel13_value}, - - #define UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &_pdu.initial_transmission_parameters_rel8, &unpack_ul_config_cqi_init_tx_params_rel8_value}, - - #define UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &_pdu.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &_pdu.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, \ - { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &_pdu.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value}, - - #define UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &_pdu.cqi_information_rel8, &unpack_ul_config_cqi_info_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &_pdu.cqi_information_rel10, &unpack_ul_config_cqi_info_rel10_value}, \ - { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &_pdu.cqi_information_rel13, &unpack_ul_config_cqi_info_rel13_value}, - - #define UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &_pdu.sr_information_rel8, &unpack_ul_config_sr_info_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &_pdu.sr_information_rel10, &unpack_ul_config_sr_info_rel10_value}, - - #define UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &_pdu.harq_information_rel10_tdd, &unpack_ul_config_harq_info_rel10_tdd_value}, \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &_pdu.harq_information_rel8_fdd, &unpack_ul_config_harq_info_rel8_fdd_value}, \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &_pdu.harq_information_rel9_fdd, &unpack_ul_config_harq_info_rel9_fdd_value}, \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &_pdu.harq_information_rel11, &unpack_ul_config_harq_info_rel11_value}, \ - { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_harq_info_rel13_value}, - - #define UL_CONFIG_SRS_PDU_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &_pdu.srs_pdu_rel8, &unpack_ul_config_srs_pdu_rel8_value}, \ - { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &_pdu.srs_pdu_rel10, &unpack_ul_config_srs_pdu_rel10_value}, \ - { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &_pdu.srs_pdu_rel13, &unpack_ul_config_srs_pdu_rel13_value}, - - #define UL_CONFIG_NULSCH_PDU_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &_pdu.nulsch_pdu_rel13, &unpack_ul_config_nulsch_pdu_rel13_value}, - - #define UL_CONFIG_NRACH_PDU_UNPACK_FNS(_pdu) \ - { NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &_pdu.nrach_pdu_rel13, &unpack_ul_config_nrach_pdu_rel13_value}, - - - nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->number_of_pdus, end) && - pull8(ppReadPackedMsg, &value->rach_prach_frequency_resources, end) && - pull8(ppReadPackedMsg, &value->srs_present, end))) - return 0; - - if(value->number_of_pdus > NFAPI_UL_CONFIG_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of ul config pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_UL_CONFIG_MAX_PDU); - return 0; - } - - if(value->number_of_pdus > 0) - { - value->ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_ul_config_request_pdu_t) * value->number_of_pdus, config); - - if(value->ul_config_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate ul config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); - return 0; - } - } - else - { - value->ul_config_pdu_list = 0; - } - - - uint16_t i; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - { - // pdu end is past buffer end - return 0; - } - - switch(pdu->pdu_type) - { - case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_pdu) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - - case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.ulsch_pdu) - UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.cqi_ri_information) - UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_harq_pdu.ulsch_pdu) - UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_harq_pdu.harq_information) - UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_harq_pdu.initial_transmission_parameters) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu) - UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information) - UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.harq_information) - UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.ue_information) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.cqi_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_pdu.ue_information) - UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_pdu.sr_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_harq_pdu.ue_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.ue_information) - UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.sr_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.ue_information) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.cqi_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.ue_information) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.cqi_information) - UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.sr_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.ue_information) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.cqi_information) - UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.sr_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_SRS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_SRS_PDU_UNPACK_FNS(pdu->srs_pdu) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->harq_buffer_pdu.ue_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.ulsch_pdu) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.csi_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.ulsch_pdu) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu) - UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.csi_information) - UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.harq_information) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_NULSCH_PDU_UNPACK_FNS(pdu->nulsch_pdu) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - UL_CONFIG_NRACH_PDU_UNPACK_FNS(pdu->nrach_pdu) - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - } - } - return 1; -} - - -static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, &unpack_ul_config_request_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv; - - return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) && - pull8(ppReadPackedMsg, &hi_pdu_rel8->cyclic_shift_2_for_drms, end) && - pull8(ppReadPackedMsg, &hi_pdu_rel8->hi_value, end) && - pull8(ppReadPackedMsg, &hi_pdu_rel8->i_phich, end) && - pull16(ppReadPackedMsg, &hi_pdu_rel8->transmission_power, end)); -} - -static uint8_t unpack_hi_dci0_hi_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &hi_pdu_rel10->flag_tb2, end) && - pull8(ppReadPackedMsg, &hi_pdu_rel10->hi_value_2, end)); -} - -static uint8_t unpack_hi_dci0_dci_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_pdu_rel8->dci_format, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->cce_index, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->aggregation_level, end) && - pull16(ppReadPackedMsg, &dci_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->resource_block_start, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->number_of_resource_block, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->mcs_1, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->cyclic_shift_2_for_drms, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_enabled_flag, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_bits, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->new_data_indication_1, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->ue_tx_antenna_seleciton, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->tpc, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->cqi_csi_request, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->ul_index, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel8->dl_assignment_index, end) && - pull32(ppReadPackedMsg, &dci_pdu_rel8->tpc_bitmap, end) && - pull16(ppReadPackedMsg, &dci_pdu_rel8->transmission_power, end)); -} - -static uint8_t unpack_hi_dci0_dci_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv; - - return (pull8(ppReadPackedMsg, &dci_pdu_rel10->cross_carrier_scheduling_flag, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->carrier_indicator, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->size_of_cqi_csi_feild, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_flag, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_request, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_flag, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_type, end) && - pull32(ppReadPackedMsg, &dci_pdu_rel10->resource_block_coding, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->mcs_2, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->new_data_indication_2, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->number_of_antenna_ports, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->tpmi, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->total_dci_length_including_padding, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel10->n_ul_rb, end)); -} - -static uint8_t unpack_hi_dci0_dci_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv; - - return ( pull8(ppReadPackedMsg, &dci_pdu_rel12->pscch_resource, end) && - pull8(ppReadPackedMsg, &dci_pdu_rel12->time_resource_pattern, end)); -} - -static uint8_t unpack_hi_dci0_mpdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->mpdcch_narrowband, end) && - pull8(ppReadPackedMsg, &value->number_of_prb_pairs, end) && - pull8(ppReadPackedMsg, &value->resource_block_assignment, end) && - pull8(ppReadPackedMsg, &value->mpdcch_transmission_type, end) && - pull8(ppReadPackedMsg, &value->start_symbol, end) && - pull8(ppReadPackedMsg, &value->ecce_index, end) && - pull8(ppReadPackedMsg, &value->aggreagation_level, end) && - pull8(ppReadPackedMsg, &value->rnti_type, end) && - pull16(ppReadPackedMsg, &value->rnti, end) && - pull8(ppReadPackedMsg, &value->ce_mode, end) && - pull16(ppReadPackedMsg, &value->drms_scrambling_init, end) && - pull16(ppReadPackedMsg, &value->initial_transmission_sf_io, end) && - pull16(ppReadPackedMsg, &value->transmission_power, end) && - pull8(ppReadPackedMsg, &value->dci_format, end) && - pull8(ppReadPackedMsg, &value->resource_block_start, end) && - pull8(ppReadPackedMsg, &value->number_of_resource_blocks, end) && - pull8(ppReadPackedMsg, &value->mcs, end) && - pull8(ppReadPackedMsg, &value->pusch_repetition_levels, end) && - pull8(ppReadPackedMsg, &value->frequency_hopping_flag, end) && - pull8(ppReadPackedMsg, &value->new_data_indication, end) && - pull8(ppReadPackedMsg, &value->harq_process, end) && - pull8(ppReadPackedMsg, &value->redudency_version, end) && - pull8(ppReadPackedMsg, &value->tpc, end) && - pull8(ppReadPackedMsg, &value->csi_request, end) && - pull8(ppReadPackedMsg, &value->ul_inex, end) && - pull8(ppReadPackedMsg, &value->dai_presence_flag, end) && - pull8(ppReadPackedMsg, &value->dl_assignment_index, end) && - pull8(ppReadPackedMsg, &value->srs_request, end) && - pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end) && - pull32(ppReadPackedMsg, &value->tcp_bitmap, end) && - pull8(ppReadPackedMsg, &value->total_dci_length_include_padding, end) && - pull8(ppReadPackedMsg, &value->number_of_tx_antenna_ports, end) && - pullarray16(ppReadPackedMsg, value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, end)); -} - -static uint8_t unpack_hi_dci0_npdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->ncce_index, end) && - pull8(ppReadPackedMsg, &value->aggregation_level, end) && - pull8(ppReadPackedMsg, &value->start_symbol, end) && - pull16(ppReadPackedMsg, &value->rnti, end) && - pull8(ppReadPackedMsg, &value->scrambling_reinitialization_batch_index, end) && - pull8(ppReadPackedMsg, &value->nrs_antenna_ports_assumed_by_the_ue, end) && - pull8(ppReadPackedMsg, &value->subcarrier_indication, end) && - pull8(ppReadPackedMsg, &value->resource_assignment, end) && - pull8(ppReadPackedMsg, &value->scheduling_delay, end) && - pull8(ppReadPackedMsg, &value->mcs, end) && - pull8(ppReadPackedMsg, &value->redudancy_version, end) && - pull8(ppReadPackedMsg, &value->repetition_number, end) && - pull8(ppReadPackedMsg, &value->new_data_indicator, end) && - pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end)); -} - -static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv; - - if(!(pull16(ppReadPackedMsg, &value->sfnsf, end) && - pull8(ppReadPackedMsg, &value->number_of_dci, end) && - pull8(ppReadPackedMsg, &value->number_of_hi, end))) - return 0; - - uint8_t totalNumPdus = value->number_of_hi + value->number_of_dci; - - if(totalNumPdus > NFAPI_HI_DCI0_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dci0 pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, totalNumPdus, NFAPI_HI_DCI0_MAX_PDU); - return 0; - } - - if(totalNumPdus > 0) - { - value->hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_hi_dci0_request_pdu_t) * totalNumPdus, config); - if(value->hi_dci0_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate hi dci0 pdu list (count:%d)\n", __FUNCTION__, totalNumPdus); - return 0; - } - } - else - { - value->hi_dci0_pdu_list = 0; - } - - uint8_t i; - for(i = 0; i < totalNumPdus; ++i) - { - nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - { - // pdu end if past buffer end - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size to big %d %d\n", __FUNCTION__, packedPduEnd, end); - return 0; - } - - switch(pdu->pdu_type) - { - case NFAPI_HI_DCI0_HI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, &unpack_hi_dci0_hi_pdu_rel8_value}, - { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, &unpack_hi_dci0_hi_pdu_rel10_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_HI_DCI0_DCI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value}, - { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value}, - { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, &unpack_hi_dci0_dci_pdu_rel12_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value}, - { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value}, - { NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, &unpack_dl_config_epdcch_params_rel11_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, &unpack_hi_dci0_mpdcch_dci_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, &unpack_hi_dci0_npdcch_dci_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); - } - break; - }; - } - - return 1; -} -//unpack_ul_dci_pdu_list_value - -static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)msg; - for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) - { - if(!(pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, end) && - - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, end) && - - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end) && - - pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end))) - - return 0; - } - - return (pull16(ppReadPackedMsg, &value->PDUType, end) && - pull16(ppReadPackedMsg, &value->PDUSize, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, end) && - - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, end) && - pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, end) && - - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, end) && - pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, end) && - pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, end)); - -} - -static uint8_t unpack_ul_dci_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ -nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg; - - if (!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && - pull8(ppReadPackedMsg, &pNfapiMsg->numPdus, end) - )) - return 0; - for(int i=0; i< pNfapiMsg->numPdus; i++) - { - if (!unpack_ul_dci_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->ul_dci_pdu_list[i])) - return 0; - } - - return 1; - -} - -static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, &unpack_hi_dci0_request_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); - -} -static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) -{ - nfapi_nr_pdu_t* pNfapiMsg = (nfapi_nr_pdu_t*)msg; - - if(!(pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->PDU_length, end) - )) - return 0; - - uint16_t i = 0; - uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV; - for(; i < total_number_of_tlvs; ++i) - { - - if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end))) - return 0; - - switch(pNfapiMsg->TLVs[i].tag){ - case 0: - { - if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct, 16384, pNfapiMsg->TLVs[i].length, end)) - return 0; - break; - - } - - case 1: - { - if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.ptr, pNfapiMsg->TLVs[i].length , pNfapiMsg->TLVs[i].length, end)) - return 0; - break; - - } - - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", pNfapiMsg->TLVs[i].tag ); - break; - } - - } - } - - - return 1; -} - -static uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg; - - if(!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && - pull16(ppReadPackedMsg, &pNfapiMsg->Number_of_PDUs, end))) - return 0; - - for(int i=0; i< pNfapiMsg->Number_of_PDUs; i++) - { - if (!unpack_tx_data_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdu_list[i])) - return 0; - } - - return 1; -} - -static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - uint8_t proceed = 1; - nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg; - - if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0) - return 0; - - while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed) - { - nfapi_tl_t generic_tl; - if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) - return 0; - - switch(generic_tl.tag) - { - case NFAPI_TX_REQUEST_BODY_TAG: - { - pNfapiMsg->tx_request_body.tl = generic_tl; - - if( pull16(ppReadPackedMsg, &pNfapiMsg->tx_request_body.number_of_pdus, end) == 0) - return 0; - - if(pNfapiMsg->tx_request_body.number_of_pdus > NFAPI_TX_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of tx pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus, NFAPI_TX_MAX_PDU); - return 0; - } - - if(pNfapiMsg->tx_request_body.number_of_pdus > 0) - { - pNfapiMsg->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_tx_request_pdu_t) * pNfapiMsg->tx_request_body.number_of_pdus, config); - if(pNfapiMsg->tx_request_body.tx_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate tx pdu list (count:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus); - return 0; - } - } - else - { - pNfapiMsg->tx_request_body.tx_pdu_list = 0; - } - - - uint16_t i; - uint16_t totalNumPdus = pNfapiMsg->tx_request_body.number_of_pdus; - for(i = 0; i < totalNumPdus; ++i) - { - nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]); - if (pdu) { - uint16_t length = 0; - uint16_t index = 0; - - if(!(pull16(ppReadPackedMsg, &length, end) && - pull16(ppReadPackedMsg, &index, end))) - return 0; - - pdu->pdu_length = length; - pdu->pdu_index = index; - - - // TODO : May need to rethink this bit - pdu->num_segments = 1; - pdu->segments[0].segment_length = pdu->pdu_length; - pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config); - - if(pdu->segments[0].segment_data) - { - if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end)) - return 0; - if (pdu->segments[0].segment_length == 3) - { - NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, - pdu->segments[0].segment_data[0], - pdu->segments[0].segment_data[1], - pdu->segments[0].segment_data[2] - ); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index); - } - } else { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n"); - } - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request FIXME : Invalid pdu type %d \n", generic_tl.tag ); - } - break; - }; - } - - return 1; -} - -static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - uint8_t proceed = 1; - nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; - - if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0) - return 0; - - while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed) - { - nfapi_tl_t generic_tl; - if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) - return 0; - - switch(generic_tl.tag) - { - case NFAPI_UE_RELEASE_BODY_TAG: - { - pNfapiMsg->ue_release_request_body.tl = generic_tl; - if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0) - return 0; - - if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI); - return 0; - } else { - uint8_t j; - uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs; - for(j = 0; j < num; ++j){ - if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){ - return 0; - } - } - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag ); - } - break; - }; - } - - return 1; -} - -static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->value_0, end) && - pull8(ppReadPackedMsg, &value->value_1, end)); -} - -static uint8_t unpack_harq_indication_tdd_harq_data_multiplexing(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_harq_data_multiplexing_t* value = (nfapi_harq_indication_tdd_harq_data_multiplexing_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->value_0, end) && - pull8(ppReadPackedMsg, &value->value_1, end) && - pull8(ppReadPackedMsg, &value->value_2, end) && - pull8(ppReadPackedMsg, &value->value_3, end)); -} -static uint8_t unpack_harq_indication_tdd_harq_data_special_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_harq_data_special_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_special_bundling_t*)tlv; - return ( pull8(ppReadPackedMsg, &value->value_0, end)); -} -static uint8_t unpack_harq_indication_tdd_harq_data(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_harq_data_t* value = (nfapi_harq_indication_tdd_harq_data_t*)tlv; - return (pull8(ppReadPackedMsg, &value->value_0, end)); -} - -static uint8_t unpack_harq_indication_tdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel8_t* value = (nfapi_harq_indication_tdd_rel8_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->mode, end) && - pull8(ppReadPackedMsg, &value->number_of_ack_nack, end))) - return 0; - - uint8_t result = 0; - switch(value->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = unpack_harq_indication_tdd_harq_data_bundling(&value->harq_data.bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = unpack_harq_indication_tdd_harq_data_multiplexing(&value->harq_data.multiplex, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data.special_bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = 1; - break; - default: - // TODO add error message - return 0; - break; - } - return result; -} - -static uint8_t unpack_harq_indication_tdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel9_t* value = (nfapi_harq_indication_tdd_rel9_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->mode, end) && - pull8(ppReadPackedMsg, &value->number_of_ack_nack, end))) - return 0; - - if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD) - { - // TODO : add error message - return 0; - } - - uint16_t idx = 0; - for(idx = 0; idx < value->number_of_ack_nack; ++idx) - { - uint8_t result = 0; - switch(value->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end); - break; - default: - // TODO add error message - return 0; - break; - } - - if(result == 0) - return 0; - } - return 1; -} - -static uint8_t unpack_harq_indication_tdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_tdd_rel13_t* value = (nfapi_harq_indication_tdd_rel13_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->mode, end) && - pull16(ppReadPackedMsg, &value->number_of_ack_nack, end))) - return 0; - - if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD) - { - // TODO : add error message - return 0; - } - - uint16_t idx = 0; - for(idx = 0; idx < value->number_of_ack_nack; ++idx) - { - uint8_t result = 0; - switch(value->mode) - { - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: - result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_4, ppReadPackedMsg, end); - break; - case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5: - result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_5, ppReadPackedMsg, end); - break; - default: - // TODO add error message - return 0; - break; - } - - if(result == 0) - return 0; - } - return 1; -} - -static uint8_t unpack_harq_indication_fdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel8_t* value = (nfapi_harq_indication_fdd_rel8_t*)tlv; - return (pull8(ppReadPackedMsg, &value->harq_tb1, end) && - pull8(ppReadPackedMsg, &value->harq_tb2, end)); -} - -static uint8_t unpack_harq_indication_fdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel9_t* value = (nfapi_harq_indication_fdd_rel9_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->mode, end) && - pull8(ppReadPackedMsg, &value->number_of_ack_nack, end) && - pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, value->number_of_ack_nack, end)); -} - -static uint8_t unpack_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_harq_indication_fdd_rel13_t* value = (nfapi_harq_indication_fdd_rel13_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->mode, end) && - pull16(ppReadPackedMsg, &value->number_of_ack_nack, end) && - pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, value->number_of_ack_nack, end)); -} - -static uint8_t unpack_ul_cqi_information_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv; - - return (pull8(ppReadPackedMsg, &value->ul_cqi, end) && - pull8(ppReadPackedMsg, &value->channel, end)); -} - - - -static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv; - uint8_t* harqBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(harqBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0) - return 0; - - if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU); - return 0; - } - - value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * value->number_of_harqs, config); - if(value->harq_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs); - return 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_harqs; ++i) - { - nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]); - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, &unpack_harq_indication_tdd_rel8_value}, - { NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, &unpack_harq_indication_tdd_rel9_value}, - { NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, &unpack_harq_indication_tdd_rel13_value}, - { NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, &unpack_harq_indication_fdd_rel8_value}, - { NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, &unpack_harq_indication_fdd_rel9_value}, - { NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, &unpack_harq_indication_fdd_rel13_value}, - { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value} - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0) - return 0; - - } - - return 1; -} - -static uint8_t unpack_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, &unpack_harq_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_crc_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_crc_indication_rel8_t* crc_pdu_rel8 = (nfapi_crc_indication_rel8_t*)tlv; - return ( pull8(ppReadPackedMsg, &crc_pdu_rel8->crc_flag, end) ); -} - -static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv; - uint8_t* crcBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(crcBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_crcs, end) == 0) - return 0; - - if(value->number_of_crcs > NFAPI_CRC_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of crc ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_crcs, NFAPI_CRC_IND_MAX_PDU); - return 0; - } - - if(value->number_of_crcs > 0) - { - value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * value->number_of_crcs, config); - if(value->crc_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs); - return 0; - } - } - else - { - value->crc_pdu_list = 0; - } - - - uint8_t i = 0; - for(i = 0; i < value->number_of_crcs; ++i) - { - nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]); - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* crcPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, unpack_crc_indication_rel8_value }, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, crcPduInstanceEnd, 0, 0) == 0) - return 0; - } - - return 1; -} - -static uint8_t unpack_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, &unpack_crc_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_rx_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv; - - return (pull16(ppReadPackedMsg, &value->length, end) && - pull16(ppReadPackedMsg, &value->offset, end) && - pull8(ppReadPackedMsg, &value->ul_cqi, end) && - pull16(ppReadPackedMsg, &value->timing_advance, end)); -} -static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv; - return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end)); -} - -static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv; - - // the rxBodyEnd points to the end of the cqi PDU's - uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length; - uint8_t* rxPduEnd = rxBodyEnd; - - uint8_t* numberOfPdusAddress = *ppReadPackedMsg; - - if(rxBodyEnd > end) - { - // pdu end is past buffer end - return 0; - } - - if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) - return 0; - - if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU); - return 0; - } - - if(value->number_of_pdus > 0) - { - value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config); - if(value->rx_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); - return 0; - } - } - else - { - value->rx_pdu_list = 0; - } - - uint8_t i = 0; - nfapi_rx_indication_pdu_t* pdu = 0; - while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd) - { - nfapi_tl_t generic_tl; - if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) - return 0; - - switch(generic_tl.tag) - { - case NFAPI_RX_UE_INFORMATION_TAG: - { - pdu = &(value->rx_pdu_list[i++]); - pdu->rx_ue_information.tl = generic_tl; - if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) - return 0; - } - break; - case NFAPI_RX_INDICATION_REL8_TAG: - { - if(pdu != 0) - { - pdu->rx_indication_rel8.tl = generic_tl; - if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0) - return 0; - - if(pdu->rx_indication_rel8.offset > 0) - { - // Need to check that the data is within the tlv - if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd) - { - // If this the first pdu set the rxPduEnd - if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd) - { - rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset; - - if(rxPduEnd > end) - { - // pdu end is past buffer end - return 0; - } - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n"); - } - } - } - } - break; - case NFAPI_RX_INDICATION_REL9_TAG: - { - if(pdu != 0) - { - pdu->rx_indication_rel9.tl = generic_tl; - if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0) - return 0; - } - } - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag ); - } - break; - } - } - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_pdus; ++idx) - { - if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) - { - uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length; - value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config); - if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0) - { - return 0; - } - } - } - - return 1; -} - -static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, &unpack_rx_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_preamble_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel8_t* preamble_pdu_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv; - - return (pull16(ppReadPackedMsg, &preamble_pdu_rel8->rnti, end) && - pull8(ppReadPackedMsg, &preamble_pdu_rel8->preamble, end) && - pull16(ppReadPackedMsg, &preamble_pdu_rel8->timing_advance, end)); -} - -static uint8_t unpack_preamble_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel9_t* preamble_pdu_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv; - return pull16(ppReadPackedMsg, &preamble_pdu_rel9->timing_advance_r9, end); -} - -static uint8_t unpack_preamble_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_preamble_pdu_rel13_t* preamble_pdu_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv; - return pull8(ppReadPackedMsg, &preamble_pdu_rel13->rach_resource_type, end); -} - -static uint8_t unpack_rach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv; - uint8_t* rachBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(rachBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_preambles, end) == 0) - return 0; - - if(value->number_of_preambles > NFAPI_PREAMBLE_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of preamble du's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_preambles, NFAPI_PREAMBLE_MAX_PDU); - return 0; - } - - if(value->number_of_preambles > 0) - { - value->preamble_list = (nfapi_preamble_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_preamble_pdu_t) * value->number_of_preambles, config); - if(value->preamble_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate preamble pdu list (count:%d)\n", __FUNCTION__, value->number_of_preambles); - return 0; - } - } - else - { - value->preamble_list = 0; - } - - - uint8_t i = 0; - for(i = 0; i < value->number_of_preambles; ++i) - { - nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]); - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* preamblePduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, unpack_preamble_pdu_rel8_value }, - { NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, unpack_preamble_pdu_rel9_value }, - { NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, unpack_preamble_pdu_rel13_value }, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, preamblePduInstanceEnd, 0, 0) == 0) - return 0; - } - return 1; -} - -static uint8_t unpack_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, &unpack_rach_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel8_t* srs_pdu_fdd_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv; - - if(!(pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->doppler_estimation, end) && - pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->timing_advance, end) && - pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->number_of_resource_blocks, end) && - pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->rb_start, end) && - pullarray8(ppReadPackedMsg, srs_pdu_fdd_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_fdd_rel8->number_of_resource_blocks, end))) - return 0; - return 1; -} - -static uint8_t unpack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel9_t* srs_pdu_fdd_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv; - return (pull16(ppReadPackedMsg, &srs_pdu_fdd_rel9->timing_advance_r9, end)); -} - -static uint8_t unpack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_srs_indication_ttd_rel10_t* srs_pdu_tdd_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv; - return (pull8(ppReadPackedMsg, &srs_pdu_tdd_rel10->uppts_symbol, end)); -} - -static uint8_t unpack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_srs_indication_fdd_rel11_t* srs_pdu_fdd_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv; - return ( pull16(ppReadPackedMsg, &srs_pdu_fdd_rel11->ul_rtoa, end)); -} - -static uint8_t unpack_tdd_channel_measurement_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv; - - if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) && - pull8(ppReadPackedMsg, &value->number_of_subbands, end) && - pull8(ppReadPackedMsg, &value->num_atennas, end))) - return 0; - - if(value->number_of_subbands > NFAPI_MAX_NUM_SUBBANDS) - { - // todo : add error - return 0; - } - - if(value->num_atennas > NFAPI_MAX_NUM_PHYSICAL_ANTENNAS) - { - // todo : add error - return 0; - } - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_subbands; ++idx) - { - if(!(pull8(ppReadPackedMsg, &value->subands[idx].subband_index, end) && - pullarray16(ppReadPackedMsg, value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, end))) - return 0; - } - - return 1; -} - - -static uint8_t unpack_srs_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_srs_indication_body_t* value = (nfapi_srs_indication_body_t*)tlv; - uint8_t* srsBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(srsBodyEnd > end) - return 0; - - if(pull8(ppReadPackedMsg, &value->number_of_ues, end) == 0) - return 0; - - if(value->number_of_ues > NFAPI_SRS_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of srs ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_ues, NFAPI_SRS_IND_MAX_PDU); - return 0; - } - - if(value->number_of_ues > 0) - { - value->srs_pdu_list = (nfapi_srs_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_srs_indication_pdu_t) * value->number_of_ues, config); - if(value->srs_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate srs ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_ues); - return 0; - } - } - else - { - value->srs_pdu_list = 0; - } - - - - uint8_t i = 0; - for(i = 0; i < value->number_of_ues; ++i) - { - nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]); - - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* srsPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, unpack_srs_indication_fdd_rel8_value}, - { NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, unpack_srs_indication_fdd_rel9_value}, - { NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, unpack_srs_indication_tdd_rel10_value}, - { NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, unpack_srs_indication_fdd_rel11_value}, - { NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, unpack_tdd_channel_measurement_value}, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srsPduInstanceEnd, 0, 0) == 0) - return 0; - } - return 1; -} - -static uint8_t unpack_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, &unpack_srs_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - -static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv; - uint8_t* srBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(srBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_srs, end) == 0) - return 0; - - if(value->number_of_srs > NFAPI_SR_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of sr ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_srs, NFAPI_SR_IND_MAX_PDU); - return 0; - } - - if(value->number_of_srs > 0) - { - value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * value->number_of_srs, config); - if(value->sr_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs); - return 0; - } - } - else - { - value->sr_pdu_list = 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_srs; ++i) - { - nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]); - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* srPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, unpack_ul_cqi_information_value }, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srPduInstanceEnd, 0, 0) == 0) - return 0; - } - - return 1; - -} - -static int unpack_sr_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, &unpack_sr_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} -static uint8_t unpack_cqi_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv; - - return (pull16(ppReadPackedMsg, &cqi_pdu_rel8->length, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel8->data_offset, end) && - pull8(ppReadPackedMsg, &cqi_pdu_rel8->ul_cqi, end) && - pull8(ppReadPackedMsg, &cqi_pdu_rel8->ri, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel8->timing_advance, end)); - -} - -static uint8_t unpack_cqi_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv; - - if(!(pull16(ppReadPackedMsg, &cqi_pdu_rel9->length, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel9->data_offset, end) && - pull8(ppReadPackedMsg, &cqi_pdu_rel9->ul_cqi, end) && - pull8(ppReadPackedMsg, &cqi_pdu_rel9->number_of_cc_reported, end))) - return 0; - - if(cqi_pdu_rel9->number_of_cc_reported > NFAPI_CC_MAX) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : out of bound array\n"); - return 0; - } - - if(!(pullarray8(ppReadPackedMsg, cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance, end) && - pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance_r9, end))) - return 0; - - return 1; -} - -static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv; - - // the cqiBodyEnd points to the end of the cqi PDU's - uint8_t* cqiBodyEnd = *ppReadPackedMsg + value->tl.length; - - //uint8_t* cqiPduEnd = cqiBodyEnd; - //uint8_t* numberOfPdusAddress = *ppReadPackedMsg; - - if(cqiBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_cqis, end) == 0) - return 0; - - if(value->number_of_cqis > NFAPI_CQI_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of cqi ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_cqis, NFAPI_CQI_IND_MAX_PDU); - return -1; - } - - if(value->number_of_cqis > 0) - { - value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * value->number_of_cqis, config); - if(value->cqi_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis); - return 0; - } - } - else - { - value->cqi_pdu_list = 0; - } - - if(value->number_of_cqis > 0) - { - value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * value->number_of_cqis, config); - if(value->cqi_raw_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis); - return 0; - } - } - else - { - value->cqi_raw_pdu_list = 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_cqis; ++i) - { - nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); - memset(pdu, 0, sizeof(nfapi_cqi_indication_pdu_t)); - - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* cqiPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - - while((uint8_t*)(*ppReadPackedMsg) < cqiPduInstanceEnd) - { - nfapi_tl_t generic_tl; - if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) - return 0; - - switch(generic_tl.tag) - { - case NFAPI_RX_UE_INFORMATION_TAG: - pdu->rx_ue_information.tl = generic_tl; - if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) - return 0; - break; - case NFAPI_CQI_INDICATION_REL8_TAG: - pdu->cqi_indication_rel8.tl = generic_tl; - if(unpack_cqi_indication_rel8_value(&pdu->cqi_indication_rel8, ppReadPackedMsg, end) == 0) - return 0; - - break; - case NFAPI_CQI_INDICATION_REL9_TAG: - pdu->cqi_indication_rel9.tl = generic_tl; - if(unpack_cqi_indication_rel9_value(&pdu->cqi_indication_rel9, ppReadPackedMsg, end) == 0) - return 0; - - break; - case NFAPI_UL_CQI_INFORMATION_TAG: - pdu->ul_cqi_information.tl = generic_tl; - if(unpack_ul_cqi_information_value(&pdu->ul_cqi_information, ppReadPackedMsg, end) == 0) - return 0; - break; - default: - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_CQI.indication Invalid pdu type %d \n", generic_tl.tag ); - } - break; - - }; - } - } - - uint8_t idx = 0; - for(idx = 0; idx < value->number_of_cqis; ++idx) - { - if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) - { - if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel8.length, end) == 0) - return 0; - } - else if(value->cqi_pdu_list[idx].cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) - { - if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel9.length, end) == 0) - return 0; - } - } - - - return 1; - -} - -static uint8_t unpack_cqi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, &unpack_cqi_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} -static uint8_t unpack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv; - - return (pull32(ppReadPackedMsg, &value->handle, end) && - pull32(ppReadPackedMsg, &value->mp_cca, end) && - pull32(ppReadPackedMsg, &value->n_cca, end) && - pull32(ppReadPackedMsg, &value->offset, end) && - pull32(ppReadPackedMsg, &value->lte_txop_sf, end) && - pull16(ppReadPackedMsg, &value->txop_sfn_sf_end, end) && - pull32(ppReadPackedMsg, &value->lbt_mode, end)); -} - -static uint8_t unpack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv; - - return (pull32(ppReadPackedMsg, &value->handle, end) && - pull32(ppReadPackedMsg, &value->offset, end) && - pull16(ppReadPackedMsg, &value->sfn_sf_end, end) && - pull32(ppReadPackedMsg, &value->lbt_mode, end)); -} - - -static uint8_t unpack_lbt_config_request_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv; - - if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) - return 0; - - if(value->number_of_pdus > NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU); - return 0; - } - - if(value->number_of_pdus) - { - value->lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_config_request_pdu_t) * value->number_of_pdus, config); - if(value->lbt_dl_config_req_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); - return 0; - } - } - else - { - value->lbt_dl_config_req_pdu_list = 0; - } - - - uint16_t i; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, &unpack_lbt_pdsch_req_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, &unpack_lbt_drs_req_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - default: - NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request body invalid pdu type %d\n", pdu->pdu_type); - return 0; - } - } - - return 1; -} -static uint8_t unpack_lbt_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, &unpack_lbt_config_request_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_lbt_pdsch_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv; - - return (pull32(ppReadPackedMsg, &value->handle, end) && - pull32(ppReadPackedMsg, &value->result, end) && - pull32(ppReadPackedMsg, &value->lte_txop_symbols, end) && - pull32(ppReadPackedMsg, &value->initial_partial_sf, end)); - -} -static uint8_t unpack_lbt_drs_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv; - - return (pull32(ppReadPackedMsg, &value->handle, end) && - pull32(ppReadPackedMsg, &value->result, end)); -} - -static uint8_t unpack_lbt_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv; - - if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) - return 0; - - if(value->number_of_pdus > NFAPI_LBT_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_IND_MAX_PDU); - return 0; - } - - if(value->number_of_pdus > 0) - { - value->lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_indication_pdu_t) * value->number_of_pdus, config); - if(value->lbt_indication_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl ind config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); - return 0; - } - } - else - { - value->lbt_indication_pdu_list = 0; - } - - uint16_t i; - uint16_t total_number_of_pdus = value->number_of_pdus; - for(i = 0; i < total_number_of_pdus; ++i) - { - nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]); - - if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && - pull8(ppReadPackedMsg, &pdu->pdu_size, end))) - return 0; - - uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; - - if(packedPduEnd > end) - return 0; - - switch(pdu->pdu_type) - { - case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, &unpack_lbt_pdsch_rsp_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE: - { - unpack_tlv_t unpack_fns[] = - { - { NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, &unpack_lbt_drs_rsp_pdu_rel13_value}, - }; - - unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); - } - break; - default: - NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d\n", pdu->pdu_type); - return 0; - } - } - - return 1; -} -static uint8_t unpack_lbt_dl_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, &unpack_lbt_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_nb_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nb_harq_indication_fdd_rel13_t* value = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv; - return (pull8(ppReadPackedMsg, &value->harq_tb1, end)); -} - - -static uint8_t unpack_nb_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv; - uint8_t* nbharqBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(nbharqBodyEnd > end) - return 0; - - if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0) - return 0; - - if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU); - return 0; - } - - value->nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nb_harq_indication_pdu_t) * value->number_of_harqs, config); - if(value->nb_harq_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs); - return 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_harqs; ++i) - { - nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]); - if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) - return 0; - - uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, - { NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, &unpack_nb_harq_indication_fdd_rel13_value}, - { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value} - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0) - return 0; - - } - - return 1; -} - -static uint8_t unpack_nb_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, &unpack_nb_harq_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) -{ - nfapi_nrach_indication_pdu_rel13_t* value = (nfapi_nrach_indication_pdu_rel13_t*)tlv; - - return (pull16(ppReadPackedMsg, &value->rnti, end) && - pull8(ppReadPackedMsg, &value->initial_sc, end) && - pull16(ppReadPackedMsg, &value->timing_advance, end) && - pull8(ppReadPackedMsg, &value->nrach_ce_level, end)); -} - -static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; - if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){ - return 0; - } - else{ - NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code); - } - return 1; -} - -static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) -{ - nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv; - uint8_t* nrachBodyEnd = *ppReadPackedMsg + value->tl.length; - - if(nrachBodyEnd > end) - return 0; - - if(pull8(ppReadPackedMsg, &value->number_of_initial_scs_detected, end) == 0) - return 0; - - if(value->number_of_initial_scs_detected > NFAPI_PREAMBLE_MAX_PDU) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of detected scs ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected, NFAPI_PREAMBLE_MAX_PDU); - return 0; - } - - value->nrach_pdu_list = (nfapi_nrach_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nrach_indication_pdu_t) * value->number_of_initial_scs_detected, config); - if(value->nrach_pdu_list == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nrach ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected); - return 0; - } - - uint8_t i = 0; - for(i = 0; i < value->number_of_initial_scs_detected; ++i) - { - nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]); - - uint8_t* nrachPduInstanceEnd = *ppReadPackedMsg + 4 + 6; - - unpack_tlv_t unpack_fns[] = - { - { NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, &unpack_nrach_indication_rel13_value}, - }; - - if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, nrachPduInstanceEnd, 0, 0) == 0) - return 0; - - } - - return 1; -} - -static uint8_t unpack_nrach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - { NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, &unpack_nrach_indication_body_value}, - }; - - return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_nr_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - -static uint8_t unpack_nr_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - -static uint8_t unpack_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - -static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->tx_request_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->ul_config_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_jitter, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - -static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) -{ - nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg; - - unpack_p7_tlv_t unpack_fns[] = - { - }; - - return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->last_slot, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->dl_tti_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->ul_tti_jitter, end) && - pull32(ppReadPackedMsg, &pNfapiMsg->ul_dci_jitter, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_latest_delay, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_earliest_arrival, end) && - pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_earliest_arrival, end) && - unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); -} - - - -// unpack length check - -static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) -{ - int retLen = 0; - - switch (msgId) - { - case NFAPI_DL_CONFIG_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_dl_config_request_t)) - retLen = sizeof(nfapi_dl_config_request_t); - break; - - case NFAPI_UL_CONFIG_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_ul_config_request_t)) - retLen = sizeof(nfapi_ul_config_request_t); - break; - - case NFAPI_SUBFRAME_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t)) - retLen = sizeof(nfapi_subframe_indication_t); - break; - - case NFAPI_HI_DCI0_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_hi_dci0_request_t)) - retLen = sizeof(nfapi_hi_dci0_request_t); - break; - - case NFAPI_TX_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_tx_request_t)) - retLen = sizeof(nfapi_tx_request_t); - break; - - case NFAPI_HARQ_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_harq_indication_t)) - retLen = sizeof(nfapi_harq_indication_t); - break; - - case NFAPI_CRC_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_crc_indication_t)) - retLen = sizeof(nfapi_crc_indication_t); - break; - - case NFAPI_RX_ULSCH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_rx_indication_t)) - retLen = sizeof(nfapi_rx_indication_t); - break; - - case NFAPI_RACH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_rach_indication_t)) - retLen = sizeof(nfapi_rach_indication_t); - break; - - case NFAPI_SRS_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_srs_indication_t)) - retLen = sizeof(nfapi_srs_indication_t); - break; - - case NFAPI_RX_SR_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_sr_indication_t)) - retLen = sizeof(nfapi_sr_indication_t); - break; - - case NFAPI_RX_CQI_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t)) - retLen = sizeof(nfapi_cqi_indication_t); - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t)) - retLen = sizeof(nfapi_lbt_dl_config_request_t); - break; - - case NFAPI_LBT_DL_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t)) - retLen = sizeof(nfapi_lbt_dl_indication_t); - break; - - case NFAPI_NB_HARQ_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t)) - retLen = sizeof(nfapi_nb_harq_indication_t); - break; - - case NFAPI_NRACH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t)) - retLen = sizeof(nfapi_nrach_indication_t); - break; - - case NFAPI_DL_NODE_SYNC: - if (unpackedBufLen >= sizeof(nfapi_dl_node_sync_t)) - retLen = sizeof(nfapi_dl_node_sync_t); - break; - - case NFAPI_UL_NODE_SYNC: - if (unpackedBufLen >= sizeof(nfapi_ul_node_sync_t)) - retLen = sizeof(nfapi_ul_node_sync_t); - break; - - case NFAPI_TIMING_INFO: - if (unpackedBufLen >= sizeof(nfapi_timing_info_t)) - retLen = sizeof(nfapi_timing_info_t); - break; - - case NFAPI_UE_RELEASE_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t)) - retLen = sizeof(nfapi_ue_release_request_t); - break; - - case NFAPI_UE_RELEASE_RESPONSE: - if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t)) - retLen = sizeof(nfapi_ue_release_response_t); - break; - - default: - NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); - break; - } - - return retLen; -} - -static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) -{ - int retLen = 0; - - switch (msgId) - { - case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_nr_dl_tti_request_t)) - retLen = sizeof(nfapi_nr_dl_tti_request_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_nr_ul_tti_request_t)) - retLen = sizeof(nfapi_nr_ul_tti_request_t); - break; - - case NFAPI_SUBFRAME_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t)) - retLen = sizeof(nfapi_subframe_indication_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_nr_ul_dci_request_t)) - retLen = sizeof(nfapi_nr_ul_dci_request_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t)) - retLen = sizeof(nfapi_nr_tx_data_request_t); - break; - - case NFAPI_HARQ_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_harq_indication_t)) - retLen = sizeof(nfapi_harq_indication_t); - break; - - case NFAPI_CRC_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_crc_indication_t)) - retLen = sizeof(nfapi_crc_indication_t); - break; - - case NFAPI_RX_ULSCH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_rx_indication_t)) - retLen = sizeof(nfapi_rx_indication_t); - break; - - case NFAPI_RACH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_rach_indication_t)) - retLen = sizeof(nfapi_rach_indication_t); - break; - - case NFAPI_SRS_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_srs_indication_t)) - retLen = sizeof(nfapi_srs_indication_t); - break; - - case NFAPI_RX_SR_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_sr_indication_t)) - retLen = sizeof(nfapi_sr_indication_t); - break; - - case NFAPI_RX_CQI_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t)) - retLen = sizeof(nfapi_cqi_indication_t); - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t)) - retLen = sizeof(nfapi_lbt_dl_config_request_t); - break; - - case NFAPI_LBT_DL_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t)) - retLen = sizeof(nfapi_lbt_dl_indication_t); - break; - - case NFAPI_NB_HARQ_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t)) - retLen = sizeof(nfapi_nb_harq_indication_t); - break; - - case NFAPI_NRACH_INDICATION: - if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t)) - retLen = sizeof(nfapi_nrach_indication_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: - if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t)) - retLen = sizeof(nfapi_nr_dl_node_sync_t); - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: - if (unpackedBufLen >= sizeof(nfapi_nr_ul_node_sync_t)) - retLen = sizeof(nfapi_nr_ul_node_sync_t); - break; - - case NFAPI_TIMING_INFO: - if (unpackedBufLen >= sizeof(nfapi_timing_info_t)) - retLen = sizeof(nfapi_timing_info_t); - break; - - case NFAPI_UE_RELEASE_REQUEST: - if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t)) - retLen = sizeof(nfapi_ue_release_request_t); - break; - - case NFAPI_UE_RELEASE_RESPONSE: - if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t)) - retLen = sizeof(nfapi_ue_release_response_t); - break; - - default: - NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); - break; - } - - return retLen; -} - - - -// Main unpack functions - public - -int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) -{ - nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf; - uint8_t *pReadPackedMessage = pMessageBuf; - uint8_t *end = pMessageBuf + messageBufLen; - - if (pMessageBuf == NULL || pUnpackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n"); - return -1; - } - - if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); - return -1; - } - - // process the header - if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && - pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && - pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && - pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) - return -1; - - return 0; -} - -int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) -{ - int result = 0; - nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; - uint8_t *pReadPackedMessage = pMessageBuf; - uint8_t *end = pMessageBuf + messageBufLen; - - if (pMessageBuf == NULL || pUnpackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n"); - return -1; - } - - if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); - return -1; - } - /* - uint8_t *ptr = pMessageBuf; - printf("\n Read P7 message unpack: "); - while(ptr < end){ - printf(" %d ", *ptr); - ptr++; - } - printf("\n"); -*/ - // clean the supplied buffer for - tag value blanking - (void)memset(pUnpackedBuf, 0, unpackedBufLen); - - // process the header - if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && - pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && - pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && - pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n"); - return -1; - } - - if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n"); - return -1; - } - - /* - if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n"); - return -1; - } - */ - - // look for the specific message - switch (pMessageHeader->message_id) - { - case NFAPI_DL_CONFIG_REQUEST: - if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen)) - result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UL_CONFIG_REQUEST: - if (check_unpack_length(NFAPI_UL_CONFIG_REQUEST, unpackedBufLen)) - result = unpack_ul_config_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - case NFAPI_TX_REQUEST: - if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen)) - result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - case NFAPI_HI_DCI0_REQUEST: - if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen)) - result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UE_RELEASE_REQUEST: - if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) - result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_HARQ_INDICATION: - if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) - result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_CRC_INDICATION: - if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen)) - result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_ULSCH_INDICATION: - if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen)) - result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RACH_INDICATION: - if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen)) - result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_SRS_INDICATION: - if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen)) - result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_SR_INDICATION: - if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen)) - result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_CQI_INDICATION: - if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen)) - result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen)) - result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_LBT_DL_INDICATION: - if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen)) - result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NB_HARQ_INDICATION: - if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen)) - result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NRACH_INDICATION: - if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen)) - result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_DL_NODE_SYNC: - if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen)) - result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UL_NODE_SYNC: - if (check_unpack_length(NFAPI_UL_NODE_SYNC, unpackedBufLen)) - result = unpack_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config); - else - return -1; - break; - - case NFAPI_TIMING_INFO: - if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen)) - result = unpack_timing_info(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UE_RELEASE_RESPONSE: - if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) - result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - default: - - if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && - pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) - { - if(config && config->unpack_p7_vendor_extension) - { - result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config); - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); - } - break; - } - - if(result == 0) - return -1; - else - return 0; -} - -int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) -{ - int result = 0; - nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; - uint8_t *pReadPackedMessage = pMessageBuf; - uint8_t *end = pMessageBuf + messageBufLen; - - if (pMessageBuf == NULL || pUnpackedBuf == NULL) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n"); - return -1; - } - - if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); - return -1; - } - /* - uint8_t *ptr = pMessageBuf; - printf("\n Read P7 message unpack: "); - while(ptr < end){ - printf(" %d ", *ptr); - ptr++; - } - printf("\n"); -*/ - // clean the supplied buffer for - tag value blanking - (void)memset(pUnpackedBuf, 0, unpackedBufLen); - - // process the header - if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && - pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && - pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && - pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && - pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n"); - return -1; - } - - if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n"); - return -1; - } - - /* - if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n"); - return -1; - } - */ - - // look for the specific message - switch (pMessageHeader->message_id) - { - case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen)) - result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen)) - result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen)) - result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen)) - result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UE_RELEASE_REQUEST: - if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) - result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_HARQ_INDICATION: - if (check_nr_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) - result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_CRC_INDICATION: - if (check_nr_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen)) - result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_ULSCH_INDICATION: - if (check_nr_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen)) - result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RACH_INDICATION: - if (check_nr_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen)) - result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_SRS_INDICATION: - if (check_nr_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen)) - result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_SR_INDICATION: - if (check_nr_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen)) - result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_RX_CQI_INDICATION: - if (check_nr_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen)) - result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_LBT_DL_CONFIG_REQUEST: - if (check_nr_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen)) - result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_LBT_DL_INDICATION: - if (check_nr_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen)) - result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NB_HARQ_INDICATION: - if (check_nr_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen)) - result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NRACH_INDICATION: - if (check_nr_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen)) - result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen)) - result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: - if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen)) - result = unpack_nr_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config); - else - return -1; - break; - - case NFAPI_TIMING_INFO: - if (check_nr_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen)) - result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - case NFAPI_UE_RELEASE_RESPONSE: - if (check_nr_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) - result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); - else - return -1; - break; - - default: - - if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && - pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) - { - if(config && config->unpack_p7_vendor_extension) - { - result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config); - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id); - } - } - else - { - NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); - } - break; - } - - if(result == 0) - return -1; - else - return 0; -} - - +/* + * Copyright 2017 Cisco Systems, Inc. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "nfapi_nr_interface_scf.h" + +extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data); +extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data); + +uint32_t nfapi_calculate_checksum(uint8_t* buffer, uint16_t len) +{ + uint32_t chksum = 0; + // calcaulte upto the checksum + chksum = crc32(chksum, buffer, 8); + + // skip the checksum + uint8_t zeros[4] = {0, 0, 0, 0}; + chksum = crc32(chksum, zeros, 4); + + // continu with the rest of the mesage + chksum = crc32(chksum, &buffer[NFAPI_P7_HEADER_LENGTH], len - NFAPI_P7_HEADER_LENGTH); + + // return the inverse + return ~(chksum); +} + +int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len) +{ + uint32_t checksum = nfapi_calculate_checksum(buffer, len); + + uint8_t* p_write = &buffer[8]; + return (push32(checksum, &p_write, buffer + len) > 0 ? 0 : -1); +} + +int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp) +{ + uint8_t* p_write = &buffer[12]; + return (push32(timestamp, &p_write, buffer + 16) > 0 ? 0 : -1); +} + +uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len) +{ + return nfapi_calculate_checksum(buffer, len); +} + +void* nfapi_p7_allocate(size_t size, nfapi_p7_codec_config_t* config) +{ + if(size == 0) + return 0; + + void* buffer_p = NULL; + if(config && config->allocate) + { + buffer_p = (config->allocate)(size); + if(buffer_p != NULL){ + memset(buffer_p,0,size); + } + return buffer_p; + } + else + { + buffer_p = calloc(1, size); + return buffer_p; + } +} + +void nfapi_p7_deallocate(void* ptr, nfapi_p7_codec_config_t* config) +{ + if(ptr == NULL) + return; + + if(config && config->deallocate) + { + return (config->deallocate)(ptr); + } + else + { + return free(ptr); + } +} +// Pack routines + + +static uint8_t pack_dl_config_dci_dl_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel8_t* value = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv; + + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci_format:%u\n", __FUNCTION__, value->dci_format); + + return ( push8(value->dci_format, ppWritePackedMsg, end) && + push8(value->cce_idx, ppWritePackedMsg, end) && + push8(value->aggregation_level, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->resource_allocation_type, ppWritePackedMsg, end) && + push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && + push32(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->mcs_1, ppWritePackedMsg, end) && + push8(value->redundancy_version_1, ppWritePackedMsg, end) && + push8(value->new_data_indicator_1, ppWritePackedMsg, end) && + push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && + push8(value->mcs_2, ppWritePackedMsg, end) && + push8(value->redundancy_version_2, ppWritePackedMsg, end) && + push8(value->new_data_indicator_2, ppWritePackedMsg, end) && + push8(value->harq_process, ppWritePackedMsg, end) && + push8(value->tpmi, ppWritePackedMsg, end) && + push8(value->pmi, ppWritePackedMsg, end) && + push8(value->precoding_information, ppWritePackedMsg, end) && + push8(value->tpc, ppWritePackedMsg, end) && + push8(value->downlink_assignment_index, ppWritePackedMsg, end) && + push8(value->ngap, ppWritePackedMsg, end) && + push8(value->transport_block_size_index, ppWritePackedMsg, end) && + push8(value->downlink_power_offset, ppWritePackedMsg, end) && + push8(value->allocate_prach_flag, ppWritePackedMsg, end) && + push8(value->preamble_index, ppWritePackedMsg, end) && + push8(value->prach_mask_index, ppWritePackedMsg, end) && + push8(value->rnti_type, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_dci_dl_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel9_t* value = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv; + + return( push8(value->mcch_flag, ppWritePackedMsg, end) && + push8(value->mcch_change_notification, ppWritePackedMsg, end) && + push8(value->scrambling_identity, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_dci_dl_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel10_t* value = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv; + + return ( push8(value->cross_carrier_scheduling_flag, ppWritePackedMsg, end) && + push8(value->carrier_indicator, ppWritePackedMsg, end) && + push8(value->srs_flag, ppWritePackedMsg, end) && + push8(value->srs_request, ppWritePackedMsg, end) && + push8(value->antenna_ports_scrambling_and_layers, ppWritePackedMsg, end) && + push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) && + push8(value->n_dl_rb, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_dci_dl_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel11_t* value = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv; + + return ( push8(value->harq_ack_resource_offset, ppWritePackedMsg, end) && + push8(value->pdsch_re_mapping_quasi_co_location_indicator, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_dci_dl_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel12_t* value = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv; + + return ( push8(value->primary_cell_type, ppWritePackedMsg, end) && + push8(value->ul_dl_configuration_flag, ppWritePackedMsg, end) && + push8(value->number_ul_dl_configurations, ppWritePackedMsg, end) && + pusharray8(value->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, value->number_ul_dl_configurations, ppWritePackedMsg, end)); +} + +static uint8_t pack_tpm_value(nfapi_dl_config_dci_dl_tpm_t* value, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + if (!( push8(value->num_prb_per_subband, ppWritePackedMsg, end) && + push8(value->number_of_subbands, ppWritePackedMsg, end) && + push8(value->num_antennas, ppWritePackedMsg, end))) + return 0; + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_subbands; ++idx) + { + nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]); + + if(!(push8(subband_info->subband_index, ppWritePackedMsg, end) && + push8(subband_info->scheduled_ues, ppWritePackedMsg, end))) + return 0; + + + uint8_t antenna_idx = 0; + uint8_t scheduled_ue_idx = 0; + + for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx) + { + for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx) + { + if(!push16(subband_info->precoding_value[antenna_idx][scheduled_ue_idx], ppWritePackedMsg, end)) + return 0; + } + } + + } + + + return 1; + +} + + +static uint8_t pack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv; + + return( + push16(value->bwp_size, ppWritePackedMsg, end) && + push16(value->bwp_start, ppWritePackedMsg, end) && + + push8(value->subcarrier_spacing, ppWritePackedMsg, end) && + push8(value->cyclic_prefix, ppWritePackedMsg, end) && + + push16(value->start_rb, ppWritePackedMsg, end) && + push16(value->nr_of_rbs, ppWritePackedMsg, end) && + + push8(value->csi_type, ppWritePackedMsg, end) && + push8(value->row, ppWritePackedMsg, end) && + + push16(value->freq_domain, ppWritePackedMsg, end) && + push8(value->symb_l0, ppWritePackedMsg, end) && + + push8(value->symb_l1, ppWritePackedMsg, end) && + push8(value->cdm_type, ppWritePackedMsg, end) && + + push8(value->freq_density, ppWritePackedMsg, end) && + push16(value->scramb_id, ppWritePackedMsg, end) && + + push8(value->power_control_offset, ppWritePackedMsg, end) && + push8(value->power_control_offset_ss, ppWritePackedMsg, end) + ); + +} + + +static uint8_t pack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv; + + for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) + { + if(!(push16(value->dci_pdu[i].RNTI, ppWritePackedMsg, end) && + push16(value->dci_pdu[i].ScramblingId, ppWritePackedMsg, end) && + + push16(value->dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) && + push8(value->dci_pdu[i].CceIndex, ppWritePackedMsg, end) && + push8(value->dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) && + push8(value->dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) && + + push8(value->dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) && + push16(value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) && + pusharray8(value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end))) + return 0; + + } + + // TODO: resolve the packaging of array (currently sending a single element) + return( + push16(value->BWPSize, ppWritePackedMsg, end) && + push16(value->BWPStart, ppWritePackedMsg, end) && + push8(value->SubcarrierSpacing, ppWritePackedMsg, end) && + push8(value->CyclicPrefix, ppWritePackedMsg, end) && + + push8(value->StartSymbolIndex, ppWritePackedMsg, end) && + push8(value->DurationSymbols, ppWritePackedMsg, end) && + pusharray8(value->FreqDomainResource, 6, 6, ppWritePackedMsg, end) && + push8(value->CceRegMappingType, ppWritePackedMsg, end) && + + push8(value->RegBundleSize, ppWritePackedMsg, end) && + push8(value->InterleaverSize, ppWritePackedMsg, end) && + push8(value->CoreSetType, ppWritePackedMsg, end) && + push16(value->ShiftIndex, ppWritePackedMsg, end) && + + push8(value->precoderGranularity, ppWritePackedMsg, end) && + push16(value->numDlDci, ppWritePackedMsg, end)); + +} + + +static uint8_t pack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv; + + // TODO: resolve the packaging of array (currently sending a single element) + return( + push16(value->pduBitmap, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push16(value->pduIndex, ppWritePackedMsg, end) && + push16(value->BWPSize, ppWritePackedMsg, end) && + + push16(value->BWPStart, ppWritePackedMsg, end) && + push8(value->SubcarrierSpacing, ppWritePackedMsg, end) && + push8(value->CyclicPrefix, ppWritePackedMsg, end) && + push8(value->NrOfCodewords, ppWritePackedMsg, end) && + + pusharray16(value->targetCodeRate, 2, 1, ppWritePackedMsg, end) && + pusharray8(value->qamModOrder, 2, 1, ppWritePackedMsg, end) && + pusharray8(value->mcsIndex, 2, 1, ppWritePackedMsg, end) && + pusharray8(value->mcsTable, 2, 1, ppWritePackedMsg, end) && + + pusharray8(value->rvIndex, 2, 1, ppWritePackedMsg, end) && + pusharray32(value->TBSize, 2, 1, ppWritePackedMsg, end) && + push16(value->dataScramblingId, ppWritePackedMsg, end) && + push8(value->nrOfLayers, ppWritePackedMsg, end) && + + push8(value->transmissionScheme, ppWritePackedMsg, end) && + push8(value->refPoint, ppWritePackedMsg, end) && + push16(value->dlDmrsSymbPos, ppWritePackedMsg, end) && + push8(value->dmrsConfigType, ppWritePackedMsg, end) && + + push16(value->dlDmrsScramblingId, ppWritePackedMsg, end) && + push8(value->SCID, ppWritePackedMsg, end) && + push8(value->numDmrsCdmGrpsNoData, ppWritePackedMsg, end) && + push16(value->dmrsPorts, ppWritePackedMsg, end) && + + push8(value->resourceAlloc, ppWritePackedMsg, end) && + push16(value->rbStart, ppWritePackedMsg, end) && + push16(value->rbSize, ppWritePackedMsg, end) && + + push8(value->VRBtoPRBMapping, ppWritePackedMsg, end) && + push8(value->StartSymbolIndex, ppWritePackedMsg, end) && + push8(value->NrOfSymbols, ppWritePackedMsg, end) && + push8(value->PTRSPortIndex, ppWritePackedMsg, end) && + + push8(value->PTRSTimeDensity, ppWritePackedMsg, end) && + push8(value->PTRSFreqDensity, ppWritePackedMsg, end) && + push8(value->PTRSReOffset, ppWritePackedMsg, end) + ); + +} + + +static uint8_t pack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + printf("Packing ssb. \n"); + nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv; + + return( + push16(value->PhysCellId, ppWritePackedMsg, end) && + push8(value->BetaPss, ppWritePackedMsg, end) && + push8(value->SsbBlockIndex, ppWritePackedMsg, end) && + push8(value->SsbSubcarrierOffset, ppWritePackedMsg, end) && + push16(value->ssbOffsetPointA, ppWritePackedMsg, end) && + push8(value->bchPayloadFlag, ppWritePackedMsg, end) && + push32(value->bchPayload, ppWritePackedMsg, end) + // TODO: pack precoding_and_beamforming too + ); + +} + + +static uint8_t pack_dl_config_dci_dl_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel13_t* value = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv; + + return( push8(value->laa_end_partial_sf_flag, ppWritePackedMsg, end) && + push8(value->laa_end_partial_sf_configuration, ppWritePackedMsg, end) && + push8(value->initial_lbt_sf, ppWritePackedMsg, end) && + push8(value->codebook_size_determination, ppWritePackedMsg, end) && + push8(value->drms_table_flag, ppWritePackedMsg, end) && + push8(value->tpm_struct_flag, ppWritePackedMsg, end) && + (value->tpm_struct_flag == 1 ? pack_tpm_value(&(value->tpm), ppWritePackedMsg, end) : 1)); +} + +static uint8_t pack_dl_config_bch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_bch_pdu_rel8_t* value = (nfapi_dl_config_bch_pdu_rel8_t*)tlv; + + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s()\n", __FUNCTION__); + + return( push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_mch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_mch_pdu_rel8_t* value = (nfapi_dl_config_mch_pdu_rel8_t*)tlv; + + return ( push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->resource_allocation_type, ppWritePackedMsg, end) && + push32(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->modulation, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push16(value->mbsfn_area_id, ppWritePackedMsg, end)); +} + +static uint8_t pack_bf_vector_info(void* elem, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_bf_vector_t* bf = (nfapi_bf_vector_t*)elem; + + return ( push8(bf->subband_index, ppWritePackedMsg, end) && + push8(bf->num_antennas, ppWritePackedMsg, end) && + pusharray16(bf->bf_value, NFAPI_MAX_NUM_ANTENNAS, bf->num_antennas, ppWritePackedMsg, end)); + + +} +static uint8_t pack_dl_config_dlsch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel8_t* value = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv; + + return ( push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->resource_allocation_type, ppWritePackedMsg, end) && + push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && + push32(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->modulation, ppWritePackedMsg, end) && + push8(value->redundancy_version, ppWritePackedMsg, end) && + push8(value->transport_blocks, ppWritePackedMsg, end) && + push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && + push8(value->transmission_scheme, ppWritePackedMsg, end) && + push8(value->number_of_layers, ppWritePackedMsg, end) && + push8(value->number_of_subbands, ppWritePackedMsg, end) && + pusharray8(value->codebook_index, NFAPI_MAX_NUM_SUBBANDS, value->number_of_subbands, ppWritePackedMsg, end) && + push8(value->ue_category_capacity, ppWritePackedMsg, end) && + push8(value->pa, ppWritePackedMsg, end) && + push8(value->delta_power_offset_index, ppWritePackedMsg, end) && + push8(value->ngap, ppWritePackedMsg, end) && + push8(value->nprb, ppWritePackedMsg, end) && + push8(value->transmission_mode, ppWritePackedMsg, end) && + push8(value->num_bf_prb_per_subband, ppWritePackedMsg, end) && + push8(value->num_bf_vector, ppWritePackedMsg, end) && + packarray(value->bf_vector, sizeof(nfapi_bf_vector_t), NFAPI_MAX_BF_VECTORS, value->num_bf_vector, ppWritePackedMsg, end, &pack_bf_vector_info)); + +} +static uint8_t pack_dl_config_dlsch_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel9_t* value = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv; + return ( push8(value->nscid, ppWritePackedMsg, end) ); +} +static uint8_t pack_dl_config_dlsch_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel10_t* value = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv; + + return ( push8(value->csi_rs_flag, ppWritePackedMsg, end) && + push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) && + push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) && + push8(value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) && + pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_nzp_configuration, ppWritePackedMsg, end) && + push8(value->pdsch_start, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_dlsch_pdu_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel11_t* value = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv; + + return( push8(value->drms_config_flag, ppWritePackedMsg, end) && + push16(value->drms_scrambling, ppWritePackedMsg, end) && + push8(value->csi_config_flag, ppWritePackedMsg, end) && + push16(value->csi_scrambling, ppWritePackedMsg, end) && + push8(value->pdsch_re_mapping_flag, ppWritePackedMsg, end) && + push8(value->pdsch_re_mapping_atenna_ports, ppWritePackedMsg, end) && + push8(value->pdsch_re_mapping_freq_shift, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_dlsch_pdu_rel12_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel12_t* value = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv; + + return( push8(value->altcqi_table_r12, ppWritePackedMsg, end) && + push8(value->maxlayers, ppWritePackedMsg, end) && + push8(value->n_dl_harq, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_dlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel13_t* value = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv; + + return( push8(value->dwpts_symbols, ppWritePackedMsg, end) && + push8(value->initial_lbt_sf, ppWritePackedMsg, end) && + push8(value->ue_type, ppWritePackedMsg, end) && + push8(value->pdsch_payload_type, ppWritePackedMsg, end) && + push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) && + push8(value->drms_table_flag, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_pch_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_pch_pdu_rel8_t* value = (nfapi_dl_config_pch_pdu_rel8_t*)tlv; + + return( push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->p_rnti, ppWritePackedMsg, end) && + push8(value->resource_allocation_type, ppWritePackedMsg, end) && + push8(value->virtual_resource_block_assignment_flag, ppWritePackedMsg, end) && + push32(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->mcs, ppWritePackedMsg, end) && + push8(value->redundancy_version, ppWritePackedMsg, end) && + push8(value->number_of_transport_blocks, ppWritePackedMsg, end) && + push8(value->transport_block_to_codeword_swap_flag, ppWritePackedMsg, end) && + push8(value->transmission_scheme, ppWritePackedMsg, end) && + push8(value->number_of_layers, ppWritePackedMsg, end) && + push8(value->codebook_index, ppWritePackedMsg, end) && + push8(value->ue_category_capacity, ppWritePackedMsg, end) && + push8(value->pa, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push8(value->nprb, ppWritePackedMsg, end) && + push8(value->ngap, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_pch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_pch_pdu_rel13_t* value = (nfapi_dl_config_pch_pdu_rel13_t*)tlv; + + return ( push8(value->ue_mode, ppWritePackedMsg, end) && + push16(value->initial_transmission_sf_io, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_prs_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_prs_pdu_rel9_t* value = (nfapi_dl_config_prs_pdu_rel9_t*)tlv; + + return( push16(value->transmission_power, ppWritePackedMsg, end) && + push8(value->prs_bandwidth, ppWritePackedMsg, end) && + push8(value->prs_cyclic_prefix_type, ppWritePackedMsg, end) && + push8(value->prs_muting, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_csi_rs_pdu_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_csi_rs_pdu_rel10_t* value = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv; + + return( push8(value->csi_rs_antenna_port_count_r10, ppWritePackedMsg, end) && + push8(value->csi_rs_resource_config_r10, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push16(value->csi_rs_zero_tx_power_resource_config_bitmap_r10, ppWritePackedMsg, end) && + push8(value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end) && + pusharray8(value->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, value->csi_rs_number_of_nzp_configuration, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_csi_rs_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_csi_rs_pdu_rel13_t* value = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv; + + if(!(push8(value->csi_rs_class, ppWritePackedMsg, end) && + push8(value->cdm_type, ppWritePackedMsg, end) && + push8(value->num_bf_vector, ppWritePackedMsg, end))) + { + return 0; + } + + uint16_t i; + for(i = 0; i < value->num_bf_vector; ++i) + { + if(!(push8(value->bf_vector[i].csi_rs_resource_index, ppWritePackedMsg, end) && + pusharray16(value->bf_vector[i].bf_value, NFAPI_MAX_ANTENNA_PORT_COUNT, NFAPI_MAX_ANTENNA_PORT_COUNT, ppWritePackedMsg, end))) + return 0; + } + + return 1; +} +static uint8_t pack_bf_vector(nfapi_bf_vector_t* vector, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(vector->subband_index, ppWritePackedMsg, end) && + push8(vector->num_antennas, ppWritePackedMsg, end) && + pusharray16(vector->bf_value, NFAPI_MAX_NUM_ANTENNAS, vector->num_antennas, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_epdcch_parameters_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_epdcch_parameters_rel11_t* value = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv; + + return ( push8(value->epdcch_resource_assignment_flag, ppWritePackedMsg, end) && + push16(value->epdcch_id, ppWritePackedMsg, end) && + push8(value->epdcch_start_symbol, ppWritePackedMsg, end) && + push8(value->epdcch_num_prb, ppWritePackedMsg, end) && + pusharray8(value->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, value->epdcch_num_prb, ppWritePackedMsg, end) && + pack_bf_vector(&value->bf_vector, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_epdcch_parameters_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_epdcch_parameters_rel13_t* value = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv; + + return (push8(value->dwpts_symbols, ppWritePackedMsg, end) && + push8(value->initial_lbt_sf, ppWritePackedMsg, end)); +} +static uint8_t pack_dl_config_mpdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_mpdcch_pdu_rel13_t* value = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv; + + return ( push8(value->mpdcch_narrow_band, ppWritePackedMsg, end) && + push8(value->number_of_prb_pairs, ppWritePackedMsg, end) && + push8(value->resource_block_assignment, ppWritePackedMsg, end) && + push8(value->mpdcch_tansmission_type, ppWritePackedMsg, end) && + push8(value->start_symbol, ppWritePackedMsg, end) && + push8(value->ecce_index, ppWritePackedMsg, end) && + push8(value->aggregation_level, ppWritePackedMsg, end) && + push8(value->rnti_type, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->ce_mode, ppWritePackedMsg, end) && + push16(value->drms_scrambling_init, ppWritePackedMsg, end) && + push16(value->initial_transmission_sf_io, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push8(value->dci_format, ppWritePackedMsg, end) && + push16(value->resource_block_coding, ppWritePackedMsg, end) && + push8(value->mcs, ppWritePackedMsg, end) && + push8(value->pdsch_reptition_levels, ppWritePackedMsg, end) && + push8(value->redundancy_version, ppWritePackedMsg, end) && + push8(value->new_data_indicator, ppWritePackedMsg, end) && + push8(value->harq_process, ppWritePackedMsg, end) && + push8(value->tpmi_length, ppWritePackedMsg, end) && + push8(value->tpmi, ppWritePackedMsg, end) && + push8(value->pmi_flag, ppWritePackedMsg, end) && + push8(value->pmi, ppWritePackedMsg, end) && + push8(value->harq_resource_offset, ppWritePackedMsg, end) && + push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) && + push8(value->tpc, ppWritePackedMsg, end) && + push8(value->downlink_assignment_index_length, ppWritePackedMsg, end) && + push8(value->downlink_assignment_index, ppWritePackedMsg, end) && + push8(value->allocate_prach_flag, ppWritePackedMsg, end) && + push8(value->preamble_index, ppWritePackedMsg, end) && + push8(value->prach_mask_index, ppWritePackedMsg, end) && + push8(value->starting_ce_level, ppWritePackedMsg, end) && + push8(value->srs_request, ppWritePackedMsg, end) && + push8(value->antenna_ports_and_scrambling_identity_flag, ppWritePackedMsg, end) && + push8(value->antenna_ports_and_scrambling_identity, ppWritePackedMsg, end) && + push8(value->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && + push8(value->paging_direct_indication_differentiation_flag, ppWritePackedMsg, end) && + push8(value->direct_indication, ppWritePackedMsg, end) && + push8(value->total_dci_length_including_padding, ppWritePackedMsg, end) && + push8(value->number_of_tx_antenna_ports, ppWritePackedMsg, end) && + pusharray16(value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, ppWritePackedMsg, end)); +} + + +static uint8_t pack_dl_config_nbch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_nbch_pdu_rel13_t* value = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv; + + return (push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push16(value->transmission_power, ppWritePackedMsg, end) && + push16(value->hyper_sfn_2_lsbs, ppWritePackedMsg, end)); +} + + +static uint8_t pack_dl_config_npdcch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_npdcch_pdu_rel13_t* value = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv; + + return (push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push8(value->ncce_index, ppWritePackedMsg, end) && + push8(value->aggregation_level, ppWritePackedMsg, end) && + push8(value->start_symbol, ppWritePackedMsg, end) && + push8(value->rnti_type, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push8(value->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) && + push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) && + push8(value->dci_format, ppWritePackedMsg, end) && + push8(value->scheduling_delay, ppWritePackedMsg, end) && + push8(value->resource_assignment, ppWritePackedMsg, end) && + push8(value->repetition_number, ppWritePackedMsg, end) && + push8(value->mcs, ppWritePackedMsg, end) && + push8(value->new_data_indicator, ppWritePackedMsg, end) && + push8(value->harq_ack_resource, ppWritePackedMsg, end) && + push8(value->npdcch_order_indication, ppWritePackedMsg, end) && + push8(value->starting_number_of_nprach_repetitions, ppWritePackedMsg, end) && + push8(value->subcarrier_indication_of_nprach, ppWritePackedMsg, end) && + push8(value->paging_direct_indication_differentation_flag, ppWritePackedMsg, end) && + push8(value->direct_indication, ppWritePackedMsg, end) && + push8(value->dci_subframe_repetition_number, ppWritePackedMsg, end) && + push8(value->total_dci_length_including_padding, ppWritePackedMsg, end)); +} + +static uint8_t pack_dl_config_ndlsch_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_ndlsch_pdu_rel13_t* value = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv; + + return (push16(value->length, ppWritePackedMsg, end) && + push16(value->pdu_index, ppWritePackedMsg, end) && + push8(value->start_symbol, ppWritePackedMsg, end) && + push8(value->rnti_type, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) && + push16(value->resource_assignment, ppWritePackedMsg, end) && + push16(value->repetition_number, ppWritePackedMsg, end) && + push8(value->modulation, ppWritePackedMsg, end) && + push8(value->number_of_subframes_for_resource_assignment, ppWritePackedMsg, end) && + push8(value->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) && + push16(value->sf_idx, ppWritePackedMsg, end) && + push8(value->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end)); +} + + +static uint8_t pack_dl_tti_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)tlv; + + if(!(push16(value->PDUSize, ppWritePackedMsg, end) && + push16(value->PDUType, ppWritePackedMsg, end) )) + return 0; + + + // first match the pdu type, then call the respective function + switch(value->PDUType) + { + case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: + { + if(!(pack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppWritePackedMsg,end))) + return 0; + } + break; + + case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: + { + if(!(pack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppWritePackedMsg,end))) + return 0; + } + break; + case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: + { + if(!(pack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppWritePackedMsg,end))) + return 0; + } + break; + case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: + { + if(!(pack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppWritePackedMsg,end))) + return 0; + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType ); + } + break; + } + + return 1; +} + +static uint8_t pack_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv; + + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() dci:%u pdu:%u pdsch:%u rnti:%u pcfich:%u\n", __FUNCTION__, value->number_dci, value->number_pdu, value->number_pdsch_rnti, value->transmission_power_pcfich); + + if(!(push8(value->number_pdcch_ofdm_symbols, ppWritePackedMsg, end) && + push8(value->number_dci, ppWritePackedMsg, end) && + push16(value->number_pdu, ppWritePackedMsg, end) && + push8(value->number_pdsch_rnti, ppWritePackedMsg, end) && + push16(value->transmission_power_pcfich, ppWritePackedMsg, end))) + { + return 0; + } + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_pdu; + for(; i < total_number_of_pdus; ++i) + { + nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]); + + if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: + { + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE\n", __FUNCTION__); + + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value))) + { + return 0; + } + } + break; + case NFAPI_DL_CONFIG_BCH_PDU_TYPE: + { + //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() NFAPI_DL_CONFIG_BCH_PDU_TYPE\n", __FUNCTION__); + + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_bch_pdu_rel8_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_MCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_mch_pdu_rel8_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel8_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel9_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel10_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel11_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel12_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dlsch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_PCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel8_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_pch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_PRS_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_prs_pdu_rel9_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel10_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_csi_rs_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel8_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel9_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel10_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel11_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel12_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_dci_dl_pdu_rel13_value) && + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel11_value) & + pack_tlv(NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, ppWritePackedMsg, end, &pack_dl_config_epdcch_parameters_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_mpdcch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_nbch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_npdcch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, ppWritePackedMsg, end, &pack_dl_config_ndlsch_pdu_rel13_value))) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + } + + return 1; +} + + +static uint8_t pack_dl_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg; + + if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) && + push16(pNfapiMsg->Slot , ppWritePackedMsg, end) && + push8(pNfapiMsg->dl_tti_request_body.nGroup , ppWritePackedMsg, end) && + push8(pNfapiMsg->dl_tti_request_body.nPDUs , ppWritePackedMsg, end) && + pusharray8(pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, ppWritePackedMsg, end) + //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end) + )) + return 0; + + int arr[12]; + for(int i=0;idl_tti_request_body.nGroup;i++) + { + for(int j=0;jdl_tti_request_body.nUe[i];j++) + { + arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j]; + } + if(!(pusharrays32(arr,12,pNfapiMsg->dl_tti_request_body.nUe[i],ppWritePackedMsg, end))) + return 0; + } + + for(int i=0;idl_tti_request_body.nPDUs;i++) + { + if(!pack_dl_tti_request_body_value(&pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i],ppWritePackedMsg,end)) + return 0; + } + +return 1; +} + + +static uint8_t pack_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg; + + //return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + //pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value) && + //pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + { + uint8_t x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); + uint8_t y = pack_tlv(NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, ppWritePackedMsg, end, &pack_dl_config_request_body_value); + uint8_t z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); + + if (!x || !y || !z) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST x:%u y:%u z:%u \n", __FUNCTION__,x,y,z); + } + + return x && y && z; + } +} + + + + +static uint8_t pack_ul_config_request_ulsch_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t * end) +{ + nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv; + + return( push32(ulsch_pdu_rel8->handle, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel8->size, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel8->rnti, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->modulation_type, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->new_data_indication, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->redundancy_version, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->harq_process_number, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->ul_tx_mode, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->current_tx_nb, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel8->n_srs, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_ulsch_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv; + + return (push8(ulsch_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) && + push32(ulsch_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->transport_blocks, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->transmission_scheme, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->number_of_layers, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->codebook_index, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel10->disable_sequence_hopping_flag, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_ulsch_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv; + + return (push8(ulsch_pdu_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel11->npusch_identity, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel11->dmrs_config_flag, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel11->ndmrs_csh_identity, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_ulsch_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv; + + return (push8(ulsch_pdu_rel13->ue_type, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel13->total_number_of_repetitions, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) && + push16(ulsch_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) && + push8(ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, ppWritePackedMsg, end)); +} + +//Pack fns for ul_tti PDUS + + +static uint8_t pack_ul_tti_request_prach_pdu(nfapi_nr_prach_pdu_t* prach_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return( + push16(prach_pdu->phys_cell_id, ppWritePackedMsg, end) && + push8(prach_pdu->num_prach_ocas, ppWritePackedMsg, end) && + push8(prach_pdu->prach_format, ppWritePackedMsg, end) && + push8(prach_pdu->num_ra, ppWritePackedMsg, end) && + push8(prach_pdu->prach_start_symbol, ppWritePackedMsg, end) && + push16(prach_pdu->num_cs, ppWritePackedMsg, end) + // TODO: ignoring beamforming tlv for now + ); + +} + +static uint8_t pack_ul_tti_request_pucch_pdu(nfapi_nr_pucch_pdu_t* pucch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return( + push16(pucch_pdu->rnti, ppWritePackedMsg, end) && + push32(pucch_pdu->handle, ppWritePackedMsg, end) && + push16(pucch_pdu->bwp_size, ppWritePackedMsg, end) && + push16(pucch_pdu->bwp_start, ppWritePackedMsg, end) && + push8(pucch_pdu->subcarrier_spacing, ppWritePackedMsg, end) && + push8(pucch_pdu->cyclic_prefix, ppWritePackedMsg, end) && + push8(pucch_pdu->format_type, ppWritePackedMsg, end) && + push8(pucch_pdu->multi_slot_tx_indicator, ppWritePackedMsg, end) && + push16(pucch_pdu->prb_start, ppWritePackedMsg, end) && + push16(pucch_pdu->prb_size, ppWritePackedMsg, end) && + push8(pucch_pdu->start_symbol_index, ppWritePackedMsg, end) && + push8(pucch_pdu->nr_of_symbols, ppWritePackedMsg, end) && + push8(pucch_pdu->freq_hop_flag, ppWritePackedMsg, end) && + push16(pucch_pdu->second_hop_prb, ppWritePackedMsg, end) && + push8(pucch_pdu->group_hop_flag, ppWritePackedMsg, end) && + push8(pucch_pdu->sequence_hop_flag, ppWritePackedMsg, end) && + push16(pucch_pdu->hopping_id, ppWritePackedMsg, end) && + push16(pucch_pdu->initial_cyclic_shift, ppWritePackedMsg, end) && + push16(pucch_pdu->data_scrambling_id, ppWritePackedMsg, end) && + push8(pucch_pdu->time_domain_occ_idx, ppWritePackedMsg, end) && + push8(pucch_pdu->pre_dft_occ_idx, ppWritePackedMsg, end) && + push8(pucch_pdu->pre_dft_occ_len, ppWritePackedMsg, end) && + push8(pucch_pdu->add_dmrs_flag, ppWritePackedMsg, end) && + push16(pucch_pdu->dmrs_scrambling_id, ppWritePackedMsg, end) && + push8(pucch_pdu->dmrs_cyclic_shift, ppWritePackedMsg, end) && + push8(pucch_pdu->sr_flag, ppWritePackedMsg, end) && + push8(pucch_pdu->bit_len_harq, ppWritePackedMsg, end) && + push16(pucch_pdu->bit_len_csi_part1, ppWritePackedMsg, end) && + push16(pucch_pdu->bit_len_csi_part2, ppWritePackedMsg, end) + // TODO: ignoring beamforming tlv for now + ); + +} + + +static uint8_t pack_ul_tti_request_pusch_pdu(nfapi_nr_pusch_pdu_t* pusch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + + if (!( + push16(pusch_pdu->pdu_bit_map, ppWritePackedMsg, end) && + push16(pusch_pdu->rnti, ppWritePackedMsg, end) && + push32(pusch_pdu->handle, ppWritePackedMsg, end) && + push16(pusch_pdu->bwp_size, ppWritePackedMsg, end) && + push16(pusch_pdu->bwp_start, ppWritePackedMsg, end) && + push8(pusch_pdu->subcarrier_spacing, ppWritePackedMsg, end) && + push8(pusch_pdu->cyclic_prefix, ppWritePackedMsg, end) && + push16(pusch_pdu->target_code_rate, ppWritePackedMsg, end) && + push8(pusch_pdu->qam_mod_order, ppWritePackedMsg, end) && + push8(pusch_pdu->mcs_index, ppWritePackedMsg, end) && + push8(pusch_pdu->mcs_table, ppWritePackedMsg, end) && + push8(pusch_pdu->transform_precoding, ppWritePackedMsg, end) && + push16(pusch_pdu->data_scrambling_id, ppWritePackedMsg, end) && + push8(pusch_pdu->nrOfLayers, ppWritePackedMsg, end) && + push16(pusch_pdu->ul_dmrs_symb_pos, ppWritePackedMsg, end) && + push8(pusch_pdu->dmrs_config_type, ppWritePackedMsg, end) && + push16(pusch_pdu->ul_dmrs_scrambling_id, ppWritePackedMsg, end) && + push8(pusch_pdu->scid, ppWritePackedMsg, end) && + push8(pusch_pdu->num_dmrs_cdm_grps_no_data, ppWritePackedMsg, end) && + push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) && + push8(pusch_pdu->resource_alloc, ppWritePackedMsg, end) && + push8(pusch_pdu->resource_alloc,ppWritePackedMsg, end) && + push16(pusch_pdu->dmrs_ports, ppWritePackedMsg, end) && + push16(pusch_pdu->rb_start, ppWritePackedMsg, end) && + push16(pusch_pdu->rb_size, ppWritePackedMsg, end) && + push8(pusch_pdu->vrb_to_prb_mapping, ppWritePackedMsg, end) && + push8(pusch_pdu->frequency_hopping, ppWritePackedMsg, end) && + push16(pusch_pdu->tx_direct_current_location, ppWritePackedMsg, end) && + push8(pusch_pdu->uplink_frequency_shift_7p5khz, ppWritePackedMsg, end) && + push8(pusch_pdu->start_symbol_index, ppWritePackedMsg, end) && + push8(pusch_pdu->nr_of_symbols, ppWritePackedMsg, end) + // TODO: ignoring beamforming tlv for now + )) + return 0; + + + //Pack Optional Data only included if indicated in pduBitmap + switch(pusch_pdu->pdu_bit_map){ + case PUSCH_PDU_BITMAP_PUSCH_DATA: + { + // pack optional TLVs + return( + push8(pusch_pdu->pusch_data.rv_index, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_data.harq_process_id, ppWritePackedMsg, end) && + push32(pusch_pdu->pusch_data.tb_size, ppWritePackedMsg, end) && + push16(pusch_pdu->pusch_data.num_cb, ppWritePackedMsg, end) && + pusharray8(pusch_pdu->pusch_data.cb_present_and_position,1,1,ppWritePackedMsg, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_PUSCH_UCI: + { + return( + push16(pusch_pdu->pusch_uci.harq_ack_bit_length, ppWritePackedMsg, end) && + push16(pusch_pdu->pusch_uci.csi_part1_bit_length, ppWritePackedMsg, end) && + push16(pusch_pdu->pusch_uci.csi_part2_bit_length, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_uci.alpha_scaling, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_uci.beta_offset_harq_ack, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_uci.beta_offset_csi1, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_uci.beta_offset_csi2, ppWritePackedMsg, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_PUSCH_PTRS: + { + return( + push8(pusch_pdu->pusch_ptrs.num_ptrs_ports, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, ppWritePackedMsg, end) && + push16(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ptrs_time_density, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ptrs_freq_density, ppWritePackedMsg, end) && + push8(pusch_pdu->pusch_ptrs.ul_ptrs_power, ppWritePackedMsg, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_DFTS_OFDM: + { + return( + push8(pusch_pdu->dfts_ofdm.low_papr_group_number, ppWritePackedMsg, end) && + push16(pusch_pdu->dfts_ofdm.low_papr_sequence_number, ppWritePackedMsg, end) && + push8(pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, ppWritePackedMsg, end) && + push8(pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, ppWritePackedMsg, end) + ); + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map ); + } + } + + return 1; +} + +static uint8_t pack_ul_tti_request_srs_pdu(nfapi_nr_srs_pdu_t* srs_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return( + push16(srs_pdu->rnti, ppWritePackedMsg, end) && + push32(srs_pdu->handle, ppWritePackedMsg, end) && + push16(srs_pdu->bwp_size, ppWritePackedMsg, end) && + push16(srs_pdu->bwp_start, ppWritePackedMsg, end) && + push8(srs_pdu->subcarrier_spacing, ppWritePackedMsg, end) && + push8(srs_pdu->cyclic_prefix, ppWritePackedMsg, end) && + push8(srs_pdu->num_ant_ports, ppWritePackedMsg, end) && + push8(srs_pdu->num_symbols, ppWritePackedMsg, end) && + push8(srs_pdu->num_repetitions, ppWritePackedMsg, end) && + push8(srs_pdu->time_start_position, ppWritePackedMsg, end) && + push8(srs_pdu->config_index, ppWritePackedMsg, end) && + push16(srs_pdu->sequence_id, ppWritePackedMsg, end) && + push8(srs_pdu->bandwidth_index, ppWritePackedMsg, end) && + push8(srs_pdu->comb_size, ppWritePackedMsg, end) && + push8(srs_pdu->comb_offset, ppWritePackedMsg, end) && + push8(srs_pdu->cyclic_shift, ppWritePackedMsg, end) && + push8(srs_pdu->frequency_position, ppWritePackedMsg, end) && + push8(srs_pdu->frequency_shift, ppWritePackedMsg, end) && + push8(srs_pdu->frequency_hopping, ppWritePackedMsg, end) && + push8(srs_pdu->group_or_sequence_hopping, ppWritePackedMsg, end) && + push8(srs_pdu->resource_type, ppWritePackedMsg, end) && + push16(srs_pdu->t_srs, ppWritePackedMsg, end) && + push16(srs_pdu->t_offset, ppWritePackedMsg, end) + + // TODO: ignoring beamforming tlv for now + ); + +} + +static uint8_t pack_ul_config_request_ulsch_pdu(nfapi_ul_config_ulsch_pdu* ulsch_pdu, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &ulsch_pdu->ulsch_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &ulsch_pdu->ulsch_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel10_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &ulsch_pdu->ulsch_pdu_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel11_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &ulsch_pdu->ulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_rel13_value)); +} + +static uint8_t pack_ul_config_request_cqi_ri_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv; + + return ( push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel8->ri_size, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel8->delta_offset_cqi, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel8->delta_offset_ri, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_cqi_ri_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv; + + if(!(push8(cqi_ri_info_rel9->report_type, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel9->delta_offset_cqi, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel9->delta_offset_ri, ppWritePackedMsg, end))) + { + return 0; + } + + switch(cqi_ri_info_rel9->report_type) + { + case NFAPI_CSI_REPORT_TYPE_PERIODIC: + { + if(!(push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, ppWritePackedMsg, end) && + push8(cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, ppWritePackedMsg, end))) + { + return 0; + } + } + break; + case NFAPI_CSI_REPORT_TYPE_APERIODIC: + { + if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, ppWritePackedMsg, end) == 0) + return 0; + + uint8_t i; + for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i) + { + if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, ppWritePackedMsg, end) == 0) + return 0; + + uint8_t j; + for(j = 0; j < 8; ++j) + { + if(push8(cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], ppWritePackedMsg, end) == 0) + return 0; + } + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type ); + } + break; + }; + + return 1; +} + +static uint8_t pack_ul_config_request_cqi_ri_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv; + + switch(cqi_ri_info_rel13->report_type) + { + case NFAPI_CSI_REPORT_TYPE_PERIODIC: + { + if(push16(cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, ppWritePackedMsg, end) == 0) + return 0; + } + break; + case NFAPI_CSI_REPORT_TYPE_APERIODIC: + { + // No parameters + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel13->report_type ); + } + break; + }; + + return 1; +} + +static uint8_t pack_ul_config_request_cqi_ri_information(nfapi_ul_config_cqi_ri_information* cqi_ri_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return (pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &cqi_ri_info->cqi_ri_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &cqi_ri_info->cqi_ri_information_rel9, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel9_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &cqi_ri_info->cqi_ri_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_ri_rel13_value)); + +} + +static uint8_t pack_ul_config_request_init_tx_params_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv; + + return (push8(init_tx_params_rel8->n_srs_initial, ppWritePackedMsg, end) && + push8(init_tx_params_rel8->initial_number_of_resource_blocks, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_initial_transmission_parameters(nfapi_ul_config_initial_transmission_parameters* init_tx_params, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return pack_tlv(NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &init_tx_params->initial_transmission_parameters_rel8, ppWritePackedMsg, end, &pack_ul_config_request_init_tx_params_rel8_value); +} + +static uint8_t pack_ul_config_request_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv; + + return (push8(harq_info_rel10->harq_size, ppWritePackedMsg, end) && + push8(harq_info_rel10->delta_offset_harq, ppWritePackedMsg, end) && + push8(harq_info_rel10->ack_nack_mode, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv; + + return (push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) && + push8(harq_info_rel13->delta_offset_harq_2, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_ulsch_harq_information(nfapi_ul_config_ulsch_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &harq_info->harq_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel10_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ulsch_harq_info_rel13_value)); +} + +static uint8_t pack_ul_config_request_ue_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv; + + return ( push32(ue_info_rel8->handle, ppWritePackedMsg, end) && + push16(ue_info_rel8->rnti, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_ue_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv; + + return ( push8(ue_info_rel11->virtual_cell_id_enabled_flag, ppWritePackedMsg, end) && + push16(ue_info_rel11->npusch_identity, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_ue_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv; + + return ( push8(ue_info_rel13->ue_type, ppWritePackedMsg, end) && + push8(ue_info_rel13->empty_symbols, ppWritePackedMsg, end) && + push16(ue_info_rel13->total_number_of_repetitions, ppWritePackedMsg, end) && + push16(ue_info_rel13->repetition_number, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_ue_information(nfapi_ul_config_ue_information* ue_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &ue_info->ue_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &ue_info->ue_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel11_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &ue_info->ue_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_ue_info_rel13_value)); +} + +static uint8_t pack_ul_config_request_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_rel10_tdd = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv; + + return ( push8(harq_info_rel10_tdd->harq_size, ppWritePackedMsg, end) && + push8(harq_info_rel10_tdd->ack_nack_mode, ppWritePackedMsg, end) && + push8(harq_info_rel10_tdd->number_of_pucch_resources, ppWritePackedMsg, end) && + push16(harq_info_rel10_tdd->n_pucch_1_0, ppWritePackedMsg, end) && + push16(harq_info_rel10_tdd->n_pucch_1_1, ppWritePackedMsg, end) && + push16(harq_info_rel10_tdd->n_pucch_1_2, ppWritePackedMsg, end) && + push16(harq_info_rel10_tdd->n_pucch_1_3, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_rel8_fdd = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv; + + return ( push16(harq_info_rel8_fdd->n_pucch_1_0, ppWritePackedMsg, end) && + push8(harq_info_rel8_fdd->harq_size, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_rel9_fdd = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv; + + return ( push8(harq_info_rel9_fdd->harq_size, ppWritePackedMsg, end) && + push8(harq_info_rel9_fdd->ack_nack_mode, ppWritePackedMsg, end) && + push8(harq_info_rel9_fdd->number_of_pucch_resources, ppWritePackedMsg, end) && + push16(harq_info_rel9_fdd->n_pucch_1_0, ppWritePackedMsg, end) && + push16(harq_info_rel9_fdd->n_pucch_1_1, ppWritePackedMsg, end) && + push16(harq_info_rel9_fdd->n_pucch_1_2, ppWritePackedMsg, end) && + push16(harq_info_rel9_fdd->n_pucch_1_3, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_harq_info_rel11_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv; + + return ( push8(harq_info_rel11->num_ant_ports, ppWritePackedMsg, end) && + push16(harq_info_rel11->n_pucch_2_0, ppWritePackedMsg, end) && + push16(harq_info_rel11->n_pucch_2_1, ppWritePackedMsg, end) && + push16(harq_info_rel11->n_pucch_2_2, ppWritePackedMsg, end) && + push16(harq_info_rel11->n_pucch_2_3, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_harq_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv; + + return ( push16(harq_info_rel13->harq_size_2, ppWritePackedMsg, end) && + push8(harq_info_rel13->starting_prb, ppWritePackedMsg, end) && + push8(harq_info_rel13->n_prb, ppWritePackedMsg, end) && + push8(harq_info_rel13->cdm_index, ppWritePackedMsg, end) && + push8(harq_info_rel13->n_srs, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_harq_information(nfapi_ul_config_harq_information* harq_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &harq_info->harq_information_rel10_tdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel10_tdd_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &harq_info->harq_information_rel8_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel8_fdd_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &harq_info->harq_information_rel9_fdd, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel9_fdd_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &harq_info->harq_information_rel11, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel11_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &harq_info->harq_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_harq_info_rel13_value)); + +} + +static uint8_t pack_ul_config_request_cqi_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv; + + return ( push16(cqi_info_rel8->pucch_index, ppWritePackedMsg, end) && + push8(cqi_info_rel8->dl_cqi_pmi_size, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_cqi_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv; + + return ( push8(cqi_info_rel10->number_of_pucch_resource, ppWritePackedMsg, end) && + push16(cqi_info_rel10->pucch_index_p1, ppWritePackedMsg, end)); +} +static uint8_t pack_ul_config_request_cqi_info_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv; + + return ( push8(cqi_info_rel13->csi_mode, ppWritePackedMsg, end) && + push16(cqi_info_rel13->dl_cqi_pmi_size_2, ppWritePackedMsg, end) && + push8(cqi_info_rel13->starting_prb, ppWritePackedMsg, end) && + push8(cqi_info_rel13->n_prb, ppWritePackedMsg, end) && + push8(cqi_info_rel13->cdm_index, ppWritePackedMsg, end) && + push8(cqi_info_rel13->n_srs, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_cqi_information(nfapi_ul_config_cqi_information* cqi_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &cqi_info->cqi_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &cqi_info->cqi_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel10_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &cqi_info->cqi_information_rel13, ppWritePackedMsg, end, &pack_ul_config_request_cqi_info_rel13_value)); + +} + +static uint8_t pack_ul_config_request_sr_info_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv; + return push16(sr_info_rel8->pucch_index, ppWritePackedMsg, end); +} +static uint8_t pack_ul_config_request_sr_info_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv; + + return ( push8(sr_info_rel10->number_of_pucch_resources, ppWritePackedMsg, end) && + push16(sr_info_rel10->pucch_index_p1, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_sr_information(nfapi_ul_config_sr_information* sr_info, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &sr_info->sr_information_rel8, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &sr_info->sr_information_rel10, ppWritePackedMsg, end, &pack_ul_config_request_sr_info_rel10_value)); +} + +static uint8_t pack_ul_config_request_srs_pdu_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv; + + return (push32(srs_pdu_rel8->handle, ppWritePackedMsg, end) && + push16(srs_pdu_rel8->size, ppWritePackedMsg, end) && + push16(srs_pdu_rel8->rnti, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->srs_bandwidth, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->frequency_domain_position, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->srs_hopping_bandwidth, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->transmission_comb, ppWritePackedMsg, end) && + push16(srs_pdu_rel8->i_srs, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->sounding_reference_cyclic_shift, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_srs_pdu_rel10_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv; + return push8(srs_pdu_rel10->antenna_port, ppWritePackedMsg, end); +} + +static uint8_t pack_ul_config_request_srs_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv; + + return ( push8(srs_pdu_rel13->number_of_combs, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_nb_harq_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_pdu_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv; + + return ( push8(nb_harq_pdu_rel13->harq_ack_resource, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_config_request_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv; + + return (push8(nulsch_pdu_rel13->nulsch_format, ppWritePackedMsg, end) && + push32(nulsch_pdu_rel13->handle, ppWritePackedMsg, end) && + push16(nulsch_pdu_rel13->size, ppWritePackedMsg, end) && + push16(nulsch_pdu_rel13->rnti, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->resource_assignment, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->mcs, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->redudancy_version, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->repetition_number, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->new_data_indication, ppWritePackedMsg, end) && + push8(nulsch_pdu_rel13->n_srs, ppWritePackedMsg, end) && + push16(nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, ppWritePackedMsg, end) && + push16(nulsch_pdu_rel13->sf_idx, ppWritePackedMsg, end) && + pack_ul_config_request_ue_information(&(nulsch_pdu_rel13->ue_information), ppWritePackedMsg, end) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, ppWritePackedMsg, end, &pack_ul_config_request_nb_harq_rel13_value)); +} +static uint8_t pack_ul_config_request_nrach_pdu_rel13_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv; + + return ( push8(nrach_pdu_rel13->nprach_config_0, ppWritePackedMsg, end) && + push8(nrach_pdu_rel13->nprach_config_1, ppWritePackedMsg, end) && + push8(nrach_pdu_rel13->nprach_config_2, ppWritePackedMsg, end)); + +} + + + +static uint8_t pack_ul_tti_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_ul_tti_request_number_of_pdus_t* value = (nfapi_nr_ul_tti_request_number_of_pdus_t*)tlv; + + if(!(push16(value->pdu_size, ppWritePackedMsg, end) && + push16(value->pdu_type, ppWritePackedMsg, end) )) + return 0; + + + // first match the pdu type, then call the respective function + switch(value->pdu_type) + { + case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE: + { + if(!pack_ul_tti_request_prach_pdu(&value->prach_pdu, ppWritePackedMsg, end)) + return 0; + } + break; + + case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: + { + if(!pack_ul_tti_request_pucch_pdu(&value->pucch_pdu, ppWritePackedMsg, end)) + return 0; + } + break; + case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: + { + if(!pack_ul_tti_request_pusch_pdu(&value->pusch_pdu, ppWritePackedMsg, end)) + return 0; + } + break; + case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE: + { + if(!pack_ul_tti_request_srs_pdu(&value->srs_pdu, ppWritePackedMsg, end)) + return 0; + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", value->pdu_type ); + } + break; + } + + return 1; +} + +static uint8_t pack_ul_tti_groups_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_ul_tti_request_number_of_groups_t* value = (nfapi_nr_ul_tti_request_number_of_groups_t*)tlv; + + if(!push8(value->n_ue, ppWritePackedMsg, end)) + return 0; + for(int i=0; in_ue;i++) + { + if(!push8(value->ue_list[i].pdu_idx, ppWritePackedMsg, end)) + return 0; + } + return 1; +} + +static uint8_t pack_ul_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv; + + if(!(push8(value->number_of_pdus, ppWritePackedMsg, end) && + push8(value->rach_prach_frequency_resources, ppWritePackedMsg, end) && + push8(value->srs_present, ppWritePackedMsg, end))) + return 0; + + uint16_t i = 0; + for(i = 0; i < value->number_of_pdus; ++i) + { + nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]); + + if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: + { + if(!pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_pdu), ppWritePackedMsg, end)) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) && + pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_harq_pdu.harq_information), ppWritePackedMsg, end) && + pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_harq_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_ri_information(&(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information), ppWritePackedMsg, end) && + pack_ul_config_request_ulsch_harq_information(&(pdu->ulsch_cqi_harq_ri_pdu.harq_information), ppWritePackedMsg, end) && + pack_ul_config_request_initial_transmission_parameters(&(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->uci_cqi_pdu.cqi_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_sr_information(&(pdu->uci_sr_pdu.sr_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_harq_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->uci_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_sr_harq_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_sr_information(&(pdu->uci_sr_harq_pdu.sr_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->uci_sr_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_harq_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->uci_cqi_harq_pdu.cqi_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->uci_cqi_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_pdu.cqi_information), ppWritePackedMsg, end) && + pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_pdu.sr_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->uci_cqi_sr_harq_pdu.ue_information), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->uci_cqi_sr_harq_pdu.cqi_information), ppWritePackedMsg, end) && + pack_ul_config_request_sr_information(&(pdu->uci_cqi_sr_harq_pdu.sr_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->uci_cqi_sr_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_SRS_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &pdu->srs_pdu.srs_pdu_rel8, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel8_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &pdu->srs_pdu.srs_pdu_rel10, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel10_value) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &pdu->srs_pdu.srs_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_srs_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: + { + if(!(pack_ul_config_request_ue_information(&(pdu->harq_buffer_pdu.ue_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_csi_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->ulsch_uci_csi_pdu.csi_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->ulsch_uci_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: + { + if(!(pack_ul_config_request_ulsch_pdu(&(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu), ppWritePackedMsg, end) && + pack_ul_config_request_cqi_information(&(pdu->ulsch_csi_uci_harq_pdu.csi_information), ppWritePackedMsg, end) && + pack_ul_config_request_harq_information(&(pdu->ulsch_csi_uci_harq_pdu.harq_information), ppWritePackedMsg, end))) + return 0; + } + break; + case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &pdu->nulsch_pdu.nulsch_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nulsch_pdu_rel13_value))) + return 0; + } + break; + case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &pdu->nrach_pdu.nrach_pdu_rel13, ppWritePackedMsg, end, &pack_ul_config_request_nrach_pdu_rel13_value))) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + + } + return 1; +} + + +static uint8_t pack_ul_tti_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg; + + if (!(push16(pNfapiMsg->SFN , ppWritePackedMsg, end) && + push16(pNfapiMsg->Slot , ppWritePackedMsg, end) && + push8(pNfapiMsg->n_pdus , ppWritePackedMsg, end) && + push8(pNfapiMsg->rach_present, ppWritePackedMsg, end) && + push8(pNfapiMsg->n_ulsch, ppWritePackedMsg, end) && + push8(pNfapiMsg->n_ulcch, ppWritePackedMsg, end) && + push8(pNfapiMsg->n_group, ppWritePackedMsg, end) )) + return 0; + + for(int i=0; in_pdus; i++) + { + if(!pack_ul_tti_pdu_list_value(&pNfapiMsg->pdus_list[i], ppWritePackedMsg, end)) + return 0; + } + + for(int i=0; in_group; i++) + { + if(!pack_ul_tti_groups_list_value(&pNfapiMsg->groups_list[i], ppWritePackedMsg, end)) + return 0; + + } + + return 1; +} + + +static uint8_t pack_ul_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, ppWritePackedMsg, end, &pack_ul_config_request_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)) ; +} + +static uint8_t pack_hi_dci0_hi_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv; + + return ( push8(hi_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && + push8(hi_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && + push8(hi_pdu_rel8->hi_value, ppWritePackedMsg, end) && + push8(hi_pdu_rel8->i_phich, ppWritePackedMsg, end) && + push16(hi_pdu_rel8->transmission_power, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_hi_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv; + + return ( push8(hi_pdu_rel10->flag_tb2, ppWritePackedMsg, end) && + push8(hi_pdu_rel10->hi_value_2, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_dci_rel8_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv; + + return ( push8(dci_pdu_rel8->dci_format, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->cce_index, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->aggregation_level, ppWritePackedMsg, end) && + push16(dci_pdu_rel8->rnti, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->resource_block_start, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->number_of_resource_block, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->mcs_1, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->cyclic_shift_2_for_drms, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->frequency_hopping_enabled_flag, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->frequency_hopping_bits, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->new_data_indication_1, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->ue_tx_antenna_seleciton, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->tpc, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->cqi_csi_request, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->ul_index, ppWritePackedMsg, end) && + push8(dci_pdu_rel8->dl_assignment_index, ppWritePackedMsg, end) && + push32(dci_pdu_rel8->tpc_bitmap, ppWritePackedMsg, end) && + push16(dci_pdu_rel8->transmission_power, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_dci_rel10_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv; + + return ( push8(dci_pdu_rel10->cross_carrier_scheduling_flag, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->carrier_indicator, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->size_of_cqi_csi_feild, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->srs_flag, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->srs_request, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->resource_allocation_flag, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->resource_allocation_type, ppWritePackedMsg, end) && + push32(dci_pdu_rel10->resource_block_coding, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->mcs_2, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->new_data_indication_2, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->number_of_antenna_ports, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->tpmi, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->total_dci_length_including_padding, ppWritePackedMsg, end) && + push8(dci_pdu_rel10->n_ul_rb, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_dci_rel12_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv; + + return ( push8(dci_pdu_rel12->pscch_resource, ppWritePackedMsg, end) && + push8(dci_pdu_rel12->time_resource_pattern, ppWritePackedMsg, end)); +} + +static uint8_t pack_hi_dci0_mpdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* mpdcch_dci_pdu_rel13 = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv; + + return ( push8(mpdcch_dci_pdu_rel13->mpdcch_narrowband, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->number_of_prb_pairs, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->resource_block_assignment, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->mpdcch_transmission_type, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->ecce_index, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->aggreagation_level, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->rnti_type, ppWritePackedMsg, end) && + push16(mpdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->ce_mode, ppWritePackedMsg, end) && + push16(mpdcch_dci_pdu_rel13->drms_scrambling_init, ppWritePackedMsg, end) && + push16(mpdcch_dci_pdu_rel13->initial_transmission_sf_io, ppWritePackedMsg, end) && + push16(mpdcch_dci_pdu_rel13->transmission_power, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->dci_format, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->resource_block_start, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->number_of_resource_blocks, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->pusch_repetition_levels, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->frequency_hopping_flag, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->new_data_indication, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->harq_process, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->redudency_version, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->tpc, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->csi_request, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->ul_inex, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->dai_presence_flag, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->dl_assignment_index, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->srs_request, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end) && + push32(mpdcch_dci_pdu_rel13->tcp_bitmap, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->total_dci_length_include_padding, ppWritePackedMsg, end) && + push8(mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end) && + pusharray16(mpdcch_dci_pdu_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_dci_pdu_rel13->number_of_tx_antenna_ports, ppWritePackedMsg, end)); + +} + +static uint8_t pack_hi_dci0_npdcch_dci_rel13_pdu_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* npdcch_dci_pdu_rel13 = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv; + + return ( push8(npdcch_dci_pdu_rel13->ncce_index, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->aggregation_level, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->start_symbol, ppWritePackedMsg, end) && + push16(npdcch_dci_pdu_rel13->rnti, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->scrambling_reinitialization_batch_index, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->nrs_antenna_ports_assumed_by_the_ue, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->subcarrier_indication, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->resource_assignment, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->scheduling_delay, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->mcs, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->redudancy_version, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->repetition_number, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->new_data_indicator, ppWritePackedMsg, end) && + push8(npdcch_dci_pdu_rel13->dci_subframe_repetition_number, ppWritePackedMsg, end)); +} + + +static uint8_t pack_hi_dci0_request_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv; + + if(!(push16(value->sfnsf, ppWritePackedMsg, end) && + push8(value->number_of_dci, ppWritePackedMsg, end) && + push8(value->number_of_hi, ppWritePackedMsg, end))) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_dci + value->number_of_hi; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]); + + if(push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_HI_DCI0_HI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_hi_rel8_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_hi_rel10_pdu_value))) + return 0; + } + break; + case NFAPI_HI_DCI0_DCI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, ppWritePackedMsg, end, pack_hi_dci0_dci_rel12_pdu_value))) + return 0; + } + break; + case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, ppWritePackedMsg, end, pack_hi_dci0_dci_rel8_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, ppWritePackedMsg, end, pack_hi_dci0_dci_rel10_pdu_value) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, ppWritePackedMsg, end, pack_dl_config_epdcch_parameters_rel11_value))) + return 0; + } + break; + case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_mpdcch_dci_rel13_pdu_value))) + return 0; + } + break; + case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: + { + if(!(pack_tlv(NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, ppWritePackedMsg, end, pack_hi_dci0_npdcch_dci_rel13_pdu_value))) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + + } + + return 1; +} + +static uint8_t pack_ul_dci_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)tlv; + + for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) + { + if(!(push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, ppWritePackedMsg, end) && + + push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, ppWritePackedMsg, end) && + + push8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end) && + + pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, ppWritePackedMsg, end))) + + return 0; + } + + return (push16(value->PDUType, ppWritePackedMsg, end) && + push16(value->PDUSize, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, ppWritePackedMsg, end) && + + push8(value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, ppWritePackedMsg, end) && + pusharray8(value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, ppWritePackedMsg, end) && + + push8(value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, ppWritePackedMsg, end) && + push8(value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, ppWritePackedMsg, end) && + push16(value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, ppWritePackedMsg, end)); + +} + +static uint8_t pack_ul_dci_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg; + + if (!(push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && + push16(pNfapiMsg->Slot, ppWritePackedMsg, end) && + push8(pNfapiMsg->numPdus, ppWritePackedMsg, end) + )) + return 0; + + for(int i=0; inumPdus; i++) + { + if(!pack_ul_dci_pdu_list_value(&pNfapiMsg->ul_dci_pdu_list[i], ppWritePackedMsg, end)) + return 0; + } + return 1; + + +} + + + +static uint8_t pack_hi_dci0_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, ppWritePackedMsg, end, &pack_hi_dci0_request_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +//pack_tx_data_pdu_list_value +static uint8_t pack_tx_data_pdu_list_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nr_pdu_t* value = (nfapi_nr_pdu_t*)tlv; + + if(!(push32(value->num_TLV, ppWritePackedMsg, end) && + push16(value->PDU_index, ppWritePackedMsg, end) && + push16(value->PDU_length, ppWritePackedMsg, end) + )) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_tlvs = value->num_TLV; + for(; i < total_number_of_tlvs; ++i) + { + + if (!(push16(value->TLVs[i].length, ppWritePackedMsg, end) && + push16(value->TLVs[i].tag, ppWritePackedMsg, end))) + return 0; + + switch(value->TLVs[i].tag) + { + case 0: + { + if(!pusharray32(value->TLVs[i].value.direct, 16384, value->TLVs[i].length, ppWritePackedMsg, end)) + return 0; + break; + + } + + case 1: + { + if(!pusharray32(value->TLVs[i].value.ptr, value->TLVs[i].length , value->TLVs[i].length, ppWritePackedMsg, end)) + return 0; + break; + + } + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", value->TLVs[i].tag ); + break; + } + + } + } + return 1; +} + +static uint8_t pack_tx_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_tx_request_body_t* value = (nfapi_tx_request_body_t*)tlv; + + if(push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(; i < total_number_of_pdus; ++i) + { + nfapi_tx_request_pdu_t* pdu = &(value->tx_pdu_list[i]); + + if(!(push16(pdu->pdu_length, ppWritePackedMsg, end) && + push16(pdu->pdu_index, ppWritePackedMsg, end))) + return 0; + + uint8_t j; + for(j = 0; j < pdu->num_segments; ++j) + { + // Use -1 as it is unbounded + // DJP - does not handle -1 + // DJP - if(pusharray8(pdu->segments[j].segment_data, (uint32_t)(-1), pdu->segments[j].segment_length, ppWritePackedMsg, end) == 0) + int push_ret = pusharray8(pdu->segments[j].segment_data, 65535, pdu->segments[j].segment_length, ppWritePackedMsg, end); + + if (pdu->segments[j].segment_length == 3) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, + pdu->segments[j].segment_data[0], + pdu->segments[j].segment_data[1], + pdu->segments[j].segment_data[2] + ); + } + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() segment_data:%p segment_length:%u pusharray8()=%d\n", __FUNCTION__, pdu->segments[j].segment_data, pdu->segments[j].segment_length, push_ret); + + if (push_ret == 0) + { + return 0; + } + } + } + + return 1; +} + +static uint8_t pack_tx_data_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg; + + if (!( + push16(pNfapiMsg->SFN, ppWritePackedMsg, end) && + push16(pNfapiMsg->Slot, ppWritePackedMsg, end) && + push16(pNfapiMsg->Number_of_PDUs, ppWritePackedMsg, end) + )) + return 0; + + for(int i=0; iNumber_of_PDUs; i++) + { + if(!pack_tx_data_pdu_list_value(&pNfapiMsg->pdu_list[i], ppWritePackedMsg, end)) + return 0; + } + + return 1; +} + +static uint8_t pack_tx_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg; + + int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); + int y = pack_tlv(NFAPI_TX_REQUEST_BODY_TAG, &pNfapiMsg->tx_request_body, ppWritePackedMsg, end, &pack_tx_request_body_value); + int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); + + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() x:%d y:%d z:%d\n", __FUNCTION__, x, y, z); + + return x && y && z; +} + +static uint8_t pack_release_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ue_release_request_body_t* value = (nfapi_ue_release_request_body_t*)tlv; + if(push16(value->number_of_TLVs, ppWritePackedMsg, end) == 0){ + return 0; + } + + uint8_t j; + uint16_t num = value->number_of_TLVs; + for(j = 0; j < num; ++j){ + if(push16(value->ue_release_request_TLVs_list[j].rnti, ppWritePackedMsg, end) == 0){ + return 0; + } + } + return 1; +} + +static uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; + int x = push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end); + int y = pack_tlv(NFAPI_UE_RELEASE_BODY_TAG, &pNfapiMsg->ue_release_request_body, ppWritePackedMsg, end, &pack_release_request_body_value); + int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); + return x && y && z; +} + +static uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + + nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; + + int x = push32(pNfapiMsg->error_code, ppWritePackedMsg, end); + int z = pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config); + return x && z; +} + +static uint8_t pack_rx_ue_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push16(value->rnti, ppWritePackedMsg, end) ); +} + +static uint8_t unpack_rx_ue_information_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_rx_ue_information* value = (nfapi_rx_ue_information*)tlv; + + return ( pull32(ppReadPackedMsg, &value->handle, end) && + pull16(ppReadPackedMsg, &value->rnti, end)); +} + +static uint8_t pack_harq_indication_tdd_harq_data_bundling(nfapi_harq_indication_tdd_harq_data_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(data->value_0, ppWritePackedMsg, end) && + push8(data->value_1, ppWritePackedMsg, end)); +} + +static uint8_t pack_harq_indication_tdd_harq_data_multiplexing(nfapi_harq_indication_tdd_harq_data_multiplexing_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(data->value_0, ppWritePackedMsg, end) && + push8(data->value_1, ppWritePackedMsg, end) && + push8(data->value_2, ppWritePackedMsg, end) && + push8(data->value_3, ppWritePackedMsg, end)); +} + +static uint8_t pack_harq_indication_tdd_harq_data_special_bundling(nfapi_harq_indication_tdd_harq_data_special_bundling_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(data->value_0, ppWritePackedMsg, end) ); +} + +static uint8_t pack_harq_indication_tdd_harq_data(nfapi_harq_indication_tdd_harq_data_t* data, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + return ( push8(data->value_0, ppWritePackedMsg, end) ); +} + +static uint8_t pack_harq_indication_tdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel8_t* harq_indication_tdd_rel8 = (nfapi_harq_indication_tdd_rel8_t*)tlv; + + if(!(push8(harq_indication_tdd_rel8->mode, ppWritePackedMsg, end) && + push8(harq_indication_tdd_rel8->number_of_ack_nack, ppWritePackedMsg, end))) + return 0; + + uint8_t result = 0; + switch(harq_indication_tdd_rel8->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = pack_harq_indication_tdd_harq_data_bundling(&harq_indication_tdd_rel8->harq_data.bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = pack_harq_indication_tdd_harq_data_multiplexing(&harq_indication_tdd_rel8->harq_data.multiplex, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel8->harq_data.special_bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = 1; + break; + default: + // err.... + break; + } + + return result; + +} + +static uint8_t pack_harq_indication_tdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel9_t* harq_indication_tdd_rel9 = (nfapi_harq_indication_tdd_rel9_t*)tlv; + + if(!(push8(harq_indication_tdd_rel9->mode, ppWritePackedMsg, end) && + push8(harq_indication_tdd_rel9->number_of_ack_nack, ppWritePackedMsg, end))) + return 0; + + uint8_t idx; + for(idx = 0; idx < harq_indication_tdd_rel9->number_of_ack_nack; ++idx) + { + uint8_t result = 0; + + switch(harq_indication_tdd_rel9->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = pack_harq_indication_tdd_harq_data(&(harq_indication_tdd_rel9->harq_data[idx].bundling), ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].multiplex, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel9->harq_data[idx].special_bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].channel_selection, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel9->harq_data[idx].format_3, ppWritePackedMsg, end); + break; + default: + // err.... + break; + } + + if(result == 0) + return 0; + } + + return 1; +} + +static uint8_t pack_harq_indication_tdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel13_t* harq_indication_tdd_rel13 = (nfapi_harq_indication_tdd_rel13_t*)tlv; + + if(!(push8(harq_indication_tdd_rel13->mode, ppWritePackedMsg, end) && + push16(harq_indication_tdd_rel13->number_of_ack_nack, ppWritePackedMsg, end))) + return 0; + + uint8_t idx; + for(idx = 0; idx < harq_indication_tdd_rel13->number_of_ack_nack; ++idx) + { + uint8_t result = 0; + switch(harq_indication_tdd_rel13->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].multiplex, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = pack_harq_indication_tdd_harq_data_special_bundling(&harq_indication_tdd_rel13->harq_data[idx].special_bundling, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].channel_selection, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_3, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_4, ppWritePackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5: + result = pack_harq_indication_tdd_harq_data(&harq_indication_tdd_rel13->harq_data[idx].format_5, ppWritePackedMsg, end); + break; + default: + // err.... + break; + } + + if(result == 0) + return 0; + } + + return 1; +} + +static uint8_t pack_harq_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel8_t* harq_indication_fdd_rel8 = (nfapi_harq_indication_fdd_rel8_t*)tlv; + + return ( push8(harq_indication_fdd_rel8->harq_tb1, ppWritePackedMsg, end) && + push8(harq_indication_fdd_rel8->harq_tb2, ppWritePackedMsg, end)); +} + +static uint8_t pack_harq_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel9_t* harq_indication_fdd_rel9 = (nfapi_harq_indication_fdd_rel9_t*)tlv; + + return ( push8(harq_indication_fdd_rel9->mode, ppWritePackedMsg, end) && + push8(harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end) && + pusharray8(harq_indication_fdd_rel9->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, harq_indication_fdd_rel9->number_of_ack_nack, ppWritePackedMsg, end)); +} + +static uint8_t pack_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel13_t* harq_indication_fdd_rel13 = (nfapi_harq_indication_fdd_rel13_t*)tlv; + + return ( push8(harq_indication_fdd_rel13->mode, ppWritePackedMsg, end) && + push16(harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end) && + pusharray8(harq_indication_fdd_rel13->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, harq_indication_fdd_rel13->number_of_ack_nack, ppWritePackedMsg, end)); +} + +static uint8_t pack_ul_cqi_information_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv; + + return ( push8(value->ul_cqi, ppWritePackedMsg, end) && + push8(value->channel, ppWritePackedMsg, end)); + +} + +static uint8_t pack_harq_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv; + + if(push16(value->number_of_harqs, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_harqs; + for(; i < total_number_of_pdus; ++i) + { + nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, ppWritePackedMsg, end, pack_harq_indication_tdd_rel8_value) && + pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, ppWritePackedMsg, end, pack_harq_indication_tdd_rel9_value) && + pack_tlv(NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, ppWritePackedMsg, end, pack_harq_indication_tdd_rel13_value) && + pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, ppWritePackedMsg, end, pack_harq_indication_fdd_rel8_value) && + pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, ppWritePackedMsg, end, pack_harq_indication_fdd_rel9_value) && + pack_tlv(NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_harq_indication_fdd_rel13_value) && + pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + + return 1; +} + +static uint8_t pack_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, ppWritePackedMsg, end, pack_harq_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_crc_indication_rel8_body(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_crc_indication_rel8_t* crc_indication_rel8 = (nfapi_crc_indication_rel8_t*)tlv; + + return ( push8(crc_indication_rel8->crc_flag, ppWritePackedMsg, end) ); +} + +static uint8_t pack_crc_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv; + + if(push16(value->number_of_crcs, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_crcs; + for(; i < total_number_of_pdus; ++i) + { + nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, ppWritePackedMsg, end, pack_crc_indication_rel8_body))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + return 1; +} + +static uint8_t pack_crc_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, ppWritePackedMsg, end, &pack_crc_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + +} +static uint8_t pack_rx_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv; + + return ( push16(value->length, ppWritePackedMsg, end) && + push16(value->offset, ppWritePackedMsg, end) && + push8(value->ul_cqi, ppWritePackedMsg, end) && + push16(value->timing_advance, ppWritePackedMsg, end)); +} +static uint8_t pack_rx_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv; + + return ( push16(value->timing_advance_r9, ppWritePackedMsg, end)); +} + +static uint8_t pack_rx_ulsch_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv; + + //printf("RX ULSCH BODY\n"); + + if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) + return 0; + + // need to calculate the data offset's. + uint16_t i = 0; + uint16_t offset = 2; // taking into account the number_of_pdus + uint16_t total_number_of_pdus = value->number_of_pdus; + //printf("ULSCH:pdus:%d\n", total_number_of_pdus); + + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); + if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG) + { + //printf("NFAPI_RX_UE_INFORMATION_TAG\n"); + offset += 4 + 6; + } + + if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) + { + //printf("NFAPI_RX_INDICATION_REL8_TAG\n"); + offset += 4 + 7; + } + + if(pdu->rx_indication_rel9.tl.tag == NFAPI_RX_INDICATION_REL9_TAG) + { + //printf("NFAPI_RX_INDICATION_REL9_TAG\n"); + offset += 4 + 2; + } + } + + // Now update the structure to include the offset + for(i =0; i < total_number_of_pdus; ++i) + { + nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); + + if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) + { + if(pdu->rx_indication_rel8.offset == 1) + { + pdu->rx_indication_rel8.offset = offset; + offset += pdu->rx_indication_rel8.length; + } + } + } + + // Write out the pdu + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_RX_INDICATION_REL8_TAG, &pdu->rx_indication_rel8, ppWritePackedMsg, end, pack_rx_indication_rel8_value) && + pack_tlv(NFAPI_RX_INDICATION_REL9_TAG, &pdu->rx_indication_rel9, ppWritePackedMsg, end, pack_rx_indication_rel9_value))) + return 0; + } + + // Write out the pdu data + for(i = 0; i < total_number_of_pdus; ++i) + { + uint16_t length = 0; + nfapi_rx_indication_pdu_t* pdu = &(value->rx_pdu_list[i]); + + if(pdu->rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) + { + length = pdu->rx_indication_rel8.length; + } + + if( pusharray8(value->rx_pdu_list[i].data, length, length, ppWritePackedMsg, end) == 0) + return 0; + } + return 1; +} + + +static uint8_t pack_rx_ulsch_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, ppWritePackedMsg, end, pack_rx_ulsch_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_preamble_pdu_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel8_t* preamble_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv; + + return ( push16(preamble_rel8->rnti, ppWritePackedMsg, end) && + push8(preamble_rel8->preamble, ppWritePackedMsg, end) && + push16(preamble_rel8->timing_advance, ppWritePackedMsg, end)); +} +static uint8_t pack_preamble_pdu_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel9_t* preamble_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv; + + return ( push16(preamble_rel9->timing_advance_r9, ppWritePackedMsg, end) ); +} +static uint8_t pack_preamble_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel13_t* preamble_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv; + + return ( push8(preamble_rel13->rach_resource_type, ppWritePackedMsg, end) ); +} + +static uint8_t pack_rach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv; + + if( push16(value->number_of_preambles, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_preambles; + for(; i < total_number_of_pdus; ++i) + { + nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, ppWritePackedMsg, end, pack_preamble_pdu_rel8_value) && + pack_tlv(NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, ppWritePackedMsg, end, pack_preamble_pdu_rel9_value) && + pack_tlv(NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, ppWritePackedMsg, end, pack_preamble_pdu_rel13_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + + return 1; +} + +static uint8_t pack_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, ppWritePackedMsg, end, pack_rach_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel8_t* srs_pdu_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv; + + return ( push16(srs_pdu_rel8->doppler_estimation, ppWritePackedMsg, end) && + push16(srs_pdu_rel8->timing_advance, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end) && + push8(srs_pdu_rel8->rb_start, ppWritePackedMsg, end) && + pusharray8(srs_pdu_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_rel8->number_of_resource_blocks, ppWritePackedMsg, end)); +} + +static uint8_t pack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel9_t* srs_pdu_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv; + + return ( push16(srs_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end) ); +} + +static uint8_t pack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_ttd_rel10_t* srs_pdu_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv; + + return ( push8(srs_pdu_rel10->uppts_symbol, ppWritePackedMsg, end) ); + +} + +static uint8_t pack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel11_t* srs_pdu_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv; + + return ( push16(srs_pdu_rel11->ul_rtoa, ppWritePackedMsg, end) ) ; +} + +static uint8_t pack_tdd_channel_measurement_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv; + + if(!(push8(value->num_prb_per_subband, ppWritePackedMsg, end) && + push8(value->number_of_subbands, ppWritePackedMsg, end) && + push8(value->num_atennas, ppWritePackedMsg, end))) + return 0; + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_subbands; ++idx) + { + if(!(push8(value->subands[idx].subband_index, ppWritePackedMsg, end) && + pusharray16(value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, ppWritePackedMsg, end))) + return 0; + } + + return 1; +} + +static uint8_t pack_srs_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_srs_indication_body_t *value = (nfapi_srs_indication_body_t*)tlv; + + if( push8(value->number_of_ues, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_ues; + for(; i < total_number_of_pdus; ++i) + { + nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, &pack_rx_ue_information_value) && + pack_tlv(NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel8_value) && + pack_tlv(NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel9_value) && + pack_tlv(NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, ppWritePackedMsg, end, &pack_srs_indication_tdd_rel10_value) && + pack_tlv(NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, ppWritePackedMsg, end, &pack_srs_indication_fdd_rel11_value) && + pack_tlv(NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, ppWritePackedMsg, end, &pack_tdd_channel_measurement_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + + return 1; +} + +static uint8_t pack_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, ppWritePackedMsg, end, &pack_srs_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + +} + +static uint8_t pack_sr_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv; + + if(push16(value->number_of_srs, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_srs; + for(; i < total_number_of_pdus; ++i) + { + nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + return 1; +} + +static uint8_t pack_sr_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, ppWritePackedMsg, end, &pack_sr_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + +} + +static uint8_t pack_cqi_indication_rel8_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv; + + return ( push16(cqi_pdu_rel8->length, ppWritePackedMsg, end) && + push16(cqi_pdu_rel8->data_offset, ppWritePackedMsg, end) && + push8(cqi_pdu_rel8->ul_cqi, ppWritePackedMsg, end) && + push8(cqi_pdu_rel8->ri, ppWritePackedMsg, end) && + push16(cqi_pdu_rel8->timing_advance, ppWritePackedMsg, end)); +} + +static uint8_t pack_cqi_indication_rel9_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv; + + return ( push16(cqi_pdu_rel9->length, ppWritePackedMsg, end) && + push16(cqi_pdu_rel9->data_offset, ppWritePackedMsg, end) && + push8(cqi_pdu_rel9->ul_cqi, ppWritePackedMsg, end) && + push8(cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) && + pusharray8(cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, ppWritePackedMsg, end) && + push16(cqi_pdu_rel9->timing_advance, ppWritePackedMsg, end) && + push16(cqi_pdu_rel9->timing_advance_r9, ppWritePackedMsg, end)); +} + +static uint8_t pack_cqi_indication_body_value(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv; + + if( push16(value->number_of_cqis, ppWritePackedMsg, end) == 0) + return 0; + + // need to calculate the data offset's. This very bittle due the hardcoding + // of the sizes. can not use the sizeof as we have an array for the Rel9 + // info + uint16_t i = 0; + uint16_t offset = 2; // taking into account the number_of_cqis + uint16_t total_number_of_pdus = value->number_of_cqis; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + + offset += 2; // for the instance length + + if(pdu->rx_ue_information.tl.tag == NFAPI_RX_UE_INFORMATION_TAG) + { + offset += 4 + 6; // sizeof(nfapi_rx_ue_information) - sizeof(nfapi_tl_t) + } + + if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) + { + offset += 4 + 8; + } + + if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) + { + offset += 4 + 10 + pdu->cqi_indication_rel9.number_of_cc_reported; + } + + if(pdu->ul_cqi_information.tl.tag == NFAPI_UL_CQI_INFORMATION_TAG) + { + offset += 4 + 2; + } + } + + // Now update the structure to include the offset + for(i =0; i < total_number_of_pdus; ++i) + { + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + + if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) + { + if(pdu->cqi_indication_rel8.data_offset == 1) + { + pdu->cqi_indication_rel8.data_offset = offset; + offset += pdu->cqi_indication_rel8.length; + } + } + + if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) + { + if(pdu->cqi_indication_rel9.data_offset == 1) + { + pdu->cqi_indication_rel9.data_offset = offset; + offset += pdu->cqi_indication_rel9.length; + } + } + + } + + // Write out the cqi information + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end ,pack_rx_ue_information_value) && + pack_tlv(NFAPI_CQI_INDICATION_REL8_TAG, &pdu->cqi_indication_rel8, ppWritePackedMsg, end, pack_cqi_indication_rel8_value) && + pack_tlv(NFAPI_CQI_INDICATION_REL9_TAG, &pdu->cqi_indication_rel9, ppWritePackedMsg, end, pack_cqi_indication_rel9_value) && + pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + + } + + // Write out the cqi raw data + for(i = 0; i < total_number_of_pdus; ++i) + { + uint16_t length = 0; + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + + if(pdu->cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) + { + length = pdu->cqi_indication_rel8.length; + } + + if(pdu->cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) + { + length = pdu->cqi_indication_rel9.length; + } + + if( pusharray8(value->cqi_raw_pdu_list[i].pdu, NFAPI_CQI_RAW_MAX_LEN, length, ppWritePackedMsg, end) == 0) + return 0; + } + + return 1; +} + +static uint8_t pack_cqi_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, ppWritePackedMsg, end, pack_cqi_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); + +} + +static uint8_t pack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push32(value->mp_cca, ppWritePackedMsg, end) && + push32(value->n_cca, ppWritePackedMsg, end) && + push32(value->offset, ppWritePackedMsg, end) && + push32(value->lte_txop_sf, ppWritePackedMsg, end) && + push16(value->txop_sfn_sf_end, ppWritePackedMsg, end) && + push32(value->lbt_mode, ppWritePackedMsg, end)); +} + +static uint8_t pack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push32(value->offset, ppWritePackedMsg, end) && + push16(value->sfn_sf_end, ppWritePackedMsg, end) && + push32(value->lbt_mode, ppWritePackedMsg, end)); +} + +static uint8_t pack_lbt_dl_config_request_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv; + + if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(; i < total_number_of_pdus; ++i) + { + nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]); + + if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + if( push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE: + { + if( pack_tlv(NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_req_pdu_rel13_value) == 0) + return 0; + } + break; + case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE: + { + if(pack_tlv(NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_req_pdu_rel13_value) == 0) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + } + + return 1; +} + +static uint8_t pack_lbt_pdsch_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push32(value->result, ppWritePackedMsg, end) && + push32(value->lte_txop_symbols, ppWritePackedMsg, end) && + push32(value->initial_partial_sf, ppWritePackedMsg, end)); +} + +static uint8_t pack_lbt_drs_rsp_pdu_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv; + + return ( push32(value->handle, ppWritePackedMsg, end) && + push32(value->result, ppWritePackedMsg, end)); +} + +static uint8_t pack_lbt_dl_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, ppWritePackedMsg, end, &pack_lbt_dl_config_request_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_lbt_dl_config_indication_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv; + + if( push16(value->number_of_pdus, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(; i < total_number_of_pdus; ++i) + { + nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]); + + if( push8(pdu->pdu_type, ppWritePackedMsg, end) == 0) + return 0; + + // Put a 0 size in and then determine the size after the pdu + // has been writen and write the calculated size + uint8_t* pWritePackedMsgPduSize = *ppWritePackedMsg; + pdu->pdu_size = 0; + + if(push8(pdu->pdu_size, ppWritePackedMsg, end) == 0) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE: + { + if( pack_tlv(NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_pdsch_rsp_pdu_rel13_value) == 0) + return 0; + } + break; + case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE: + { + if( pack_tlv(NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, ppWritePackedMsg, end, pack_lbt_drs_rsp_pdu_rel13_value) == 0) + return 0; + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + + // add 1 for the pdu_type. The delta will include the pdu_size + pdu->pdu_size = 1 + (*ppWritePackedMsg - pWritePackedMsgPduSize); + push8(pdu->pdu_size, &pWritePackedMsgPduSize, end); + } + + return 1; +} + +static uint8_t pack_lbt_dl_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, ppWritePackedMsg, end, &pack_lbt_dl_config_indication_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nb_harq_indication_fdd_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nb_harq_indication_fdd_rel13_t* nb_harq_indication_fdd_rel13 = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv; + + return ( push8(nb_harq_indication_fdd_rel13->harq_tb1, ppWritePackedMsg, end) ); +} + +static uint8_t pack_nb_harq_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv; + + if( push16(value->number_of_harqs, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_harqs = value->number_of_harqs; + for(; i < total_number_of_harqs; ++i) + { + nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]); + + uint8_t* instance_length_p = *ppWritePackedMsg; + if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + return 0; + + if(!(pack_tlv(NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, ppWritePackedMsg, end, pack_rx_ue_information_value) && + pack_tlv(NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, ppWritePackedMsg, end, pack_nb_harq_indication_fdd_rel13_value) && + pack_tlv(NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, ppWritePackedMsg, end, pack_ul_cqi_information_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + push16(instance_length, &instance_length_p, end); + } + + return 1; +} + + +static uint8_t pack_nb_harq_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, ppWritePackedMsg, end, &pack_nb_harq_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nrach_indication_rel13_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nrach_indication_pdu_rel13_t* nrach_indication_fdd_rel13 = (nfapi_nrach_indication_pdu_rel13_t*)tlv; + + return ( push16(nrach_indication_fdd_rel13->rnti, ppWritePackedMsg, end) && + push8(nrach_indication_fdd_rel13->initial_sc, ppWritePackedMsg, end) && + push16(nrach_indication_fdd_rel13->timing_advance, ppWritePackedMsg, end) && + push8(nrach_indication_fdd_rel13->nrach_ce_level, ppWritePackedMsg, end)); +} + + +static uint8_t pack_nrach_indication_body_value(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) +{ + nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv; + + if( push8(value->number_of_initial_scs_detected, ppWritePackedMsg, end) == 0) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_initial_scs_detected = value->number_of_initial_scs_detected; + for(; i < total_number_of_initial_scs_detected; ++i) + { + nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]); + + //uint8_t* instance_length_p = *ppWritePackedMsg; + //if(!push16(pdu->instance_length, ppWritePackedMsg, end)) + // return 0; + + if(!(pack_tlv(NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, ppWritePackedMsg, end, pack_nrach_indication_rel13_value))) + return 0; + + // calculate the instance length subtracting the size of the instance + // length feild + //uint16_t instance_length = *ppWritePackedMsg - instance_length_p - 2; + //push16(instance_length, &instance_length_p, end); + } + + return 1; +} + +static uint8_t pack_nrach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg; + + return ( push16(pNfapiMsg->sfn_sf, ppWritePackedMsg, end) && + pack_tlv(NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, ppWritePackedMsg, end, &pack_nrach_indication_body_value) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nr_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg; + + return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->delta_sfn_slot, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_dl_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg; + + return ( push32(pNfapiMsg->t1, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->delta_sfn_sf, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg; + + return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && + push32(pNfapiMsg->t2, ppWritePackedMsg, end) && + push32(pNfapiMsg->t3, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg; + + return (push32(pNfapiMsg->t1, ppWritePackedMsg, end) && + push32(pNfapiMsg->t2, ppWritePackedMsg, end) && + push32(pNfapiMsg->t3, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg; + + return (push32(pNfapiMsg->last_sfn_sf, ppWritePackedMsg, end) && + push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) && + push32(pNfapiMsg->dl_config_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->tx_request_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->ul_config_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->hi_dci0_jitter, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->dl_config_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->tx_request_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_config_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->hi_dci0_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->dl_config_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->tx_request_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_config_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->hi_dci0_earliest_arrival, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + +static uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg; + + return (push32(pNfapiMsg->last_sfn, ppWritePackedMsg, end) && + push32(pNfapiMsg->last_slot, ppWritePackedMsg, end) && + push32(pNfapiMsg->time_since_last_timing_info, ppWritePackedMsg, end) && + push32(pNfapiMsg->dl_tti_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->tx_data_request_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->ul_tti_jitter, ppWritePackedMsg, end) && + push32(pNfapiMsg->ul_dci_jitter, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->dl_tti_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->tx_data_request_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_tti_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_dci_latest_delay, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->dl_tti_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->tx_data_request_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_tti_earliest_arrival, ppWritePackedMsg, end) && + pushs32(pNfapiMsg->ul_dci_earliest_arrival, ppWritePackedMsg, end) && + pack_p7_vendor_extension_tlv(pNfapiMsg->vendor_extension, ppWritePackedMsg, end, config)); +} + + + +// Main pack function - public + +int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config) +{ + nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; + uint8_t *pWritePackedMessage = pPackedBuf; + uint8_t *pPackedLengthField = &pWritePackedMessage[4]; + uint8_t *end = pPackedBuf + packedBufLen; + + if (pMessageBuf == NULL || pPackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); + return -1; + } + /* + printf("\n P7 MESSAGE SENT: \n"); + for(int i=0; i< packedBufLen; i++){ + printf("%d", *(uint8_t *)(pMessageBuf + i)); + } + printf("\n"); + */ + // process the header + if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) && + push16(pMessageHeader->message_id, &pWritePackedMessage, end) && + push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) && + push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) && + push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) && + push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end))) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n"); + return -1; + } + + if (pMessageHeader->message_id != NFAPI_TIMING_INFO) + { + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp); + } + // look for the specific message + uint8_t result = 0; + switch (pMessageHeader->message_id) + { + case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: + result = pack_dl_tti_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: + result = pack_ul_tti_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: + result = pack_tx_data_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: + result = pack_ul_dci_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UE_RELEASE_REQUEST: + result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UE_RELEASE_RESPONSE: + result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_HARQ_INDICATION: + result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_CRC_INDICATION: + result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_ULSCH_INDICATION: + //printf("RX ULSCH\n"); + result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RACH_INDICATION: + result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_SRS_INDICATION: + result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_SR_INDICATION: + result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_CQI_INDICATION: + result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_LBT_DL_INDICATION: + result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NB_HARQ_INDICATION: + result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NRACH_INDICATION: + result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: + result = pack_nr_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: + result = pack_nr_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_TIMING_INFO: + result = pack_nr_timing_info(pMessageHeader, &pWritePackedMessage, end, config); + break; + + default: + { + if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && + pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) + { + if(config && config->pack_p7_vendor_extension) + { + result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config); + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); + } + } + break; + } + + if(result == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n"); + return -1; + } + + // check for a valid message length + uintptr_t msgHead = (uintptr_t)pPackedBuf; + uintptr_t msgEnd = (uintptr_t)pWritePackedMessage; + uint32_t packedMsgLen = msgEnd - msgHead; + uint16_t packedMsgLen16; + if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen); + return -1; + } + else + { + packedMsgLen16 = (uint16_t)packedMsgLen; + } + + // Update the message length in the header + pMessageHeader->message_length = packedMsgLen16; + + if(!push16(packedMsgLen16, &pPackedLengthField, end)) + return -1; + + if(1) + { + //quick test + if(pMessageHeader->message_length != packedMsgLen) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id); + } + } + + return (packedMsgLen); +} + +int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config) +{ + nfapi_p7_message_header_t *pMessageHeader = pMessageBuf; + uint8_t *pWritePackedMessage = pPackedBuf; + uint8_t *pPackedLengthField = &pWritePackedMessage[4]; + uint8_t *end = pPackedBuf + packedBufLen; + + if (pMessageBuf == NULL || pPackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack supplied pointers are null\n"); + return -1; + } + /* + printf("\n P7 MESSAGE SENT: \n"); + for(int i=0; i< packedBufLen; i++){ + printf("%d", *(uint8_t *)(pMessageBuf + i)); + } + printf("\n"); + */ + // process the header + if(!(push16(pMessageHeader->phy_id, &pWritePackedMessage, end) && + push16(pMessageHeader->message_id, &pWritePackedMessage, end) && + push16(0/*pMessageHeader->message_length*/, &pWritePackedMessage, end) && + push16(pMessageHeader->m_segment_sequence, &pWritePackedMessage, end) && + push32(0/*pMessageHeader->checksum*/, &pWritePackedMessage, end) && + push32(pMessageHeader->transmit_timestamp, &pWritePackedMessage, end))) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack header failed\n"); + return -1; + } + + if (pMessageHeader->message_id != NFAPI_TIMING_INFO) + { + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() message_id:0x%04x phy_id:%u m_segment_sequence:%u timestamp:%u\n", __FUNCTION__, pMessageHeader->message_id, pMessageHeader->phy_id, pMessageHeader->m_segment_sequence, pMessageHeader->transmit_timestamp); + } + // look for the specific message + uint8_t result = 0; + switch (pMessageHeader->message_id) + { + case NFAPI_DL_CONFIG_REQUEST: + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_DL_CONFIG_REQUEST\n", __FUNCTION__); + result = pack_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UL_CONFIG_REQUEST: + result = pack_ul_config_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + case NFAPI_TX_REQUEST: + //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() NFAPI_TX_REQUEST\n", __FUNCTION__); + result = pack_tx_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + case NFAPI_HI_DCI0_REQUEST: + result = pack_hi_dci0_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UE_RELEASE_REQUEST: + result =pack_ue_release_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UE_RELEASE_RESPONSE: + result =pack_ue_release_response(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_HARQ_INDICATION: + result = pack_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_CRC_INDICATION: + result = pack_crc_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_ULSCH_INDICATION: + //printf("RX ULSCH\n"); + result = pack_rx_ulsch_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RACH_INDICATION: + result = pack_rach_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_SRS_INDICATION: + result = pack_srs_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_SR_INDICATION: + result = pack_sr_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_RX_CQI_INDICATION: + result = pack_cqi_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + result = pack_lbt_dl_config_request(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_LBT_DL_INDICATION: + result = pack_lbt_dl_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NB_HARQ_INDICATION: + result = pack_nb_harq_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_NRACH_INDICATION: + result = pack_nrach_indication(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_DL_NODE_SYNC: + result = pack_dl_node_sync(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_UL_NODE_SYNC: + result = pack_ul_node_sync(pMessageHeader, &pWritePackedMessage, end, config); + break; + + case NFAPI_TIMING_INFO: + result = pack_timing_info(pMessageHeader, &pWritePackedMessage, end, config); + break; + + default: + { + if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && + pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) + { + if(config && config->pack_p7_vendor_extension) + { + result = (config->pack_p7_vendor_extension)(pMessageHeader, &pWritePackedMessage, end, config); + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve ecoder provided\n", __FUNCTION__, pMessageHeader->message_id); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); + } + } + break; + } + + if(result == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 Pack failed to pack message\n"); + return -1; + } + + // check for a valid message length + uintptr_t msgHead = (uintptr_t)pPackedBuf; + uintptr_t msgEnd = (uintptr_t)pWritePackedMessage; + uint32_t packedMsgLen = msgEnd - msgHead; + uint16_t packedMsgLen16; + if (packedMsgLen > 0xFFFF || packedMsgLen > packedBufLen) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "Packed message length error %d, buffer supplied %d\n", packedMsgLen, packedBufLen); + return -1; + } + else + { + packedMsgLen16 = (uint16_t)packedMsgLen; + } + + // Update the message length in the header + pMessageHeader->message_length = packedMsgLen16; + + if(!push16(packedMsgLen16, &pPackedLengthField, end)) + return -1; + + if(1) + { + //quick test + if(pMessageHeader->message_length != packedMsgLen) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "nfapi packedMsgLen(%d) != message_length(%d) id %d\n", packedMsgLen, pMessageHeader->message_length, pMessageHeader->message_id); + } + } + + return (packedMsgLen); +} + +// Unpack routines +// NR: +static uint8_t unpack_dl_tti_csi_rs_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_csi_rs_pdu_rel15_t* value = (nfapi_nr_dl_tti_csi_rs_pdu_rel15_t*)tlv; + + return( + pull16(ppReadPackedMsg, &value->bwp_size, end) && + pull16(ppReadPackedMsg, &value->bwp_start, end) && + + pull8(ppReadPackedMsg, &value->subcarrier_spacing, end) && + pull8(ppReadPackedMsg, &value->cyclic_prefix, end) && + + pull16(ppReadPackedMsg, &value->start_rb, end) && + pull16(ppReadPackedMsg, &value->nr_of_rbs, end) && + + pull8(ppReadPackedMsg, &value->csi_type, end) && + pull8(ppReadPackedMsg, &value->row, end) && + + pull16(ppReadPackedMsg, &value->freq_domain, end) && + pull8(ppReadPackedMsg, &value->symb_l0, end) && + + pull8(ppReadPackedMsg, &value->symb_l1, end) && + pull8(ppReadPackedMsg, &value->cdm_type, end) && + + pull8(ppReadPackedMsg, &value->freq_density, end) && + pull16(ppReadPackedMsg, &value->scramb_id, end) && + + pull8(ppReadPackedMsg, &value->power_control_offset, end) && + pull8(ppReadPackedMsg, &value->power_control_offset_ss, end) + ); + +} + + +static uint8_t unpack_dl_tti_pdcch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_pdcch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t*)tlv; + + for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) + { + if(!(pull16(ppReadPackedMsg, &value->dci_pdu[i].RNTI, end) && + pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingId, end) && + + pull16(ppReadPackedMsg, &value->dci_pdu[i].ScramblingRNTI, end) && + pull8(ppReadPackedMsg, &value->dci_pdu[i].CceIndex, end) && + pull8(ppReadPackedMsg, &value->dci_pdu[i].AggregationLevel, end) && + pull8(ppReadPackedMsg, &value->dci_pdu[i].beta_PDCCH_1_0, end) && + + pull8(ppReadPackedMsg, &value->dci_pdu[i].powerControlOffsetSS, end) && + pull16(ppReadPackedMsg, &value->dci_pdu[i].PayloadSizeBits, end) && + + pullarray8(ppReadPackedMsg, value->dci_pdu[i].Payload, value->dci_pdu[i].PayloadSizeBits, value->dci_pdu[i].PayloadSizeBits, end))) + + return 0; + } + + // TODO: resolve the packaging of array (currently sending a single element) + return( + pull16(ppReadPackedMsg, &value->BWPSize, end) && + pull16(ppReadPackedMsg, &value->BWPStart, end) && + pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) && + pull8(ppReadPackedMsg, &value->CyclicPrefix, end) && + + pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) && + pull8(ppReadPackedMsg, &value->DurationSymbols, end) && + pullarray8(ppReadPackedMsg, value->FreqDomainResource, 6, 6, end) && + pull8(ppReadPackedMsg, &value->CceRegMappingType, end) && + + pull8(ppReadPackedMsg, &value->RegBundleSize, end) && + pull8(ppReadPackedMsg, &value->InterleaverSize, end) && + pull8(ppReadPackedMsg, &value->CoreSetType, end) && + pull16(ppReadPackedMsg, &value->ShiftIndex, end) && + + pull8(ppReadPackedMsg, &value->precoderGranularity, end) && + pull16(ppReadPackedMsg, &value->numDlDci, end)); + +} + + +static uint8_t unpack_dl_tti_pdsch_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_dl_tti_pdsch_pdu_rel15_t* value = (nfapi_nr_dl_tti_pdsch_pdu_rel15_t*)tlv; + + // TODO: resolve the packaging of array (currently sending a single element) + return( + pull16(ppReadPackedMsg, &value->pduBitmap, end) && + pull16(ppReadPackedMsg, &value->rnti, end) && + pull16(ppReadPackedMsg, &value->pduIndex, end) && + pull16(ppReadPackedMsg, &value->BWPSize, end) && + + pull16(ppReadPackedMsg, &value->BWPStart, end) && + pull8(ppReadPackedMsg, &value->SubcarrierSpacing, end) && + pull8(ppReadPackedMsg, &value->CyclicPrefix, end) && + pull8(ppReadPackedMsg, &value->NrOfCodewords, end) && + + pullarray16(ppReadPackedMsg, value->targetCodeRate, 2, 1, end) && + pullarray8(ppReadPackedMsg, value->qamModOrder, 2, 1, end) && + pullarray8(ppReadPackedMsg, value->mcsIndex, 2, 1, end) && + pullarray8(ppReadPackedMsg, value->mcsTable, 2, 1, end) && + + pullarray8(ppReadPackedMsg, value->rvIndex, 2, 1, end) && + pullarray32(ppReadPackedMsg, value->TBSize, 2, 1, end) && + pull16(ppReadPackedMsg, &value->dataScramblingId, end) && + pull8(ppReadPackedMsg, &value->nrOfLayers, end) && + + pull8(ppReadPackedMsg, &value->transmissionScheme, end) && + pull8(ppReadPackedMsg, &value->refPoint, end) && + pull16(ppReadPackedMsg, &value->dlDmrsSymbPos, end) && + pull8(ppReadPackedMsg, &value->dmrsConfigType, end) && + + pull16(ppReadPackedMsg, &value->dlDmrsScramblingId, end) && + pull8(ppReadPackedMsg, &value->SCID, end) && + pull8(ppReadPackedMsg, &value->numDmrsCdmGrpsNoData, end) && + pull16(ppReadPackedMsg, &value->dmrsPorts, end) && + + pull8(ppReadPackedMsg, &value->resourceAlloc, end) && + pull16(ppReadPackedMsg, &value->rbStart, end) && + pull16(ppReadPackedMsg, &value->rbSize, end) && + + pull8(ppReadPackedMsg, &value->VRBtoPRBMapping, end) && + pull8(ppReadPackedMsg, &value->StartSymbolIndex, end) && + pull8(ppReadPackedMsg, &value->NrOfSymbols, end) && + pull8(ppReadPackedMsg, &value->PTRSPortIndex, end) && + + pull8(ppReadPackedMsg, &value->PTRSTimeDensity, end) && + pull8(ppReadPackedMsg, &value->PTRSFreqDensity, end) && + pull8(ppReadPackedMsg, &value->PTRSReOffset, end) + ); + +} + + +static uint8_t unpack_dl_tti_ssb_pdu_rel15_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + printf("ssb received and unpacked. \n"); + nfapi_nr_dl_tti_ssb_pdu_rel15_t* value = (nfapi_nr_dl_tti_ssb_pdu_rel15_t*)tlv; + + return( + pull16(ppReadPackedMsg, &value->PhysCellId, end) && + pull8(ppReadPackedMsg, &value->BetaPss, end) && + pull8(ppReadPackedMsg, &value->SsbBlockIndex, end) && + pull8(ppReadPackedMsg, &value->SsbSubcarrierOffset, end) && + pull16(ppReadPackedMsg, &value->ssbOffsetPointA, end) && + pull8(ppReadPackedMsg, &value->bchPayloadFlag, end) && + pull32(ppReadPackedMsg, &value->bchPayload, end) + // TODO: pack precoding_and_beamforming too + ); + +} + + +// LTE: +static uint8_t unpack_dl_config_dci_dl_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel8_t* dci_dl_pdu_rel8 = (nfapi_dl_config_dci_dl_pdu_rel8_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->dci_format, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->cce_idx, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->aggregation_level, end) && + pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_allocation_type, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->virtual_resource_block_assignment_flag, end) && + pull32(ppReadPackedMsg, &dci_dl_pdu_rel8->resource_block_coding, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_1, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_1, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_1, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_to_codeword_swap_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->mcs_2, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->redundancy_version_2, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->new_data_indicator_2, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->harq_process, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpmi, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->pmi, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->precoding_information, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->tpc, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_assignment_index, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->ngap, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->transport_block_size_index, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->downlink_power_offset, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->allocate_prach_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->preamble_index, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->prach_mask_index, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel8->rnti_type, end) && + pull16(ppReadPackedMsg, &dci_dl_pdu_rel8->transmission_power, end)); + +} + +static uint8_t unpack_dl_config_dci_dl_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel9_t* dci_dl_pdu_rel9 = (nfapi_dl_config_dci_dl_pdu_rel9_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->mcch_change_notification, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel9->scrambling_identity, end)); +} + +static uint8_t unpack_dl_config_dci_dl_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel10_t* dci_dl_pdu_rel10 = (nfapi_dl_config_dci_dl_pdu_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->cross_carrier_scheduling_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->carrier_indicator, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->srs_request, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->antenna_ports_scrambling_and_layers, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->total_dci_length_including_padding, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel10->n_dl_rb, end)); +} + +static uint8_t unpack_dl_config_dci_dl_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel11_t* dci_dl_pdu_rel11 = (nfapi_dl_config_dci_dl_pdu_rel11_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->harq_ack_resource_offset, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel11->pdsch_re_mapping_quasi_co_location_indicator, end)); +} + +static uint8_t unpack_dl_config_dci_dl_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel12_t* dci_dl_pdu_rel12 = (nfapi_dl_config_dci_dl_pdu_rel12_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->primary_cell_type, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->ul_dl_configuration_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel12->number_ul_dl_configurations, end) && + pullarray8(ppReadPackedMsg, dci_dl_pdu_rel12->ul_dl_configuration_indication, NFAPI_MAX_UL_DL_CONFIGURATIONS, dci_dl_pdu_rel12->number_ul_dl_configurations, end)); +} + +static uint8_t unpack_tpm_value(uint8_t **ppReadPackedMsg, nfapi_dl_config_dci_dl_tpm_t *value, uint8_t *end) +{ + if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) && + pull8(ppReadPackedMsg, &value->number_of_subbands, end) && + pull8(ppReadPackedMsg, &value->num_antennas, end))) + return 0; + + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_subbands; ++idx) + { + nfapi_dl_config_dci_dl_tpm_subband_info_t* subband_info = &(value->subband_info[idx]); + + if(!(pull8(ppReadPackedMsg, &subband_info->subband_index, end) && + pull8(ppReadPackedMsg, &subband_info->scheduled_ues, end))) + return 0; + + uint8_t antenna_idx = 0; + uint8_t scheduled_ue_idx = 0; + + for(antenna_idx = 0; antenna_idx < value->num_antennas; ++antenna_idx) + { + for(scheduled_ue_idx = 0; scheduled_ue_idx < subband_info->scheduled_ues; ++scheduled_ue_idx) + { + if(!pull16(ppReadPackedMsg, &(subband_info->precoding_value[antenna_idx][scheduled_ue_idx]), end)) + return 0; + } + } + + } + + + return 1; + +} + + +static uint8_t unpack_dl_config_dci_dl_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dci_dl_pdu_rel13_t* dci_dl_pdu_rel13 = (nfapi_dl_config_dci_dl_pdu_rel13_t*)tlv; + + // If the length is greater than 5 then the TPM struct flag and possiably the TPM structure have been + // added + uint8_t tpm_struct_flag_present = dci_dl_pdu_rel13->tl.length > 5; + dci_dl_pdu_rel13->tpm_struct_flag = 0; + + return (pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_flag, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->laa_end_partial_sf_configuration, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->initial_lbt_sf, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->codebook_size_determination, end) && + pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->drms_table_flag, end) && + ( (tpm_struct_flag_present == 1) ? pull8(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm_struct_flag, end) : 1) && + ( (tpm_struct_flag_present == 1 && dci_dl_pdu_rel13->tpm_struct_flag == 1) ? unpack_tpm_value(ppReadPackedMsg, &dci_dl_pdu_rel13->tpm, end) : 1)); + +} + +static uint8_t unpack_dl_config_bch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_bch_pdu_rel8_t* bch_pdu_rel8 = (nfapi_dl_config_bch_pdu_rel8_t*)tlv; + + return ( pull16(ppReadPackedMsg, &bch_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&bch_pdu_rel8->pdu_index, end) && + pull16(ppReadPackedMsg, &bch_pdu_rel8->transmission_power, end)); +} + +static uint8_t unpack_dl_config_mch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_mch_pdu_rel8_t* mch_pdu_rel8 = (nfapi_dl_config_mch_pdu_rel8_t*)tlv; + + return (pull16(ppReadPackedMsg, &mch_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&mch_pdu_rel8->pdu_index, end) && + pull16(ppReadPackedMsg, &mch_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &mch_pdu_rel8->resource_allocation_type, end) && + pull32(ppReadPackedMsg, &mch_pdu_rel8->resource_block_coding, end) && + pull8(ppReadPackedMsg, &mch_pdu_rel8->modulation, end) && + pull16(ppReadPackedMsg, &mch_pdu_rel8->transmission_power, end) && + pull16(ppReadPackedMsg, &mch_pdu_rel8->mbsfn_area_id, end)); +} + +static uint8_t unpack_dl_config_dlsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel8_t* dlsch_pdu_rel8 = (nfapi_dl_config_dlsch_pdu_rel8_t*)tlv; + + if (!(pull16(ppReadPackedMsg, &dlsch_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&dlsch_pdu_rel8->pdu_index, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->resource_allocation_type, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->virtual_resource_block_assignment_flag, end) && + pull32(ppReadPackedMsg, &dlsch_pdu_rel8->resource_block_coding, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->modulation, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->redundancy_version, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_blocks, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transport_block_to_codeword_swap_flag, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_scheme, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_layers, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->number_of_subbands, end) && + pullarray8(ppReadPackedMsg, dlsch_pdu_rel8->codebook_index, NFAPI_MAX_NUM_SUBBANDS, dlsch_pdu_rel8->number_of_subbands, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ue_category_capacity, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->pa, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->delta_power_offset_index, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->ngap, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->nprb, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->transmission_mode, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_prb_per_subband, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->num_bf_vector, end))) + return 0; + + uint16_t j = 0; + for(j = 0; j < dlsch_pdu_rel8->num_bf_vector; ++j) + { + if(!(pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].subband_index, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel8->bf_vector[j].num_antennas, end) && + pullarray16(ppReadPackedMsg, dlsch_pdu_rel8->bf_vector[j].bf_value, NFAPI_MAX_NUM_ANTENNAS, dlsch_pdu_rel8->bf_vector[j].num_antennas, end))) + return 0; + } + return 1; +} +static uint8_t unpack_dl_config_dlsch_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel9_t* dlsch_pdu_rel9 = (nfapi_dl_config_dlsch_pdu_rel9_t*)tlv; + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel9->nscid, end) ); +} +static uint8_t unpack_dl_config_dlsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel10_t* dlsch_pdu_rel10 = (nfapi_dl_config_dlsch_pdu_rel10_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_flag, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_resource_config_r10, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) && + pullarray8(ppReadPackedMsg, dlsch_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, dlsch_pdu_rel10->csi_rs_number_nzp_configuration, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel10->pdsch_start, end)) ; +} +static uint8_t unpack_dl_config_dlsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel11_t* dlsch_pdu_rel11 = (nfapi_dl_config_dlsch_pdu_rel11_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel11->drms_config_flag, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel11->drms_scrambling, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel11->csi_config_flag, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel11->csi_scrambling, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_flag, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_atenna_ports, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel11->pdsch_re_mapping_freq_shift, end)); +} +static uint8_t unpack_dl_config_dlsch_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel12_t* dlsch_pdu_rel12 = (nfapi_dl_config_dlsch_pdu_rel12_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel12->altcqi_table_r12, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel12->maxlayers, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel12->n_dl_harq, end)); +} +static uint8_t unpack_dl_config_dlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_dlsch_pdu_rel13_t* dlsch_pdu_rel13 = (nfapi_dl_config_dlsch_pdu_rel13_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dlsch_pdu_rel13->dwpts_symbols, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel13->initial_lbt_sf, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel13->ue_type, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel13->pdsch_payload_type, end) && + pull16(ppReadPackedMsg, &dlsch_pdu_rel13->initial_transmission_sf_io, end) && + pull8(ppReadPackedMsg, &dlsch_pdu_rel13->drms_table_flag, end)); +} + +static uint8_t unpack_dl_config_pch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_pch_pdu_rel8_t* pch_pdu_rel8 = (nfapi_dl_config_pch_pdu_rel8_t*)tlv; + + return ( pull16(ppReadPackedMsg, &pch_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&pch_pdu_rel8->pdu_index, end) && + pull16(ppReadPackedMsg, &pch_pdu_rel8->p_rnti, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->resource_allocation_type, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->virtual_resource_block_assignment_flag, end) && + pull32(ppReadPackedMsg, &pch_pdu_rel8->resource_block_coding, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->mcs, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->redundancy_version, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_transport_blocks, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->transport_block_to_codeword_swap_flag, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->transmission_scheme, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->number_of_layers, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->codebook_index, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->ue_category_capacity, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->pa, end) && + pull16(ppReadPackedMsg, &pch_pdu_rel8->transmission_power, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->nprb, end) && + pull8(ppReadPackedMsg, &pch_pdu_rel8->ngap, end)); +} +static uint8_t unpack_dl_config_pch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_pch_pdu_rel13_t* pch_pdu_rel13 = (nfapi_dl_config_pch_pdu_rel13_t*)tlv; + + return ( pull8(ppReadPackedMsg, &pch_pdu_rel13->ue_mode, end) && + pull16(ppReadPackedMsg, &pch_pdu_rel13->initial_transmission_sf_io, end)); +} + +static uint8_t unpack_dl_config_prs_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_prs_pdu_rel9_t* prs_pdu_rel9 = (nfapi_dl_config_prs_pdu_rel9_t*)tlv; + + return ( pull16(ppReadPackedMsg, &prs_pdu_rel9->transmission_power, end) && + pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_bandwidth, end) && + pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_cyclic_prefix_type, end) && + pull8(ppReadPackedMsg, &prs_pdu_rel9->prs_muting, end)); +} + +static uint8_t unpack_dl_config_csi_rs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_csi_rs_pdu_rel10_t* csi_rs_pdu_rel10 = (nfapi_dl_config_csi_rs_pdu_rel10_t*)tlv; + + return ( pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_antenna_port_count_r10, end) && + pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_resource_config_r10, end) && + pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->transmission_power, end) && + pull16(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_zero_tx_power_resource_config_bitmap_r10, end) && + pull8(ppReadPackedMsg, &csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end) && + pullarray8(ppReadPackedMsg, csi_rs_pdu_rel10->csi_rs_resource_config, NFAPI_MAX_CSI_RS_RESOURCE_CONFIG, csi_rs_pdu_rel10->csi_rs_number_of_nzp_configuration, end)); +} + +static uint8_t unpack_dl_config_csi_rs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_csi_rs_pdu_rel13_t* csi_rs_pdu_rel13 = (nfapi_dl_config_csi_rs_pdu_rel13_t*)tlv; + + if (!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->csi_rs_class, end) && + pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->cdm_type, end) && + pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->num_bf_vector, end))) + return 0; + + + uint16_t idx =0; + for(idx = 0; idx < csi_rs_pdu_rel13->num_bf_vector; ++idx) + { + if(!(pull8(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].csi_rs_resource_index, end))) + return 0; + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : HOW TO DECODE BF VALUE \n"); + //pullarray16(ppReadPackedMsg, &csi_rs_pdu_rel13->bf_vector[idx].bf_vector, ??); + } + return 1; +} + +static uint8_t unpack_dl_config_epdcch_params_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_epdcch_parameters_rel11_t* epdcch_params_rel11 = (nfapi_dl_config_epdcch_parameters_rel11_t*)tlv; + + return (pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_resource_assignment_flag, end) && + pull16(ppReadPackedMsg, &epdcch_params_rel11->epdcch_id, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_start_symbol, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel11->epdcch_num_prb, end) && + pullarray8(ppReadPackedMsg, epdcch_params_rel11->epdcch_prb_index, NFAPI_MAX_EPDCCH_PRB, epdcch_params_rel11->epdcch_num_prb, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.subband_index, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel11->bf_vector.num_antennas, end) && + pullarray16(ppReadPackedMsg, epdcch_params_rel11->bf_vector.bf_value, NFAPI_MAX_NUM_ANTENNAS, epdcch_params_rel11->bf_vector.num_antennas, end)); +} + +static uint8_t unpack_dl_config_epdcch_params_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_epdcch_parameters_rel13_t* epdcch_params_rel13 = (nfapi_dl_config_epdcch_parameters_rel13_t*)tlv; + + return ( pull8(ppReadPackedMsg, &epdcch_params_rel13->dwpts_symbols, end) && + pull8(ppReadPackedMsg, &epdcch_params_rel13->initial_lbt_sf, end)); +} + +static uint8_t unpack_dl_config_mpdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_mpdcch_pdu_rel13_t* mpdcch_params_rel13 = (nfapi_dl_config_mpdcch_pdu_rel13_t*)tlv; + + + return ( pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_narrow_band, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_prb_pairs, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_assignment, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->mpdcch_tansmission_type, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->start_symbol, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->ecce_index, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->aggregation_level, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->rnti_type, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->rnti, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->ce_mode, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->drms_scrambling_init, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->initial_transmission_sf_io, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->transmission_power, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_format, end) && + pull16(ppReadPackedMsg, &mpdcch_params_rel13->resource_block_coding, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->mcs, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->pdsch_reptition_levels, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->redundancy_version, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->new_data_indicator, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_process, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi_length, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpmi, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->pmi, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->harq_resource_offset, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->dci_subframe_repetition_number, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->tpc, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index_length, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->downlink_assignment_index, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->allocate_prach_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->preamble_index, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->prach_mask_index, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->starting_ce_level, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->srs_request, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->antenna_ports_and_scrambling_identity, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->frequency_hopping_enabled_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->paging_direct_indication_differentiation_flag, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->direct_indication, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->total_dci_length_including_padding, end) && + pull8(ppReadPackedMsg, &mpdcch_params_rel13->number_of_tx_antenna_ports, end) && + pullarray16(ppReadPackedMsg, mpdcch_params_rel13->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, mpdcch_params_rel13->number_of_tx_antenna_ports, end)); +} + + +static uint8_t unpack_dl_config_nbch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_nbch_pdu_rel13_t* nbch_params_rel13 = (nfapi_dl_config_nbch_pdu_rel13_t*)tlv; + + return ( pull16(ppReadPackedMsg, &nbch_params_rel13->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&nbch_params_rel13->pdu_index, end) && + pull16(ppReadPackedMsg, &nbch_params_rel13->transmission_power, end) && + pull16(ppReadPackedMsg, &nbch_params_rel13->hyper_sfn_2_lsbs, end)); +} + +static uint8_t unpack_dl_config_npdcch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_npdcch_pdu_rel13_t* npdcch_params_rel13 = (nfapi_dl_config_npdcch_pdu_rel13_t*)tlv; + + return ( pull16(ppReadPackedMsg, &npdcch_params_rel13->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&npdcch_params_rel13->pdu_index, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->ncce_index, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->aggregation_level, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->start_symbol, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->rnti_type, end) && + pull16(ppReadPackedMsg, &npdcch_params_rel13->rnti, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->scrambling_reinitialization_batch_index, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_format, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->scheduling_delay, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->resource_assignment, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->repetition_number, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->mcs, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->new_data_indicator, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->harq_ack_resource, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->npdcch_order_indication, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->starting_number_of_nprach_repetitions, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->subcarrier_indication_of_nprach, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->paging_direct_indication_differentation_flag, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->direct_indication, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->dci_subframe_repetition_number, end) && + pull8(ppReadPackedMsg, &npdcch_params_rel13->total_dci_length_including_padding, end)); +} + +static uint8_t unpack_dl_config_ndlsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_dl_config_ndlsch_pdu_rel13_t* ndlsch_params_rel13 = (nfapi_dl_config_ndlsch_pdu_rel13_t*)tlv; + + return ( pull16(ppReadPackedMsg, &ndlsch_params_rel13->length, end) && + pull16(ppReadPackedMsg, (uint16_t *)&ndlsch_params_rel13->pdu_index, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->start_symbol, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->rnti_type, end) && + pull16(ppReadPackedMsg, &ndlsch_params_rel13->rnti, end) && + pull16(ppReadPackedMsg, &ndlsch_params_rel13->resource_assignment, end) && + pull16(ppReadPackedMsg, &ndlsch_params_rel13->repetition_number, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->modulation, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->number_of_subframes_for_resource_assignment, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->scrambling_sequence_initialization_cinit, end) && + pull16(ppReadPackedMsg, &ndlsch_params_rel13->sf_idx, end) && + pull8(ppReadPackedMsg, &ndlsch_params_rel13->nrs_antenna_ports_assumed_by_the_ue, end)); +} + + +static uint8_t unpack_dl_tti_request_body_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_dl_tti_request_pdu_t* value = (nfapi_nr_dl_tti_request_pdu_t*)msg; + + if(!(pull16(ppReadPackedMsg, &value->PDUSize, end) && + pull16(ppReadPackedMsg, &value->PDUType, end) )) + return 0; + + + // first match the pdu type, then call the respective function + switch(value->PDUType) + { + case NFAPI_NR_DL_TTI_CSI_RS_PDU_TYPE: + { + if(!(unpack_dl_tti_csi_rs_pdu_rel15_value(&value->csi_rs_pdu.csi_rs_pdu_rel15,ppReadPackedMsg,end))) + return 0; + } + break; + + case NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE: + { + if(!(unpack_dl_tti_pdcch_pdu_rel15_value(&value->pdcch_pdu.pdcch_pdu_rel15,ppReadPackedMsg,end))) + return 0; + } + break; + case NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE: + { + if(!(unpack_dl_tti_pdsch_pdu_rel15_value(&value->pdsch_pdu.pdsch_pdu_rel15,ppReadPackedMsg,end))) + return 0; + } + break; + case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: + { + if(!(unpack_dl_tti_ssb_pdu_rel15_value(&value->ssb_pdu.ssb_pdu_rel15,ppReadPackedMsg,end))) + return 0; + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid DL_TTI pdu type %d \n", value->PDUType ); + } + break; + } + + return 1; +} + + + + +static uint8_t unpack_dl_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_config_request_body_t* value = (nfapi_dl_config_request_body_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->number_pdcch_ofdm_symbols, end) && + pull8(ppReadPackedMsg, &value->number_dci, end) && + pull16(ppReadPackedMsg, &value->number_pdu, end) && + pull8(ppReadPackedMsg, &value->number_pdsch_rnti, end) && + pull16(ppReadPackedMsg, &value->transmission_power_pcfich, end))) + return 0; + + if(value->number_pdu > NFAPI_DL_CONFIG_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_pdu, NFAPI_DL_CONFIG_MAX_PDU); + return 0; + } + + if(value->number_pdu) + { + value->dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_dl_config_request_pdu_t) * value->number_pdu, config); + if(value->dl_config_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate dl config pdu list (count:%d)\n", __FUNCTION__, value->number_pdu); + return 0; + } + } + else + { + value->dl_config_pdu_list = 0; + } + + uint16_t i; + uint16_t total_number_of_pdus = value->number_pdu; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_dl_config_request_pdu_t* pdu = &(value->dl_config_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + { + // pdu end of beyond buffer end + return 0; + } + + switch(pdu->pdu_type) + { + case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value}, + { NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG, &pdu->dci_dl_pdu.dci_dl_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_BCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG, &pdu->bch_pdu.bch_pdu_rel8, &unpack_dl_config_bch_pdu_rel8_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_MCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG, &pdu->mch_pdu.mch_pdu_rel8, &unpack_dl_config_mch_pdu_rel8_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel8, &unpack_dl_config_dlsch_pdu_rel8_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel9, &unpack_dl_config_dlsch_pdu_rel9_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel10, &unpack_dl_config_dlsch_pdu_rel10_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel11, &unpack_dl_config_dlsch_pdu_rel11_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel12, &unpack_dl_config_dlsch_pdu_rel12_value}, + { NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG, &pdu->dlsch_pdu.dlsch_pdu_rel13, &unpack_dl_config_dlsch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_PCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG, &pdu->pch_pdu.pch_pdu_rel8, &unpack_dl_config_pch_pdu_rel8_value}, + { NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG, &pdu->pch_pdu.pch_pdu_rel13, &unpack_dl_config_pch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_PRS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG, &pdu->prs_pdu.prs_pdu_rel9, &unpack_dl_config_prs_pdu_rel9_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel10, &unpack_dl_config_csi_rs_pdu_rel10_value}, + { NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG, &pdu->csi_rs_pdu.csi_rs_pdu_rel13, &unpack_dl_config_csi_rs_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel8, &unpack_dl_config_dci_dl_pdu_rel8_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel9, &unpack_dl_config_dci_dl_pdu_rel9_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel10, &unpack_dl_config_dci_dl_pdu_rel10_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel11, &unpack_dl_config_dci_dl_pdu_rel11_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel12, &unpack_dl_config_dci_dl_pdu_rel12_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG, &pdu->epdcch_pdu.epdcch_pdu_rel13, &unpack_dl_config_dci_dl_pdu_rel13_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG, &pdu->epdcch_pdu.epdcch_params_rel11, &unpack_dl_config_epdcch_params_rel11_value}, + { NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG, &pdu->epdcch_pdu.epdcch_params_rel13, &unpack_dl_config_epdcch_params_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG, &pdu->mpdcch_pdu.mpdcch_pdu_rel13, &unpack_dl_config_mpdcch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG, &pdu->nbch_pdu.nbch_pdu_rel13, &unpack_dl_config_nbch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG, &pdu->npdcch_pdu.npdcch_pdu_rel13, &unpack_dl_config_npdcch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + + } + break; + case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG, &pdu->ndlsch_pdu.ndlsch_pdu_rel13, &unpack_dl_config_ndlsch_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + + } + break; + default: + // Need to log an error + break; + } + } + + return 1; +} + + +static uint8_t unpack_dl_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_dl_tti_request_t *pNfapiMsg = (nfapi_nr_dl_tti_request_t*)msg; + + if (!(pull16(ppReadPackedMsg,&pNfapiMsg->SFN, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nGroup, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->dl_tti_request_body.nPDUs, end) && + pullarray8(ppReadPackedMsg,pNfapiMsg->dl_tti_request_body.nUe ,256,pNfapiMsg->dl_tti_request_body.nGroup, end) + //pusharray8(pNfapiMsg->PduIdx[0] ,256,256, ppWritePackedMsg, end) + )) + return 0; + + int arr[12]; + for(int i=0;idl_tti_request_body.nGroup;i++) + { + for(int j=0;jdl_tti_request_body.nUe[i];j++) + { + arr[j] = pNfapiMsg->dl_tti_request_body.PduIdx[i][j]; + } + if(!(pullarrays32(ppReadPackedMsg,arr,12,pNfapiMsg->dl_tti_request_body.nUe[i], end))) + return 0; + } + + for(int i=0;idl_tti_request_body.nPDUs;i++) + { + if(!unpack_dl_tti_request_body_value(ppReadPackedMsg, end, &pNfapiMsg->dl_tti_request_body.dl_tti_pdu_list[i])) + return 0; + } + +return 1; +} + + +static uint8_t unpack_ul_tti_request_prach_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_prach_pdu_t* prach_pdu = (nfapi_nr_prach_pdu_t*)tlv; + + return( + pull16(ppReadPackedMsg, &prach_pdu->phys_cell_id, end) && + pull8(ppReadPackedMsg, &prach_pdu->num_prach_ocas, end) && + pull8(ppReadPackedMsg, &prach_pdu->prach_format, end) && + pull8(ppReadPackedMsg, &prach_pdu->num_ra, end) && + pull8(ppReadPackedMsg, &prach_pdu->prach_start_symbol, end) && + pull16(ppReadPackedMsg, &prach_pdu->num_cs, end) + // TODO: ignoring beamforming tlv for now + ); +} + + +static uint8_t unpack_ul_tti_request_pucch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_pucch_pdu_t* pucch_pdu = (nfapi_nr_pucch_pdu_t*)tlv; + + return( + pull16(ppReadPackedMsg, &pucch_pdu->rnti, end) && + pull32(ppReadPackedMsg, &pucch_pdu->handle, end) && + pull16(ppReadPackedMsg, &pucch_pdu->bwp_size, end) && + pull16(ppReadPackedMsg, &pucch_pdu->bwp_start, end) && + pull8(ppReadPackedMsg, &pucch_pdu->subcarrier_spacing, end) && + pull8(ppReadPackedMsg, &pucch_pdu->cyclic_prefix, end) && + pull8(ppReadPackedMsg, &pucch_pdu->format_type, end) && + pull8(ppReadPackedMsg, &pucch_pdu->multi_slot_tx_indicator, end) && + pull16(ppReadPackedMsg, &pucch_pdu->prb_start, end) && + pull16(ppReadPackedMsg, &pucch_pdu->prb_size, end) && + pull8(ppReadPackedMsg, &pucch_pdu->start_symbol_index, end) && + pull8(ppReadPackedMsg, &pucch_pdu->nr_of_symbols, end) && + pull8(ppReadPackedMsg, &pucch_pdu->freq_hop_flag, end) && + pull16(ppReadPackedMsg, &pucch_pdu->second_hop_prb, end) && + pull8(ppReadPackedMsg, &pucch_pdu->group_hop_flag, end) && + pull8(ppReadPackedMsg, &pucch_pdu->sequence_hop_flag, end) && + pull16(ppReadPackedMsg, &pucch_pdu->hopping_id, end) && + pull16(ppReadPackedMsg, &pucch_pdu->initial_cyclic_shift, end) && + pull16(ppReadPackedMsg, &pucch_pdu->data_scrambling_id, end) && + pull8(ppReadPackedMsg, &pucch_pdu->time_domain_occ_idx, end) && + pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_idx, end) && + pull8(ppReadPackedMsg, &pucch_pdu->pre_dft_occ_len, end) && + pull8(ppReadPackedMsg, &pucch_pdu->add_dmrs_flag, end) && + pull16(ppReadPackedMsg, &pucch_pdu->dmrs_scrambling_id, end) && + pull8(ppReadPackedMsg, &pucch_pdu->dmrs_cyclic_shift, end) && + pull8(ppReadPackedMsg, &pucch_pdu->sr_flag, end) && + pull8(ppReadPackedMsg, &pucch_pdu->bit_len_harq, end) && + pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part1, end) && + pull16(ppReadPackedMsg, &pucch_pdu->bit_len_csi_part2, end) + // TODO: ignoring beamforming tlv for now + ); +} + + +static uint8_t unpack_ul_tti_request_pusch_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_pusch_pdu_t* pusch_pdu = (nfapi_nr_pusch_pdu_t*)tlv; + + if (!( + pull16(ppReadPackedMsg, &pusch_pdu->pdu_bit_map, end) && + pull16(ppReadPackedMsg, &pusch_pdu->rnti, end) && + pull32(ppReadPackedMsg, &pusch_pdu->handle, end) && + pull16(ppReadPackedMsg, &pusch_pdu->bwp_size, end) && + pull16(ppReadPackedMsg, &pusch_pdu->bwp_start, end) && + pull8(ppReadPackedMsg, &pusch_pdu->subcarrier_spacing, end) && + pull8(ppReadPackedMsg, &pusch_pdu->cyclic_prefix, end) && + pull16(ppReadPackedMsg, &pusch_pdu->target_code_rate, end) && + pull8(ppReadPackedMsg, &pusch_pdu->qam_mod_order, end) && + pull8(ppReadPackedMsg, &pusch_pdu->mcs_index, end) && + pull8(ppReadPackedMsg, &pusch_pdu->mcs_table, end) && + pull8(ppReadPackedMsg, &pusch_pdu->transform_precoding, end) && + pull16(ppReadPackedMsg, &pusch_pdu->data_scrambling_id, end) && + pull8(ppReadPackedMsg, &pusch_pdu->nrOfLayers, end) && + pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_symb_pos, end) && + pull8(ppReadPackedMsg, &pusch_pdu->dmrs_config_type, end) && + pull16(ppReadPackedMsg, &pusch_pdu->ul_dmrs_scrambling_id, end) && + pull8(ppReadPackedMsg, &pusch_pdu->scid, end) && + pull8(ppReadPackedMsg, &pusch_pdu->num_dmrs_cdm_grps_no_data, end) && + pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) && + pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc, end) && + pull8(ppReadPackedMsg, &pusch_pdu->resource_alloc,end) && + pull16(ppReadPackedMsg, &pusch_pdu->dmrs_ports, end) && + pull16(ppReadPackedMsg, &pusch_pdu->rb_start, end) && + pull16(ppReadPackedMsg, &pusch_pdu->rb_size, end) && + pull8(ppReadPackedMsg, &pusch_pdu->vrb_to_prb_mapping, end) && + pull8(ppReadPackedMsg, &pusch_pdu->frequency_hopping, end) && + pull16(ppReadPackedMsg, &pusch_pdu->tx_direct_current_location, end) && + pull8(ppReadPackedMsg, &pusch_pdu->uplink_frequency_shift_7p5khz, end) && + pull8(ppReadPackedMsg, &pusch_pdu->start_symbol_index, end) && + pull8(ppReadPackedMsg, &pusch_pdu->nr_of_symbols, end) + // TODO: ignoring beamforming tlv for now + )) + return 0; + + + //Pack Optional Data only included if indicated in pduBitmap + switch(pusch_pdu->pdu_bit_map){ + case PUSCH_PDU_BITMAP_PUSCH_DATA: + { + // pack optional TLVs + return( + pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.rv_index, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_data.harq_process_id, end) && + pull32(ppReadPackedMsg, &pusch_pdu->pusch_data.tb_size, end) && + pull16(ppReadPackedMsg, &pusch_pdu->pusch_data.num_cb, end) && + pullarray8(ppReadPackedMsg, pusch_pdu->pusch_data.cb_present_and_position,1,1,end) + ); + } + break; + + case PUSCH_PDU_BITMAP_PUSCH_UCI: + { + return( + pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.harq_ack_bit_length, end) && + pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part1_bit_length, end) && + pull16(ppReadPackedMsg, &pusch_pdu->pusch_uci.csi_part2_bit_length, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.alpha_scaling, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_harq_ack, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi1, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_uci.beta_offset_csi2, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_PUSCH_PTRS: + { + return( + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.num_ptrs_ports, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_dmrs_port, end) && ++ pull16(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_port_index, end) && ++ pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_ports_list->ptrs_re_offset, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_time_density, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ptrs_freq_density, end) && + pull8(ppReadPackedMsg, &pusch_pdu->pusch_ptrs.ul_ptrs_power, end) + ); + } + break; + + case PUSCH_PDU_BITMAP_DFTS_OFDM: + { + return( + pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_group_number, end) && + pull16(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.low_papr_sequence_number, end) && + pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_sample_density, end) && + pull8(ppReadPackedMsg, &pusch_pdu->dfts_ofdm.ul_ptrs_time_density_transform_precoding, end) + ); + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "Invalid pdu bitmap %d \n", pusch_pdu->pdu_bit_map ); + } + } + + return 1; +} + + +static uint8_t unpack_ul_tti_request_srs_pdu(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nr_srs_pdu_t* srs_pdu = (nfapi_nr_srs_pdu_t*)tlv; + + return( + pull16(ppReadPackedMsg, &srs_pdu->rnti, end) && + pull32(ppReadPackedMsg, &srs_pdu->handle, end) && + pull16(ppReadPackedMsg, &srs_pdu->bwp_size, end) && + pull16(ppReadPackedMsg, &srs_pdu->bwp_start, end) && + pull8(ppReadPackedMsg, &srs_pdu->subcarrier_spacing, end) && + pull8(ppReadPackedMsg, &srs_pdu->cyclic_prefix, end) && + pull8(ppReadPackedMsg, &srs_pdu->num_ant_ports, end) && + pull8(ppReadPackedMsg, &srs_pdu->num_symbols, end) && + pull8(ppReadPackedMsg, &srs_pdu->num_repetitions, end) && + pull8(ppReadPackedMsg, &srs_pdu->time_start_position, end) && + pull8(ppReadPackedMsg, &srs_pdu->config_index, end) && + pull16(ppReadPackedMsg, &srs_pdu->sequence_id, end) && + pull8(ppReadPackedMsg, &srs_pdu->bandwidth_index, end) && + pull8(ppReadPackedMsg, &srs_pdu->comb_size, end) && + pull8(ppReadPackedMsg, &srs_pdu->comb_offset, end) && + pull8(ppReadPackedMsg, &srs_pdu->cyclic_shift, end) && + pull8(ppReadPackedMsg, &srs_pdu->frequency_position, end) && + pull8(ppReadPackedMsg, &srs_pdu->frequency_shift, end) && + pull8(ppReadPackedMsg, &srs_pdu->frequency_hopping, end) && + pull8(ppReadPackedMsg, &srs_pdu->group_or_sequence_hopping, end) && + pull8(ppReadPackedMsg, &srs_pdu->resource_type, end) && + pull16(ppReadPackedMsg, &srs_pdu->t_srs, end) && + pull16(ppReadPackedMsg, &srs_pdu->t_offset, end) + // TODO: ignoring beamforming tlv for now + ); +} + + +static uint8_t unpack_ul_tti_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_ul_tti_request_number_of_pdus_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_pdus_t*)msg; + + if(!(pull16(ppReadPackedMsg, &pNfapiMsg->pdu_size, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->pdu_type, end) )) + return 0; + + + // first natch the pdu type, then call the respective function + switch(pNfapiMsg->pdu_type) + { + + case NFAPI_NR_UL_CONFIG_PRACH_PDU_TYPE: + { + if(!unpack_ul_tti_request_prach_pdu(&pNfapiMsg->prach_pdu, ppReadPackedMsg, end)) + return 0; + } + break; + + case NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE: + { + if(!unpack_ul_tti_request_pucch_pdu(&pNfapiMsg->pucch_pdu, ppReadPackedMsg, end)) + return 0; + } + break; + + case NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE: + { + if(!unpack_ul_tti_request_pusch_pdu(&pNfapiMsg->pusch_pdu, ppReadPackedMsg, end)) + return 0; + } + break; + + case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE: + { + if(!unpack_ul_tti_request_srs_pdu(&pNfapiMsg->srs_pdu, ppReadPackedMsg, end)) + return 0; + } + break; + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid UL_TTI pdu type %d \n", pNfapiMsg->pdu_type ); + } + break; + + + } + + return 1; +} + + +static uint8_t unpack_ul_tti_groups_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_ul_tti_request_number_of_groups_t* pNfapiMsg = (nfapi_nr_ul_tti_request_number_of_groups_t*)msg; + + if(!pull8(ppReadPackedMsg, &pNfapiMsg->n_ue, end)) + return 0; + for (int i = 0; i < pNfapiMsg->n_ue; i++) + { + if(!pull8(ppReadPackedMsg, &pNfapiMsg->ue_list[i].pdu_idx ,end) ) + return 0; + } + return 1; +} + + +static uint8_t unpack_ul_tti_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_tti_request_t *pNfapiMsg = (nfapi_nr_ul_tti_request_t*)msg; + + if (!( + pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->n_pdus, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->n_group, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->rach_present, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->n_ulcch, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->n_ulsch, end) )) + return 0; + + for(int i=0; i< pNfapiMsg->n_pdus; i++) + { + if (!unpack_ul_tti_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdus_list[i])) + return 0; + } + + for(int i=0; i< pNfapiMsg->n_group; i++) + { + if (!unpack_ul_tti_groups_list_value(ppReadPackedMsg, end, &pNfapiMsg->groups_list[i])) + return 0; + } + + return 1; +} + + + +static uint8_t unpack_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_config_request_t *pNfapiMsg = (nfapi_dl_config_request_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->dl_config_request_body, &unpack_dl_config_request_body_value}, + }; + + return ( pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_ul_config_ulsch_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + + + + nfapi_ul_config_ulsch_pdu_rel8_t* ulsch_pdu_rel8 = (nfapi_ul_config_ulsch_pdu_rel8_t*)tlv; + + return (pull32(ppReadPackedMsg, &ulsch_pdu_rel8->handle, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel8->size, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->resource_block_start, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->number_of_resource_blocks, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->modulation_type, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->cyclic_shift_2_for_drms, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_enabled_flag, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->frequency_hopping_bits, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->new_data_indication, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->redundancy_version, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->harq_process_number, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->ul_tx_mode, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->current_tx_nb, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel8->n_srs, end )); +} + +static uint8_t unpack_ul_config_ulsch_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel10_t* ulsch_pdu_rel10 = (nfapi_ul_config_ulsch_pdu_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &ulsch_pdu_rel10->resource_allocation_type, end) && + pull32(ppReadPackedMsg, &ulsch_pdu_rel10->resource_block_coding, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transport_blocks, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->transmission_scheme, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->number_of_layers, end) & + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->codebook_index, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel10->disable_sequence_hopping_flag, end)); +} +static uint8_t unpack_ul_config_ulsch_pdu_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel11_t* ulsch_pdu_rel11 = (nfapi_ul_config_ulsch_pdu_rel11_t*)tlv; + + return ( pull8(ppReadPackedMsg, &ulsch_pdu_rel11->virtual_cell_id_enabled_flag, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel11->npusch_identity, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel11->dmrs_config_flag, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel11->ndmrs_csh_identity, end)); +} +static uint8_t unpack_ul_config_ulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_pdu_rel13_t* ulsch_pdu_rel13 = (nfapi_ul_config_ulsch_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &ulsch_pdu_rel13->ue_type, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel13->total_number_of_repetitions, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel13->repetition_number, end) && + pull16(ppReadPackedMsg, &ulsch_pdu_rel13->initial_transmission_sf_io, end) && + pull8(ppReadPackedMsg, &ulsch_pdu_rel13->empty_symbols_due_to_re_tunning, end)); +} +static uint8_t unpack_ul_config_cqi_ri_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel8_t* cqi_ri_info_rel8 = (nfapi_ul_config_cqi_ri_information_rel8_t*)tlv; + + return (pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_1, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel8->dl_cqi_pmi_size_rank_greater_1, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel8->ri_size, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_cqi, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel8->delta_offset_ri, end)); +} + +static uint8_t unpack_ul_config_cqi_ri_info_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel9_t* cqi_ri_info_rel9 = (nfapi_ul_config_cqi_ri_information_rel9_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->report_type, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_cqi, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel9->delta_offset_ri, end))) + return 0; + + switch(cqi_ri_info_rel9->report_type) + { + case NFAPI_CSI_REPORT_TYPE_PERIODIC: + { + if(!(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size, end) && + pull8(ppReadPackedMsg, &cqi_ri_info_rel9->periodic_cqi_pmi_ri_report.control_type, end))) + return 0; + } + break; + case NFAPI_CSI_REPORT_TYPE_APERIODIC: + { + if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc, end) ==0) + return 0; + + uint8_t i; + for(i = 0; i < cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.number_of_cc; ++i) + { + if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].ri_size, end) == 0) + return 0; + + uint8_t j; + for(j = 0; j < 8; ++j) + { + if(pull8(ppReadPackedMsg, &cqi_ri_info_rel9->aperiodic_cqi_pmi_ri_report.cc[i].dl_cqi_pmi_size[j], end) == 0) + return 0; + } + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid report type %d \n", cqi_ri_info_rel9->report_type ); + return 0; + } + break; + }; + return 1; +} + +// NOTE : This function is a little unconventional as we uese the side to +// determine the report type +static uint8_t unpack_ul_config_cqi_ri_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_ri_information_rel13_t* cqi_ri_info_rel13 = (nfapi_ul_config_cqi_ri_information_rel13_t*)tlv; + if(cqi_ri_info_rel13->tl.length == 0) + { + cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_APERIODIC; + } + else + { + cqi_ri_info_rel13->report_type = NFAPI_CSI_REPORT_TYPE_PERIODIC; + if(pull16(ppReadPackedMsg, &cqi_ri_info_rel13->periodic_cqi_pmi_ri_report.dl_cqi_pmi_ri_size_2, end) == 0) + return 0; + } + return 1; +} +static uint8_t unpack_ul_config_cqi_init_tx_params_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_initial_transmission_parameters_rel8_t* init_tx_params_rel8 = (nfapi_ul_config_initial_transmission_parameters_rel8_t*)tlv; + + return (pull8(ppReadPackedMsg, &init_tx_params_rel8->n_srs_initial, end) && + pull8(ppReadPackedMsg, &init_tx_params_rel8->initial_number_of_resource_blocks, end)); +} +static uint8_t unpack_ul_config_ulsch_harq_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_harq_information_rel10_t* harq_info_rel10 = (nfapi_ul_config_ulsch_harq_information_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &harq_info_rel10->harq_size, end) && + pull8(ppReadPackedMsg, &harq_info_rel10->delta_offset_harq, end) && + pull8(ppReadPackedMsg, &harq_info_rel10->ack_nack_mode, end)); +} + +static uint8_t unpack_ul_config_ulsch_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ulsch_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_ulsch_harq_information_rel13_t*)tlv; + + return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->delta_offset_harq_2, end)); +} + +static uint8_t unpack_ul_config_ue_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel8_t* ue_info_rel8 = (nfapi_ul_config_ue_information_rel8_t*)tlv; + + return (pull32(ppReadPackedMsg, &ue_info_rel8->handle, end) && + pull16(ppReadPackedMsg, (uint16_t *)&ue_info_rel8->rnti, end)); +} +static uint8_t unpack_ul_config_ue_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel11_t* ue_info_rel11 = (nfapi_ul_config_ue_information_rel11_t*)tlv; + + return (pull8(ppReadPackedMsg, &ue_info_rel11->virtual_cell_id_enabled_flag, end) && + pull16(ppReadPackedMsg, &ue_info_rel11->npusch_identity, end)); +} +static uint8_t unpack_ul_config_ue_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_ue_information_rel13_t* ue_info_rel13 = (nfapi_ul_config_ue_information_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &ue_info_rel13->ue_type, end) && + pull8(ppReadPackedMsg, &ue_info_rel13->empty_symbols, end) && + pull16(ppReadPackedMsg, &ue_info_rel13->total_number_of_repetitions, end) && + pull16(ppReadPackedMsg, &ue_info_rel13->repetition_number, end)); +} + +static uint8_t unpack_ul_config_cqi_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel8_t* cqi_info_rel8 = (nfapi_ul_config_cqi_information_rel8_t*)tlv; + + return ( pull16(ppReadPackedMsg, &cqi_info_rel8->pucch_index, end) && + pull8(ppReadPackedMsg, &cqi_info_rel8->dl_cqi_pmi_size, end)); +} +static uint8_t unpack_ul_config_cqi_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel10_t* cqi_info_rel10 = (nfapi_ul_config_cqi_information_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &cqi_info_rel10->number_of_pucch_resource, end) && + pull16(ppReadPackedMsg, &cqi_info_rel10->pucch_index_p1, end)); +} +static uint8_t unpack_ul_config_cqi_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_cqi_information_rel13_t* cqi_info_rel13 = (nfapi_ul_config_cqi_information_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &cqi_info_rel13->csi_mode, end) && + pull16(ppReadPackedMsg, &cqi_info_rel13->dl_cqi_pmi_size_2, end) && + pull8(ppReadPackedMsg, &cqi_info_rel13->starting_prb, end) && + pull8(ppReadPackedMsg, &cqi_info_rel13->n_prb, end) && + pull8(ppReadPackedMsg, &cqi_info_rel13->cdm_index, end) && + pull8(ppReadPackedMsg, &cqi_info_rel13->n_srs, end)); +} + +static uint8_t unpack_ul_config_sr_info_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_sr_information_rel8_t* sr_info_rel8 = (nfapi_ul_config_sr_information_rel8_t*)tlv; + + return ( pull16(ppReadPackedMsg, &sr_info_rel8->pucch_index, end)); +} + +static uint8_t unpack_ul_config_sr_info_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_sr_information_rel10_t* sr_info_rel10 = (nfapi_ul_config_sr_information_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &sr_info_rel10->number_of_pucch_resources, end) && + pull16(ppReadPackedMsg, &sr_info_rel10->pucch_index_p1, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel10_tdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel10_tdd_t* harq_info_tdd_rel10 = (nfapi_ul_config_harq_information_rel10_tdd_t*)tlv; + + return (pull8(ppReadPackedMsg, &harq_info_tdd_rel10->harq_size, end) && + pull8(ppReadPackedMsg, &harq_info_tdd_rel10->ack_nack_mode, end) && + pull8(ppReadPackedMsg, &harq_info_tdd_rel10->number_of_pucch_resources, end) && + pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_0, end) && + pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_1, end) && + pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_2, end) && + pull16(ppReadPackedMsg, &harq_info_tdd_rel10->n_pucch_1_3, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel8_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel8_fdd_t* harq_info_fdd_rel8 = (nfapi_ul_config_harq_information_rel8_fdd_t*)tlv; + + return (pull16(ppReadPackedMsg, &harq_info_fdd_rel8->n_pucch_1_0, end) && + pull8(ppReadPackedMsg, &harq_info_fdd_rel8->harq_size, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel9_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel9_fdd_t* harq_info_fdd_rel9 = (nfapi_ul_config_harq_information_rel9_fdd_t*)tlv; + + return (pull8(ppReadPackedMsg, &harq_info_fdd_rel9->harq_size, end) && + pull8(ppReadPackedMsg, &harq_info_fdd_rel9->ack_nack_mode, end) && + pull8(ppReadPackedMsg, &harq_info_fdd_rel9->number_of_pucch_resources, end) && + pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_0, end) && + pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_1, end) && + pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_2, end) && + pull16(ppReadPackedMsg, &harq_info_fdd_rel9->n_pucch_1_3, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel11_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel11_t* harq_info_rel11 = (nfapi_ul_config_harq_information_rel11_t*)tlv; + + return (pull8(ppReadPackedMsg, &harq_info_rel11->num_ant_ports, end) && + pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_0, end) && + pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_1, end) && + pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_2, end) && + pull16(ppReadPackedMsg, &harq_info_rel11->n_pucch_2_3, end)); +} + +static uint8_t unpack_ul_config_harq_info_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_harq_information_rel13_t* harq_info_rel13 = (nfapi_ul_config_harq_information_rel13_t*)tlv; + + return (pull16(ppReadPackedMsg, &harq_info_rel13->harq_size_2, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->starting_prb, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->n_prb, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->cdm_index, end) && + pull8(ppReadPackedMsg, &harq_info_rel13->n_srs, end)); +} + + +static uint8_t unpack_ul_config_srs_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel8_t* srs_pdu_rel8 = (nfapi_ul_config_srs_pdu_rel8_t*)tlv; + + return (pull32(ppReadPackedMsg, &srs_pdu_rel8->handle, end) && + pull16(ppReadPackedMsg, &srs_pdu_rel8->size, end) && + pull16(ppReadPackedMsg, &srs_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_bandwidth, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->frequency_domain_position, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->srs_hopping_bandwidth, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->transmission_comb, end) && + pull16(ppReadPackedMsg, &srs_pdu_rel8->i_srs, end) && + pull8(ppReadPackedMsg, &srs_pdu_rel8->sounding_reference_cyclic_shift, end)); +} + +static uint8_t unpack_ul_config_srs_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel10_t* srs_pdu_rel10 = (nfapi_ul_config_srs_pdu_rel10_t*)tlv; + return pull8(ppReadPackedMsg, &srs_pdu_rel10->antenna_port, end); +} + +static uint8_t unpack_ul_config_srs_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_srs_pdu_rel13_t* srs_pdu_rel13 = (nfapi_ul_config_srs_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &srs_pdu_rel13->number_of_combs, end)); +} + +static uint8_t unpack_ul_nb_harq_info_rel13_fdd_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_nb_harq_information_rel13_fdd_t* nb_harq_info_fdd_rel13 = (nfapi_ul_config_nb_harq_information_rel13_fdd_t*)tlv; + + return (pull8(ppReadPackedMsg, &nb_harq_info_fdd_rel13->harq_ack_resource, end)); +} + +static uint8_t unpack_ul_config_nulsch_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_nulsch_pdu_rel13_t* nulsch_pdu_rel13 = (nfapi_ul_config_nulsch_pdu_rel13_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &nulsch_pdu_rel13->nulsch_format, end) && + pull32(ppReadPackedMsg, &nulsch_pdu_rel13->handle, end) && + pull16(ppReadPackedMsg, &nulsch_pdu_rel13->size, end) && + pull16(ppReadPackedMsg, &nulsch_pdu_rel13->rnti, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->subcarrier_indication, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->resource_assignment, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->mcs, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->redudancy_version, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->repetition_number, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->new_data_indication, end) && + pull8(ppReadPackedMsg, &nulsch_pdu_rel13->n_srs, end) && + pull16(ppReadPackedMsg, &nulsch_pdu_rel13->scrambling_sequence_initialization_cinit, end) && + pull16(ppReadPackedMsg, &nulsch_pdu_rel13->sf_idx, end))) + return 0; + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &nulsch_pdu_rel13->ue_information.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value}, + { NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG, &nulsch_pdu_rel13->nb_harq_information.nb_harq_information_rel13_fdd, &unpack_ul_nb_harq_info_rel13_fdd_value}, + }; + + return unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, 0, 0); +} + +static uint8_t unpack_ul_config_nrach_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_config_nrach_pdu_rel13_t* nrach_pdu_rel13 = (nfapi_ul_config_nrach_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_0, end) && + pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_1, end) && + pull8(ppReadPackedMsg, &nrach_pdu_rel13->nprach_config_2, end)); +} + + +static uint8_t unpack_ul_config_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + #define UL_CONFIG_ULSCH_PDU_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG, &_pdu.ulsch_pdu_rel8, &unpack_ul_config_ulsch_pdu_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG, &_pdu.ulsch_pdu_rel10, &unpack_ul_config_ulsch_pdu_rel10_value}, \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG, &_pdu.ulsch_pdu_rel11, &unpack_ul_config_ulsch_pdu_rel11_value}, \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG, &_pdu.ulsch_pdu_rel13, &unpack_ul_config_ulsch_pdu_rel13_value}, + + #define UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG, &_pdu.cqi_ri_information_rel8, &unpack_ul_config_cqi_ri_info_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG, &_pdu.cqi_ri_information_rel9, &unpack_ul_config_cqi_ri_info_rel9_value}, \ + { NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG, &_pdu.cqi_ri_information_rel13, &unpack_ul_config_cqi_ri_info_rel13_value}, + + #define UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG, &_pdu.harq_information_rel10, &unpack_ul_config_ulsch_harq_info_rel10_value},\ + { NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_ulsch_harq_info_rel13_value}, + + #define UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG, &_pdu.initial_transmission_parameters_rel8, &unpack_ul_config_cqi_init_tx_params_rel8_value}, + + #define UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG, &_pdu.ue_information_rel8, &unpack_ul_config_ue_info_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG, &_pdu.ue_information_rel11, &unpack_ul_config_ue_info_rel11_value}, \ + { NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG, &_pdu.ue_information_rel13, &unpack_ul_config_ue_info_rel13_value}, + + #define UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG, &_pdu.cqi_information_rel8, &unpack_ul_config_cqi_info_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG, &_pdu.cqi_information_rel10, &unpack_ul_config_cqi_info_rel10_value}, \ + { NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG, &_pdu.cqi_information_rel13, &unpack_ul_config_cqi_info_rel13_value}, + + #define UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG, &_pdu.sr_information_rel8, &unpack_ul_config_sr_info_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG, &_pdu.sr_information_rel10, &unpack_ul_config_sr_info_rel10_value}, + + #define UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG, &_pdu.harq_information_rel10_tdd, &unpack_ul_config_harq_info_rel10_tdd_value}, \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG, &_pdu.harq_information_rel8_fdd, &unpack_ul_config_harq_info_rel8_fdd_value}, \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG, &_pdu.harq_information_rel9_fdd, &unpack_ul_config_harq_info_rel9_fdd_value}, \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG, &_pdu.harq_information_rel11, &unpack_ul_config_harq_info_rel11_value}, \ + { NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG, &_pdu.harq_information_rel13, &unpack_ul_config_harq_info_rel13_value}, + + #define UL_CONFIG_SRS_PDU_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG, &_pdu.srs_pdu_rel8, &unpack_ul_config_srs_pdu_rel8_value}, \ + { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG, &_pdu.srs_pdu_rel10, &unpack_ul_config_srs_pdu_rel10_value}, \ + { NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG, &_pdu.srs_pdu_rel13, &unpack_ul_config_srs_pdu_rel13_value}, + + #define UL_CONFIG_NULSCH_PDU_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG, &_pdu.nulsch_pdu_rel13, &unpack_ul_config_nulsch_pdu_rel13_value}, + + #define UL_CONFIG_NRACH_PDU_UNPACK_FNS(_pdu) \ + { NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG, &_pdu.nrach_pdu_rel13, &unpack_ul_config_nrach_pdu_rel13_value}, + + + nfapi_ul_config_request_body_t* value = (nfapi_ul_config_request_body_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->number_of_pdus, end) && + pull8(ppReadPackedMsg, &value->rach_prach_frequency_resources, end) && + pull8(ppReadPackedMsg, &value->srs_present, end))) + return 0; + + if(value->number_of_pdus > NFAPI_UL_CONFIG_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of ul config pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_UL_CONFIG_MAX_PDU); + return 0; + } + + if(value->number_of_pdus > 0) + { + value->ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_ul_config_request_pdu_t) * value->number_of_pdus, config); + + if(value->ul_config_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate ul config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); + return 0; + } + } + else + { + value->ul_config_pdu_list = 0; + } + + + uint16_t i; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_ul_config_request_pdu_t* pdu = &(value->ul_config_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + { + // pdu end is past buffer end + return 0; + } + + switch(pdu->pdu_type) + { + case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_pdu) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + + case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.ulsch_pdu) + UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.cqi_ri_information) + UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_ri_pdu.initial_transmission_parameters) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_harq_pdu.ulsch_pdu) + UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_harq_pdu.harq_information) + UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_harq_pdu.initial_transmission_parameters) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.ulsch_pdu) + UL_CONFIG_CQI_RI_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.cqi_ri_information) + UL_CONFIG_ULSCH_HARQ_INFO_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.harq_information) + UL_CONFIG_INIT_TX_PARAMS_UNPACK_FNS(pdu->ulsch_cqi_harq_ri_pdu.initial_transmission_parameters) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.ue_information) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_pdu.cqi_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_pdu.ue_information) + UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_pdu.sr_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_harq_pdu.ue_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.ue_information) + UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.sr_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_sr_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.ue_information) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.cqi_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.ue_information) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.cqi_information) + UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_pdu.sr_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.ue_information) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.cqi_information) + UL_CONFIG_UCI_SR_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.sr_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->uci_cqi_sr_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_SRS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_SRS_PDU_UNPACK_FNS(pdu->srs_pdu) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_UCI_UE_INFO_UNPACK_FNS(pdu->harq_buffer_pdu.ue_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.ulsch_pdu) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_uci_csi_pdu.csi_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.ulsch_pdu) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_uci_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_ULSCH_PDU_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.ulsch_pdu) + UL_CONFIG_UCI_CQI_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.csi_information) + UL_CONFIG_UCI_HARQ_INFO_UNPACK_FNS(pdu->ulsch_csi_uci_harq_pdu.harq_information) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_NULSCH_PDU_UNPACK_FNS(pdu->nulsch_pdu) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + UL_CONFIG_NRACH_PDU_UNPACK_FNS(pdu->nrach_pdu) + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + } + } + return 1; +} + + +static uint8_t unpack_ul_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_ul_config_request_t *pNfapiMsg = (nfapi_ul_config_request_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_UL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->ul_config_request_body, &unpack_ul_config_request_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_hi_dci0_hi_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_hi_pdu_rel8_t* hi_pdu_rel8 = (nfapi_hi_dci0_hi_pdu_rel8_t*)tlv; + + return( pull8(ppReadPackedMsg, &hi_pdu_rel8->resource_block_start, end) && + pull8(ppReadPackedMsg, &hi_pdu_rel8->cyclic_shift_2_for_drms, end) && + pull8(ppReadPackedMsg, &hi_pdu_rel8->hi_value, end) && + pull8(ppReadPackedMsg, &hi_pdu_rel8->i_phich, end) && + pull16(ppReadPackedMsg, &hi_pdu_rel8->transmission_power, end)); +} + +static uint8_t unpack_hi_dci0_hi_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_hi_pdu_rel10_t* hi_pdu_rel10 = (nfapi_hi_dci0_hi_pdu_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &hi_pdu_rel10->flag_tb2, end) && + pull8(ppReadPackedMsg, &hi_pdu_rel10->hi_value_2, end)); +} + +static uint8_t unpack_hi_dci0_dci_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel8_t* dci_pdu_rel8 = (nfapi_hi_dci0_dci_pdu_rel8_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_pdu_rel8->dci_format, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->cce_index, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->aggregation_level, end) && + pull16(ppReadPackedMsg, &dci_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->resource_block_start, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->number_of_resource_block, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->mcs_1, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->cyclic_shift_2_for_drms, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_enabled_flag, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->frequency_hopping_bits, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->new_data_indication_1, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->ue_tx_antenna_seleciton, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->tpc, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->cqi_csi_request, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->ul_index, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel8->dl_assignment_index, end) && + pull32(ppReadPackedMsg, &dci_pdu_rel8->tpc_bitmap, end) && + pull16(ppReadPackedMsg, &dci_pdu_rel8->transmission_power, end)); +} + +static uint8_t unpack_hi_dci0_dci_pdu_rel10_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel10_t* dci_pdu_rel10 = (nfapi_hi_dci0_dci_pdu_rel10_t*)tlv; + + return (pull8(ppReadPackedMsg, &dci_pdu_rel10->cross_carrier_scheduling_flag, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->carrier_indicator, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->size_of_cqi_csi_feild, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_flag, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->srs_request, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_flag, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->resource_allocation_type, end) && + pull32(ppReadPackedMsg, &dci_pdu_rel10->resource_block_coding, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->mcs_2, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->new_data_indication_2, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->number_of_antenna_ports, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->tpmi, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->total_dci_length_including_padding, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel10->n_ul_rb, end)); +} + +static uint8_t unpack_hi_dci0_dci_pdu_rel12_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_dci_pdu_rel12_t* dci_pdu_rel12 = (nfapi_hi_dci0_dci_pdu_rel12_t*)tlv; + + return ( pull8(ppReadPackedMsg, &dci_pdu_rel12->pscch_resource, end) && + pull8(ppReadPackedMsg, &dci_pdu_rel12->time_resource_pattern, end)); +} + +static uint8_t unpack_hi_dci0_mpdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->mpdcch_narrowband, end) && + pull8(ppReadPackedMsg, &value->number_of_prb_pairs, end) && + pull8(ppReadPackedMsg, &value->resource_block_assignment, end) && + pull8(ppReadPackedMsg, &value->mpdcch_transmission_type, end) && + pull8(ppReadPackedMsg, &value->start_symbol, end) && + pull8(ppReadPackedMsg, &value->ecce_index, end) && + pull8(ppReadPackedMsg, &value->aggreagation_level, end) && + pull8(ppReadPackedMsg, &value->rnti_type, end) && + pull16(ppReadPackedMsg, &value->rnti, end) && + pull8(ppReadPackedMsg, &value->ce_mode, end) && + pull16(ppReadPackedMsg, &value->drms_scrambling_init, end) && + pull16(ppReadPackedMsg, &value->initial_transmission_sf_io, end) && + pull16(ppReadPackedMsg, &value->transmission_power, end) && + pull8(ppReadPackedMsg, &value->dci_format, end) && + pull8(ppReadPackedMsg, &value->resource_block_start, end) && + pull8(ppReadPackedMsg, &value->number_of_resource_blocks, end) && + pull8(ppReadPackedMsg, &value->mcs, end) && + pull8(ppReadPackedMsg, &value->pusch_repetition_levels, end) && + pull8(ppReadPackedMsg, &value->frequency_hopping_flag, end) && + pull8(ppReadPackedMsg, &value->new_data_indication, end) && + pull8(ppReadPackedMsg, &value->harq_process, end) && + pull8(ppReadPackedMsg, &value->redudency_version, end) && + pull8(ppReadPackedMsg, &value->tpc, end) && + pull8(ppReadPackedMsg, &value->csi_request, end) && + pull8(ppReadPackedMsg, &value->ul_inex, end) && + pull8(ppReadPackedMsg, &value->dai_presence_flag, end) && + pull8(ppReadPackedMsg, &value->dl_assignment_index, end) && + pull8(ppReadPackedMsg, &value->srs_request, end) && + pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end) && + pull32(ppReadPackedMsg, &value->tcp_bitmap, end) && + pull8(ppReadPackedMsg, &value->total_dci_length_include_padding, end) && + pull8(ppReadPackedMsg, &value->number_of_tx_antenna_ports, end) && + pullarray16(ppReadPackedMsg, value->precoding_value, NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS, value->number_of_tx_antenna_ports, end)); +} + +static uint8_t unpack_hi_dci0_npdcch_dci_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_hi_dci0_npdcch_dci_pdu_rel13_t* value = (nfapi_hi_dci0_npdcch_dci_pdu_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->ncce_index, end) && + pull8(ppReadPackedMsg, &value->aggregation_level, end) && + pull8(ppReadPackedMsg, &value->start_symbol, end) && + pull16(ppReadPackedMsg, &value->rnti, end) && + pull8(ppReadPackedMsg, &value->scrambling_reinitialization_batch_index, end) && + pull8(ppReadPackedMsg, &value->nrs_antenna_ports_assumed_by_the_ue, end) && + pull8(ppReadPackedMsg, &value->subcarrier_indication, end) && + pull8(ppReadPackedMsg, &value->resource_assignment, end) && + pull8(ppReadPackedMsg, &value->scheduling_delay, end) && + pull8(ppReadPackedMsg, &value->mcs, end) && + pull8(ppReadPackedMsg, &value->redudancy_version, end) && + pull8(ppReadPackedMsg, &value->repetition_number, end) && + pull8(ppReadPackedMsg, &value->new_data_indicator, end) && + pull8(ppReadPackedMsg, &value->dci_subframe_repetition_number, end)); +} + +static uint8_t unpack_hi_dci0_request_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_hi_dci0_request_body_t* value = (nfapi_hi_dci0_request_body_t*)tlv; + + if(!(pull16(ppReadPackedMsg, &value->sfnsf, end) && + pull8(ppReadPackedMsg, &value->number_of_dci, end) && + pull8(ppReadPackedMsg, &value->number_of_hi, end))) + return 0; + + uint8_t totalNumPdus = value->number_of_hi + value->number_of_dci; + + if(totalNumPdus > NFAPI_HI_DCI0_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of dci0 pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, totalNumPdus, NFAPI_HI_DCI0_MAX_PDU); + return 0; + } + + if(totalNumPdus > 0) + { + value->hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_hi_dci0_request_pdu_t) * totalNumPdus, config); + if(value->hi_dci0_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate hi dci0 pdu list (count:%d)\n", __FUNCTION__, totalNumPdus); + return 0; + } + } + else + { + value->hi_dci0_pdu_list = 0; + } + + uint8_t i; + for(i = 0; i < totalNumPdus; ++i) + { + nfapi_hi_dci0_request_pdu_t* pdu = &(value->hi_dci0_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + { + // pdu end if past buffer end + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s pdu size to big %d %d\n", __FUNCTION__, packedPduEnd, end); + return 0; + } + + switch(pdu->pdu_type) + { + case NFAPI_HI_DCI0_HI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG, &pdu->hi_pdu.hi_pdu_rel8, &unpack_hi_dci0_hi_pdu_rel8_value}, + { NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG, &pdu->hi_pdu.hi_pdu_rel10, &unpack_hi_dci0_hi_pdu_rel10_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_HI_DCI0_DCI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG, &pdu->dci_pdu.dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value}, + { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG, &pdu->dci_pdu.dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value}, + { NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG, &pdu->dci_pdu.dci_pdu_rel12, &unpack_hi_dci0_dci_pdu_rel12_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel8, &unpack_hi_dci0_dci_pdu_rel8_value}, + { NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG, &pdu->epdcch_dci_pdu.epdcch_dci_pdu_rel10, &unpack_hi_dci0_dci_pdu_rel10_value}, + { NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG, &pdu->epdcch_dci_pdu.epdcch_parameters_rel11, &unpack_dl_config_epdcch_params_rel11_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG, &pdu->mpdcch_dci_pdu.mpdcch_dci_pdu_rel13, &unpack_hi_dci0_mpdcch_dci_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG, &pdu->npdcch_dci_pdu.npdcch_dci_pdu_rel13, &unpack_hi_dci0_npdcch_dci_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid pdu type %d \n", pdu->pdu_type ); + } + break; + }; + } + + return 1; +} +//unpack_ul_dci_pdu_list_value + +static uint8_t unpack_ul_dci_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_ul_dci_request_pdus_t* value = (nfapi_nr_ul_dci_request_pdus_t*)msg; + for(uint8_t i = 0; i < MAX_DCI_CORESET; ++i) + { + if(!(pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].RNTI, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingId, end) && + + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].ScramblingRNTI, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].CceIndex, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].AggregationLevel, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].beta_PDCCH_1_0, end) && + + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].powerControlOffsetSS, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end) && + + pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].Payload, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, value->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[i].PayloadSizeBits, end))) + + return 0; + } + + return (pull16(ppReadPackedMsg, &value->PDUType, end) && + pull16(ppReadPackedMsg, &value->PDUSize, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPSize, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.BWPStart, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.SubcarrierSpacing, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CyclicPrefix, end) && + + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.StartSymbolIndex, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.DurationSymbols, end) && + pullarray8(ppReadPackedMsg, value->pdcch_pdu.pdcch_pdu_rel15.FreqDomainResource, 6, 6, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CceRegMappingType, end) && + + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.RegBundleSize, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.InterleaverSize, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.CoreSetType, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.ShiftIndex, end) && + pull8(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.precoderGranularity, end) && + pull16(ppReadPackedMsg, &value->pdcch_pdu.pdcch_pdu_rel15.numDlDci, end)); + +} + +static uint8_t unpack_ul_dci_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ +nfapi_nr_ul_dci_request_t *pNfapiMsg = (nfapi_nr_ul_dci_request_t*)msg; + + if (!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && + pull8(ppReadPackedMsg, &pNfapiMsg->numPdus, end) + )) + return 0; + for(int i=0; i< pNfapiMsg->numPdus; i++) + { + if (!unpack_ul_dci_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->ul_dci_pdu_list[i])) + return 0; + } + + return 1; + +} + +static uint8_t unpack_hi_dci0_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_hi_dci0_request_t *pNfapiMsg = (nfapi_hi_dci0_request_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_HI_DCI0_REQUEST_BODY_TAG, &pNfapiMsg->hi_dci0_request_body, &unpack_hi_dci0_request_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); + +} +static uint8_t unpack_tx_data_pdu_list_value(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg) +{ + nfapi_nr_pdu_t* pNfapiMsg = (nfapi_nr_pdu_t*)msg; + + if(!(pull32(ppReadPackedMsg, &pNfapiMsg->num_TLV, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->PDU_index, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->PDU_length, end) + )) + return 0; + + uint16_t i = 0; + uint16_t total_number_of_tlvs = pNfapiMsg->num_TLV; + for(; i < total_number_of_tlvs; ++i) + { + + if (!(pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].length, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->TLVs[i].tag, end))) + return 0; + + switch(pNfapiMsg->TLVs[i].tag){ + case 0: + { + if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.direct, 16384, pNfapiMsg->TLVs[i].length, end)) + return 0; + break; + + } + + case 1: + { + if(!pullarray32(ppReadPackedMsg, pNfapiMsg->TLVs[i].value.ptr, pNfapiMsg->TLVs[i].length , pNfapiMsg->TLVs[i].length, end)) + return 0; + break; + + } + + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : Invalid tag value %d \n", pNfapiMsg->TLVs[i].tag ); + break; + } + + } + } + + + return 1; +} + +static uint8_t unpack_tx_data_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_tx_data_request_t *pNfapiMsg = (nfapi_nr_tx_data_request_t*)msg; + + if(!(pull16(ppReadPackedMsg, &pNfapiMsg->SFN, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Slot, end) && + pull16(ppReadPackedMsg, &pNfapiMsg->Number_of_PDUs, end))) + return 0; + + for(int i=0; i< pNfapiMsg->Number_of_PDUs; i++) + { + if (!unpack_tx_data_pdu_list_value(ppReadPackedMsg, end, &pNfapiMsg->pdu_list[i])) + return 0; + } + + return 1; +} + +static uint8_t unpack_tx_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + uint8_t proceed = 1; + nfapi_tx_request_t *pNfapiMsg = (nfapi_tx_request_t*)msg; + + if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0) + return 0; + + while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed) + { + nfapi_tl_t generic_tl; + if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + return 0; + + switch(generic_tl.tag) + { + case NFAPI_TX_REQUEST_BODY_TAG: + { + pNfapiMsg->tx_request_body.tl = generic_tl; + + if( pull16(ppReadPackedMsg, &pNfapiMsg->tx_request_body.number_of_pdus, end) == 0) + return 0; + + if(pNfapiMsg->tx_request_body.number_of_pdus > NFAPI_TX_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of tx pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus, NFAPI_TX_MAX_PDU); + return 0; + } + + if(pNfapiMsg->tx_request_body.number_of_pdus > 0) + { + pNfapiMsg->tx_request_body.tx_pdu_list = (nfapi_tx_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_tx_request_pdu_t) * pNfapiMsg->tx_request_body.number_of_pdus, config); + if(pNfapiMsg->tx_request_body.tx_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate tx pdu list (count:%d)\n", __FUNCTION__, pNfapiMsg->tx_request_body.number_of_pdus); + return 0; + } + } + else + { + pNfapiMsg->tx_request_body.tx_pdu_list = 0; + } + + + uint16_t i; + uint16_t totalNumPdus = pNfapiMsg->tx_request_body.number_of_pdus; + for(i = 0; i < totalNumPdus; ++i) + { + nfapi_tx_request_pdu_t* pdu = &(pNfapiMsg->tx_request_body.tx_pdu_list[i]); + if (pdu) { + uint16_t length = 0; + uint16_t index = 0; + + if(!(pull16(ppReadPackedMsg, &length, end) && + pull16(ppReadPackedMsg, &index, end))) + return 0; + + pdu->pdu_length = length; + pdu->pdu_index = index; + + + // TODO : May need to rethink this bit + pdu->num_segments = 1; + pdu->segments[0].segment_length = pdu->pdu_length; + pdu->segments[0].segment_data = nfapi_p7_allocate(pdu->pdu_length, config); + + if(pdu->segments[0].segment_data) + { + if(!pullarray8(ppReadPackedMsg, pdu->segments[0].segment_data, pdu->segments[0].segment_length, pdu->segments[0].segment_length, end)) + return 0; + if (pdu->segments[0].segment_length == 3) + { + NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() BCH? segment_data:%x %x %x\n", __FUNCTION__, + pdu->segments[0].segment_data[0], + pdu->segments[0].segment_data[1], + pdu->segments[0].segment_data[2] + ); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request: Failed to allocate pdu (len:%d) %d/%d %d\n", pdu->pdu_length, totalNumPdus, i, pdu->pdu_index); + } + } else { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "NULL pdu\n"); + } + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_tx_request FIXME : Invalid pdu type %d \n", generic_tl.tag ); + } + break; + }; + } + + return 1; +} + +static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + uint8_t proceed = 1; + nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t*)msg; + + if(pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) == 0) + return 0; + + while (((uint8_t*)(*ppReadPackedMsg) < end) && proceed) + { + nfapi_tl_t generic_tl; + if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + return 0; + + switch(generic_tl.tag) + { + case NFAPI_UE_RELEASE_BODY_TAG: + { + pNfapiMsg->ue_release_request_body.tl = generic_tl; + if( pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.number_of_TLVs, end) == 0) + return 0; + + if(pNfapiMsg->ue_release_request_body.number_of_TLVs > NFAPI_RELEASE_MAX_RNTI) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of relese rnti's exceed maxium (count:%d max:%d)\n", __FUNCTION__, pNfapiMsg->ue_release_request_body.number_of_TLVs, NFAPI_RELEASE_MAX_RNTI); + return 0; + } else { + uint8_t j; + uint16_t num = pNfapiMsg->ue_release_request_body.number_of_TLVs; + for(j = 0; j < num; ++j){ + if(pull16(ppReadPackedMsg, &pNfapiMsg->ue_release_request_body.ue_release_request_TLVs_list[j].rnti, end) == 0){ + return 0; + } + } + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "unpack_ue_release_request FIXME : Invalid type %d \n", generic_tl.tag ); + } + break; + }; + } + + return 1; +} + +static uint8_t unpack_harq_indication_tdd_harq_data_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_harq_data_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_bundling_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->value_0, end) && + pull8(ppReadPackedMsg, &value->value_1, end)); +} + +static uint8_t unpack_harq_indication_tdd_harq_data_multiplexing(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_harq_data_multiplexing_t* value = (nfapi_harq_indication_tdd_harq_data_multiplexing_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->value_0, end) && + pull8(ppReadPackedMsg, &value->value_1, end) && + pull8(ppReadPackedMsg, &value->value_2, end) && + pull8(ppReadPackedMsg, &value->value_3, end)); +} +static uint8_t unpack_harq_indication_tdd_harq_data_special_bundling(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_harq_data_special_bundling_t* value = (nfapi_harq_indication_tdd_harq_data_special_bundling_t*)tlv; + return ( pull8(ppReadPackedMsg, &value->value_0, end)); +} +static uint8_t unpack_harq_indication_tdd_harq_data(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_harq_data_t* value = (nfapi_harq_indication_tdd_harq_data_t*)tlv; + return (pull8(ppReadPackedMsg, &value->value_0, end)); +} + +static uint8_t unpack_harq_indication_tdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel8_t* value = (nfapi_harq_indication_tdd_rel8_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->mode, end) && + pull8(ppReadPackedMsg, &value->number_of_ack_nack, end))) + return 0; + + uint8_t result = 0; + switch(value->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = unpack_harq_indication_tdd_harq_data_bundling(&value->harq_data.bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = unpack_harq_indication_tdd_harq_data_multiplexing(&value->harq_data.multiplex, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data.special_bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = 1; + break; + default: + // TODO add error message + return 0; + break; + } + return result; +} + +static uint8_t unpack_harq_indication_tdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel9_t* value = (nfapi_harq_indication_tdd_rel9_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->mode, end) && + pull8(ppReadPackedMsg, &value->number_of_ack_nack, end))) + return 0; + + if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD) + { + // TODO : add error message + return 0; + } + + uint16_t idx = 0; + for(idx = 0; idx < value->number_of_ack_nack; ++idx) + { + uint8_t result = 0; + switch(value->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end); + break; + default: + // TODO add error message + return 0; + break; + } + + if(result == 0) + return 0; + } + return 1; +} + +static uint8_t unpack_harq_indication_tdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_tdd_rel13_t* value = (nfapi_harq_indication_tdd_rel13_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->mode, end) && + pull16(ppReadPackedMsg, &value->number_of_ack_nack, end))) + return 0; + + if(value->number_of_ack_nack > NFAPI_MAX_NUMBER_ACK_NACK_TDD) + { + // TODO : add error message + return 0; + } + + uint16_t idx = 0; + for(idx = 0; idx < value->number_of_ack_nack; ++idx) + { + uint8_t result = 0; + switch(value->mode) + { + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].multiplex, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING: + result = unpack_harq_indication_tdd_harq_data_special_bundling(&value->harq_data[idx].special_bundling, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].channel_selection, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_3, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_4, ppReadPackedMsg, end); + break; + case NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5: + result = unpack_harq_indication_tdd_harq_data(&value->harq_data[idx].format_5, ppReadPackedMsg, end); + break; + default: + // TODO add error message + return 0; + break; + } + + if(result == 0) + return 0; + } + return 1; +} + +static uint8_t unpack_harq_indication_fdd_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel8_t* value = (nfapi_harq_indication_fdd_rel8_t*)tlv; + return (pull8(ppReadPackedMsg, &value->harq_tb1, end) && + pull8(ppReadPackedMsg, &value->harq_tb2, end)); +} + +static uint8_t unpack_harq_indication_fdd_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel9_t* value = (nfapi_harq_indication_fdd_rel9_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->mode, end) && + pull8(ppReadPackedMsg, &value->number_of_ack_nack, end) && + pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL9_MAX, value->number_of_ack_nack, end)); +} + +static uint8_t unpack_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_harq_indication_fdd_rel13_t* value = (nfapi_harq_indication_fdd_rel13_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->mode, end) && + pull16(ppReadPackedMsg, &value->number_of_ack_nack, end) && + pullarray8(ppReadPackedMsg, value->harq_tb_n, NFAPI_HARQ_ACK_NACK_REL13_MAX, value->number_of_ack_nack, end)); +} + +static uint8_t unpack_ul_cqi_information_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_ul_cqi_information_t* value = (nfapi_ul_cqi_information_t*)tlv; + + return (pull8(ppReadPackedMsg, &value->ul_cqi, end) && + pull8(ppReadPackedMsg, &value->channel, end)); +} + + + +static uint8_t unpack_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_harq_indication_body_t* value = (nfapi_harq_indication_body_t*)tlv; + uint8_t* harqBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(harqBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0) + return 0; + + if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU); + return 0; + } + + value->harq_pdu_list = (nfapi_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_harq_indication_pdu_t) * value->number_of_harqs, config); + if(value->harq_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs); + return 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_harqs; ++i) + { + nfapi_harq_indication_pdu_t* pdu = &(value->harq_pdu_list[i]); + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_HARQ_INDICATION_TDD_REL8_TAG, &pdu->harq_indication_tdd_rel8, &unpack_harq_indication_tdd_rel8_value}, + { NFAPI_HARQ_INDICATION_TDD_REL9_TAG, &pdu->harq_indication_tdd_rel9, &unpack_harq_indication_tdd_rel9_value}, + { NFAPI_HARQ_INDICATION_TDD_REL13_TAG, &pdu->harq_indication_tdd_rel13, &unpack_harq_indication_tdd_rel13_value}, + { NFAPI_HARQ_INDICATION_FDD_REL8_TAG, &pdu->harq_indication_fdd_rel8, &unpack_harq_indication_fdd_rel8_value}, + { NFAPI_HARQ_INDICATION_FDD_REL9_TAG, &pdu->harq_indication_fdd_rel9, &unpack_harq_indication_fdd_rel9_value}, + { NFAPI_HARQ_INDICATION_FDD_REL13_TAG, &pdu->harq_indication_fdd_rel13, &unpack_harq_indication_fdd_rel13_value}, + { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value} + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0) + return 0; + + } + + return 1; +} + +static uint8_t unpack_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_harq_indication_t *pNfapiMsg = (nfapi_harq_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->harq_indication_body, &unpack_harq_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_crc_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_crc_indication_rel8_t* crc_pdu_rel8 = (nfapi_crc_indication_rel8_t*)tlv; + return ( pull8(ppReadPackedMsg, &crc_pdu_rel8->crc_flag, end) ); +} + +static uint8_t unpack_crc_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_crc_indication_body_t* value = (nfapi_crc_indication_body_t*)tlv; + uint8_t* crcBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(crcBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_crcs, end) == 0) + return 0; + + if(value->number_of_crcs > NFAPI_CRC_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of crc ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_crcs, NFAPI_CRC_IND_MAX_PDU); + return 0; + } + + if(value->number_of_crcs > 0) + { + value->crc_pdu_list = (nfapi_crc_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_crc_indication_pdu_t) * value->number_of_crcs, config); + if(value->crc_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate crc ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_crcs); + return 0; + } + } + else + { + value->crc_pdu_list = 0; + } + + + uint8_t i = 0; + for(i = 0; i < value->number_of_crcs; ++i) + { + nfapi_crc_indication_pdu_t* pdu = &(value->crc_pdu_list[i]); + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* crcPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_CRC_INDICATION_REL8_TAG, &pdu->crc_indication_rel8, unpack_crc_indication_rel8_value }, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, crcPduInstanceEnd, 0, 0) == 0) + return 0; + } + + return 1; +} + +static uint8_t unpack_crc_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_crc_indication_t *pNfapiMsg = (nfapi_crc_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_CRC_INDICATION_BODY_TAG, &pNfapiMsg->crc_indication_body, &unpack_crc_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_rx_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_rx_indication_rel8_t* value = (nfapi_rx_indication_rel8_t*)tlv; + + return (pull16(ppReadPackedMsg, &value->length, end) && + pull16(ppReadPackedMsg, &value->offset, end) && + pull8(ppReadPackedMsg, &value->ul_cqi, end) && + pull16(ppReadPackedMsg, &value->timing_advance, end)); +} +static uint8_t unpack_rx_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_rx_indication_rel9_t* value = (nfapi_rx_indication_rel9_t*)tlv; + return (pull16(ppReadPackedMsg, &value->timing_advance_r9, end)); +} + +static uint8_t unpack_rx_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_rx_indication_body_t* value = (nfapi_rx_indication_body_t*)tlv; + + // the rxBodyEnd points to the end of the cqi PDU's + uint8_t* rxBodyEnd = *ppReadPackedMsg + value->tl.length; + uint8_t* rxPduEnd = rxBodyEnd; + + uint8_t* numberOfPdusAddress = *ppReadPackedMsg; + + if(rxBodyEnd > end) + { + // pdu end is past buffer end + return 0; + } + + if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) + return 0; + + if(value->number_of_pdus > NFAPI_RX_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of rx ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_RX_IND_MAX_PDU); + return 0; + } + + if(value->number_of_pdus > 0) + { + value->rx_pdu_list = (nfapi_rx_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_rx_indication_pdu_t) * value->number_of_pdus, config); + if(value->rx_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate rx ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); + return 0; + } + } + else + { + value->rx_pdu_list = 0; + } + + uint8_t i = 0; + nfapi_rx_indication_pdu_t* pdu = 0; + while((uint8_t*)(*ppReadPackedMsg) < rxBodyEnd && (uint8_t*)(*ppReadPackedMsg) < rxPduEnd) + { + nfapi_tl_t generic_tl; + if( unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + return 0; + + switch(generic_tl.tag) + { + case NFAPI_RX_UE_INFORMATION_TAG: + { + pdu = &(value->rx_pdu_list[i++]); + pdu->rx_ue_information.tl = generic_tl; + if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) + return 0; + } + break; + case NFAPI_RX_INDICATION_REL8_TAG: + { + if(pdu != 0) + { + pdu->rx_indication_rel8.tl = generic_tl; + if(unpack_rx_indication_rel8_value(&pdu->rx_indication_rel8, ppReadPackedMsg, end) == 0) + return 0; + + if(pdu->rx_indication_rel8.offset > 0) + { + // Need to check that the data is within the tlv + if(numberOfPdusAddress + pdu->rx_indication_rel8.offset + pdu->rx_indication_rel8.length <= rxBodyEnd) + { + // If this the first pdu set the rxPduEnd + if(numberOfPdusAddress + pdu->rx_indication_rel8.offset < rxPduEnd) + { + rxPduEnd = numberOfPdusAddress + pdu->rx_indication_rel8.offset; + + if(rxPduEnd > end) + { + // pdu end is past buffer end + return 0; + } + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME: the rx data is outside of the tlv\n"); + } + } + } + } + break; + case NFAPI_RX_INDICATION_REL9_TAG: + { + if(pdu != 0) + { + pdu->rx_indication_rel9.tl = generic_tl; + if(unpack_rx_indication_rel9_value(&pdu->rx_indication_rel9, ppReadPackedMsg, end) == 0) + return 0; + } + } + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_ULSCH.indication Invalid pdu type %d \n", generic_tl.tag ); + } + break; + } + } + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_pdus; ++idx) + { + if(value->rx_pdu_list[idx].rx_indication_rel8.tl.tag == NFAPI_RX_INDICATION_REL8_TAG) + { + uint32_t length = value->rx_pdu_list[idx].rx_indication_rel8.length; + value->rx_pdu_list[idx].data = nfapi_p7_allocate(length, config); + if(pullarray8(ppReadPackedMsg, value->rx_pdu_list[idx].data, length, length, end) == 0) + { + return 0; + } + } + } + + return 1; +} + +static uint8_t unpack_rx_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_rx_indication_t *pNfapiMsg = (nfapi_rx_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_RX_INDICATION_BODY_TAG, &pNfapiMsg->rx_indication_body, &unpack_rx_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_preamble_pdu_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel8_t* preamble_pdu_rel8 = (nfapi_preamble_pdu_rel8_t*)tlv; + + return (pull16(ppReadPackedMsg, &preamble_pdu_rel8->rnti, end) && + pull8(ppReadPackedMsg, &preamble_pdu_rel8->preamble, end) && + pull16(ppReadPackedMsg, &preamble_pdu_rel8->timing_advance, end)); +} + +static uint8_t unpack_preamble_pdu_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel9_t* preamble_pdu_rel9 = (nfapi_preamble_pdu_rel9_t*)tlv; + return pull16(ppReadPackedMsg, &preamble_pdu_rel9->timing_advance_r9, end); +} + +static uint8_t unpack_preamble_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_preamble_pdu_rel13_t* preamble_pdu_rel13 = (nfapi_preamble_pdu_rel13_t*)tlv; + return pull8(ppReadPackedMsg, &preamble_pdu_rel13->rach_resource_type, end); +} + +static uint8_t unpack_rach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_rach_indication_body_t* value = (nfapi_rach_indication_body_t*)tlv; + uint8_t* rachBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(rachBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_preambles, end) == 0) + return 0; + + if(value->number_of_preambles > NFAPI_PREAMBLE_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of preamble du's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_preambles, NFAPI_PREAMBLE_MAX_PDU); + return 0; + } + + if(value->number_of_preambles > 0) + { + value->preamble_list = (nfapi_preamble_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_preamble_pdu_t) * value->number_of_preambles, config); + if(value->preamble_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate preamble pdu list (count:%d)\n", __FUNCTION__, value->number_of_preambles); + return 0; + } + } + else + { + value->preamble_list = 0; + } + + + uint8_t i = 0; + for(i = 0; i < value->number_of_preambles; ++i) + { + nfapi_preamble_pdu_t* pdu = &(value->preamble_list[i]); + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* preamblePduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_PREAMBLE_REL8_TAG, &pdu->preamble_rel8, unpack_preamble_pdu_rel8_value }, + { NFAPI_PREAMBLE_REL9_TAG, &pdu->preamble_rel9, unpack_preamble_pdu_rel9_value }, + { NFAPI_PREAMBLE_REL13_TAG, &pdu->preamble_rel13, unpack_preamble_pdu_rel13_value }, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, preamblePduInstanceEnd, 0, 0) == 0) + return 0; + } + return 1; +} + +static uint8_t unpack_rach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_rach_indication_t *pNfapiMsg = (nfapi_rach_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_RACH_INDICATION_BODY_TAG, &pNfapiMsg->rach_indication_body, &unpack_rach_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_srs_indication_fdd_rel8_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel8_t* srs_pdu_fdd_rel8 = (nfapi_srs_indication_fdd_rel8_t*)tlv; + + if(!(pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->doppler_estimation, end) && + pull16(ppReadPackedMsg, &srs_pdu_fdd_rel8->timing_advance, end) && + pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->number_of_resource_blocks, end) && + pull8(ppReadPackedMsg, &srs_pdu_fdd_rel8->rb_start, end) && + pullarray8(ppReadPackedMsg, srs_pdu_fdd_rel8->snr, NFAPI_NUM_RB_MAX, srs_pdu_fdd_rel8->number_of_resource_blocks, end))) + return 0; + return 1; +} + +static uint8_t unpack_srs_indication_fdd_rel9_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel9_t* srs_pdu_fdd_rel9 = (nfapi_srs_indication_fdd_rel9_t*)tlv; + return (pull16(ppReadPackedMsg, &srs_pdu_fdd_rel9->timing_advance_r9, end)); +} + +static uint8_t unpack_srs_indication_tdd_rel10_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_srs_indication_ttd_rel10_t* srs_pdu_tdd_rel10 = (nfapi_srs_indication_ttd_rel10_t*)tlv; + return (pull8(ppReadPackedMsg, &srs_pdu_tdd_rel10->uppts_symbol, end)); +} + +static uint8_t unpack_srs_indication_fdd_rel11_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_srs_indication_fdd_rel11_t* srs_pdu_fdd_rel11 = (nfapi_srs_indication_fdd_rel11_t*)tlv; + return ( pull16(ppReadPackedMsg, &srs_pdu_fdd_rel11->ul_rtoa, end)); +} + +static uint8_t unpack_tdd_channel_measurement_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_tdd_channel_measurement_t* value = (nfapi_tdd_channel_measurement_t*)tlv; + + if(!(pull8(ppReadPackedMsg, &value->num_prb_per_subband, end) && + pull8(ppReadPackedMsg, &value->number_of_subbands, end) && + pull8(ppReadPackedMsg, &value->num_atennas, end))) + return 0; + + if(value->number_of_subbands > NFAPI_MAX_NUM_SUBBANDS) + { + // todo : add error + return 0; + } + + if(value->num_atennas > NFAPI_MAX_NUM_PHYSICAL_ANTENNAS) + { + // todo : add error + return 0; + } + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_subbands; ++idx) + { + if(!(pull8(ppReadPackedMsg, &value->subands[idx].subband_index, end) && + pullarray16(ppReadPackedMsg, value->subands[idx].channel, NFAPI_MAX_NUM_PHYSICAL_ANTENNAS, value->num_atennas, end))) + return 0; + } + + return 1; +} + + +static uint8_t unpack_srs_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_srs_indication_body_t* value = (nfapi_srs_indication_body_t*)tlv; + uint8_t* srsBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(srsBodyEnd > end) + return 0; + + if(pull8(ppReadPackedMsg, &value->number_of_ues, end) == 0) + return 0; + + if(value->number_of_ues > NFAPI_SRS_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of srs ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_ues, NFAPI_SRS_IND_MAX_PDU); + return 0; + } + + if(value->number_of_ues > 0) + { + value->srs_pdu_list = (nfapi_srs_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_srs_indication_pdu_t) * value->number_of_ues, config); + if(value->srs_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate srs ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_ues); + return 0; + } + } + else + { + value->srs_pdu_list = 0; + } + + + + uint8_t i = 0; + for(i = 0; i < value->number_of_ues; ++i) + { + nfapi_srs_indication_pdu_t* pdu = &(value->srs_pdu_list[i]); + + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* srsPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_SRS_INDICATION_FDD_REL8_TAG, &pdu->srs_indication_fdd_rel8, unpack_srs_indication_fdd_rel8_value}, + { NFAPI_SRS_INDICATION_FDD_REL9_TAG, &pdu->srs_indication_fdd_rel9, unpack_srs_indication_fdd_rel9_value}, + { NFAPI_SRS_INDICATION_TDD_REL10_TAG, &pdu->srs_indication_tdd_rel10, unpack_srs_indication_tdd_rel10_value}, + { NFAPI_SRS_INDICATION_FDD_REL11_TAG, &pdu->srs_indication_fdd_rel11, unpack_srs_indication_fdd_rel11_value}, + { NFAPI_TDD_CHANNEL_MEASUREMENT_TAG, &pdu->tdd_channel_measurement, unpack_tdd_channel_measurement_value}, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srsPduInstanceEnd, 0, 0) == 0) + return 0; + } + return 1; +} + +static uint8_t unpack_srs_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_srs_indication_t *pNfapiMsg = (nfapi_srs_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_SRS_INDICATION_BODY_TAG, &pNfapiMsg->srs_indication_body, &unpack_srs_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + +static uint8_t unpack_sr_indication_body_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_sr_indication_body_t* value = (nfapi_sr_indication_body_t*)tlv; + uint8_t* srBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(srBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_srs, end) == 0) + return 0; + + if(value->number_of_srs > NFAPI_SR_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of sr ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_srs, NFAPI_SR_IND_MAX_PDU); + return 0; + } + + if(value->number_of_srs > 0) + { + value->sr_pdu_list = (nfapi_sr_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_sr_indication_pdu_t) * value->number_of_srs, config); + if(value->sr_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate sr ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_srs); + return 0; + } + } + else + { + value->sr_pdu_list = 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_srs; ++i) + { + nfapi_sr_indication_pdu_t* pdu = &(value->sr_pdu_list[i]); + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* srPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, unpack_ul_cqi_information_value }, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, srPduInstanceEnd, 0, 0) == 0) + return 0; + } + + return 1; + +} + +static int unpack_sr_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_sr_indication_t *pNfapiMsg = (nfapi_sr_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_SR_INDICATION_BODY_TAG, &pNfapiMsg->sr_indication_body, &unpack_sr_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} +static uint8_t unpack_cqi_indication_rel8_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_rel8_t* cqi_pdu_rel8 = (nfapi_cqi_indication_rel8_t*)tlv; + + return (pull16(ppReadPackedMsg, &cqi_pdu_rel8->length, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel8->data_offset, end) && + pull8(ppReadPackedMsg, &cqi_pdu_rel8->ul_cqi, end) && + pull8(ppReadPackedMsg, &cqi_pdu_rel8->ri, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel8->timing_advance, end)); + +} + +static uint8_t unpack_cqi_indication_rel9_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_cqi_indication_rel9_t* cqi_pdu_rel9 = (nfapi_cqi_indication_rel9_t*)tlv; + + if(!(pull16(ppReadPackedMsg, &cqi_pdu_rel9->length, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel9->data_offset, end) && + pull8(ppReadPackedMsg, &cqi_pdu_rel9->ul_cqi, end) && + pull8(ppReadPackedMsg, &cqi_pdu_rel9->number_of_cc_reported, end))) + return 0; + + if(cqi_pdu_rel9->number_of_cc_reported > NFAPI_CC_MAX) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "FIXME : out of bound array\n"); + return 0; + } + + if(!(pullarray8(ppReadPackedMsg, cqi_pdu_rel9->ri, NFAPI_CC_MAX, cqi_pdu_rel9->number_of_cc_reported, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance, end) && + pull16(ppReadPackedMsg, &cqi_pdu_rel9->timing_advance_r9, end))) + return 0; + + return 1; +} + +static uint8_t unpack_cqi_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_cqi_indication_body_t* value = (nfapi_cqi_indication_body_t*)tlv; + + // the cqiBodyEnd points to the end of the cqi PDU's + uint8_t* cqiBodyEnd = *ppReadPackedMsg + value->tl.length; + + //uint8_t* cqiPduEnd = cqiBodyEnd; + //uint8_t* numberOfPdusAddress = *ppReadPackedMsg; + + if(cqiBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_cqis, end) == 0) + return 0; + + if(value->number_of_cqis > NFAPI_CQI_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of cqi ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_cqis, NFAPI_CQI_IND_MAX_PDU); + return -1; + } + + if(value->number_of_cqis > 0) + { + value->cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_pdu_t) * value->number_of_cqis, config); + if(value->cqi_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis); + return 0; + } + } + else + { + value->cqi_pdu_list = 0; + } + + if(value->number_of_cqis > 0) + { + value->cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_cqi_indication_raw_pdu_t) * value->number_of_cqis, config); + if(value->cqi_raw_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate raw cqi ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_cqis); + return 0; + } + } + else + { + value->cqi_raw_pdu_list = 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_cqis; ++i) + { + nfapi_cqi_indication_pdu_t* pdu = &(value->cqi_pdu_list[i]); + memset(pdu, 0, sizeof(nfapi_cqi_indication_pdu_t)); + + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* cqiPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + + while((uint8_t*)(*ppReadPackedMsg) < cqiPduInstanceEnd) + { + nfapi_tl_t generic_tl; + if(unpack_tl(ppReadPackedMsg, &generic_tl, end) == 0) + return 0; + + switch(generic_tl.tag) + { + case NFAPI_RX_UE_INFORMATION_TAG: + pdu->rx_ue_information.tl = generic_tl; + if(unpack_rx_ue_information_value(&pdu->rx_ue_information, ppReadPackedMsg, end) == 0) + return 0; + break; + case NFAPI_CQI_INDICATION_REL8_TAG: + pdu->cqi_indication_rel8.tl = generic_tl; + if(unpack_cqi_indication_rel8_value(&pdu->cqi_indication_rel8, ppReadPackedMsg, end) == 0) + return 0; + + break; + case NFAPI_CQI_INDICATION_REL9_TAG: + pdu->cqi_indication_rel9.tl = generic_tl; + if(unpack_cqi_indication_rel9_value(&pdu->cqi_indication_rel9, ppReadPackedMsg, end) == 0) + return 0; + + break; + case NFAPI_UL_CQI_INFORMATION_TAG: + pdu->ul_cqi_information.tl = generic_tl; + if(unpack_ul_cqi_information_value(&pdu->ul_cqi_information, ppReadPackedMsg, end) == 0) + return 0; + break; + default: + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "RX_CQI.indication Invalid pdu type %d \n", generic_tl.tag ); + } + break; + + }; + } + } + + uint8_t idx = 0; + for(idx = 0; idx < value->number_of_cqis; ++idx) + { + if(value->cqi_pdu_list[idx].cqi_indication_rel8.tl.tag == NFAPI_CQI_INDICATION_REL8_TAG) + { + if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel8.length, end) == 0) + return 0; + } + else if(value->cqi_pdu_list[idx].cqi_indication_rel9.tl.tag == NFAPI_CQI_INDICATION_REL9_TAG) + { + if(pullarray8(ppReadPackedMsg, &(value->cqi_raw_pdu_list[idx].pdu[0]), NFAPI_CQI_RAW_MAX_LEN, value->cqi_pdu_list[idx].cqi_indication_rel9.length, end) == 0) + return 0; + } + } + + + return 1; + +} + +static uint8_t unpack_cqi_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_cqi_indication_t *pNfapiMsg = (nfapi_cqi_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_CQI_INDICATION_BODY_TAG, &pNfapiMsg->cqi_indication_body, &unpack_cqi_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} +static uint8_t unpack_lbt_pdsch_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_lbt_pdsch_req_pdu_rel13_t* value = (nfapi_lbt_pdsch_req_pdu_rel13_t*)tlv; + + return (pull32(ppReadPackedMsg, &value->handle, end) && + pull32(ppReadPackedMsg, &value->mp_cca, end) && + pull32(ppReadPackedMsg, &value->n_cca, end) && + pull32(ppReadPackedMsg, &value->offset, end) && + pull32(ppReadPackedMsg, &value->lte_txop_sf, end) && + pull16(ppReadPackedMsg, &value->txop_sfn_sf_end, end) && + pull32(ppReadPackedMsg, &value->lbt_mode, end)); +} + +static uint8_t unpack_lbt_drs_req_pdu_rel13_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_lbt_drs_req_pdu_rel13_t* value = (nfapi_lbt_drs_req_pdu_rel13_t*)tlv; + + return (pull32(ppReadPackedMsg, &value->handle, end) && + pull32(ppReadPackedMsg, &value->offset, end) && + pull16(ppReadPackedMsg, &value->sfn_sf_end, end) && + pull32(ppReadPackedMsg, &value->lbt_mode, end)); +} + + +static uint8_t unpack_lbt_config_request_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_config_request_body_t* value = (nfapi_lbt_dl_config_request_body_t*)tlv; + + if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) + return 0; + + if(value->number_of_pdus > NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl config pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU); + return 0; + } + + if(value->number_of_pdus) + { + value->lbt_dl_config_req_pdu_list = (nfapi_lbt_dl_config_request_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_config_request_pdu_t) * value->number_of_pdus, config); + if(value->lbt_dl_config_req_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); + return 0; + } + } + else + { + value->lbt_dl_config_req_pdu_list = 0; + } + + + uint16_t i; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_lbt_dl_config_request_pdu_t* pdu = &(value->lbt_dl_config_req_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG, &pdu->lbt_pdsch_req_pdu.lbt_pdsch_req_pdu_rel13, &unpack_lbt_pdsch_req_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_LBT_DRS_REQ_PDU_REL13_TAG, &pdu->lbt_drs_req_pdu.lbt_drs_req_pdu_rel13, &unpack_lbt_drs_req_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + default: + NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL_CONFIG.request body invalid pdu type %d\n", pdu->pdu_type); + return 0; + } + } + + return 1; +} +static uint8_t unpack_lbt_dl_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_config_request_t *pNfapiMsg = (nfapi_lbt_dl_config_request_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG, &pNfapiMsg->lbt_dl_config_request_body, &unpack_lbt_config_request_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_lbt_pdsch_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_lbt_pdsch_rsp_pdu_rel13_t* value = (nfapi_lbt_pdsch_rsp_pdu_rel13_t*)tlv; + + return (pull32(ppReadPackedMsg, &value->handle, end) && + pull32(ppReadPackedMsg, &value->result, end) && + pull32(ppReadPackedMsg, &value->lte_txop_symbols, end) && + pull32(ppReadPackedMsg, &value->initial_partial_sf, end)); + +} +static uint8_t unpack_lbt_drs_rsp_pdu_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_lbt_drs_rsp_pdu_rel13_t* value = (nfapi_lbt_drs_rsp_pdu_rel13_t*)tlv; + + return (pull32(ppReadPackedMsg, &value->handle, end) && + pull32(ppReadPackedMsg, &value->result, end)); +} + +static uint8_t unpack_lbt_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_indication_body_t* value = (nfapi_lbt_dl_indication_body_t*)tlv; + + if(pull16(ppReadPackedMsg, &value->number_of_pdus, end) == 0) + return 0; + + if(value->number_of_pdus > NFAPI_LBT_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of lbt dl ind pdu's exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_pdus, NFAPI_LBT_IND_MAX_PDU); + return 0; + } + + if(value->number_of_pdus > 0) + { + value->lbt_indication_pdu_list = (nfapi_lbt_dl_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_lbt_dl_indication_pdu_t) * value->number_of_pdus, config); + if(value->lbt_indication_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate lbt dl ind config pdu list (count:%d)\n", __FUNCTION__, value->number_of_pdus); + return 0; + } + } + else + { + value->lbt_indication_pdu_list = 0; + } + + uint16_t i; + uint16_t total_number_of_pdus = value->number_of_pdus; + for(i = 0; i < total_number_of_pdus; ++i) + { + nfapi_lbt_dl_indication_pdu_t* pdu = &(value->lbt_indication_pdu_list[i]); + + if(!(pull8(ppReadPackedMsg, &pdu->pdu_type, end) && + pull8(ppReadPackedMsg, &pdu->pdu_size, end))) + return 0; + + uint8_t *packedPduEnd = (*ppReadPackedMsg) + pdu->pdu_size - 2; + + if(packedPduEnd > end) + return 0; + + switch(pdu->pdu_type) + { + case NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG, &pdu->lbt_pdsch_rsp_pdu.lbt_pdsch_rsp_pdu_rel13, &unpack_lbt_pdsch_rsp_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + case NFAPI_LBT_DL_RSP_DRS_PDU_TYPE: + { + unpack_tlv_t unpack_fns[] = + { + { NFAPI_LBT_DRS_RSP_PDU_REL13_TAG, &pdu->lbt_drs_rsp_pdu.lbt_drs_rsp_pdu_rel13, &unpack_lbt_drs_rsp_pdu_rel13_value}, + }; + + unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, packedPduEnd, 0, 0); + } + break; + default: + NFAPI_TRACE(NFAPI_TRACE_ERROR, "LBT_DL.indication body invalid pdu type %d\n", pdu->pdu_type); + return 0; + } + } + + return 1; +} +static uint8_t unpack_lbt_dl_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_lbt_dl_indication_t *pNfapiMsg = (nfapi_lbt_dl_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_LBT_DL_INDICATION_BODY_TAG, &pNfapiMsg->lbt_dl_indication_body, &unpack_lbt_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_nb_harq_indication_fdd_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nb_harq_indication_fdd_rel13_t* value = (nfapi_nb_harq_indication_fdd_rel13_t*)tlv; + return (pull8(ppReadPackedMsg, &value->harq_tb1, end)); +} + + +static uint8_t unpack_nb_harq_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nb_harq_indication_body_t* value = (nfapi_nb_harq_indication_body_t*)tlv; + uint8_t* nbharqBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(nbharqBodyEnd > end) + return 0; + + if(pull16(ppReadPackedMsg, &value->number_of_harqs, end) == 0) + return 0; + + if(value->number_of_harqs > NFAPI_HARQ_IND_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of harq ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_harqs, NFAPI_HARQ_IND_MAX_PDU); + return 0; + } + + value->nb_harq_pdu_list = (nfapi_nb_harq_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nb_harq_indication_pdu_t) * value->number_of_harqs, config); + if(value->nb_harq_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate harq ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_harqs); + return 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_harqs; ++i) + { + nfapi_nb_harq_indication_pdu_t* pdu = &(value->nb_harq_pdu_list[i]); + if(pull16(ppReadPackedMsg, &pdu->instance_length, end) == 0) + return 0; + + uint8_t* harqPduInstanceEnd = *ppReadPackedMsg + pdu->instance_length; + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_RX_UE_INFORMATION_TAG, &pdu->rx_ue_information, unpack_rx_ue_information_value }, + { NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG, &pdu->nb_harq_indication_fdd_rel13, &unpack_nb_harq_indication_fdd_rel13_value}, + { NFAPI_UL_CQI_INFORMATION_TAG, &pdu->ul_cqi_information, &unpack_ul_cqi_information_value} + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, harqPduInstanceEnd, 0, 0) == 0) + return 0; + + } + + return 1; +} + +static uint8_t unpack_nb_harq_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nb_harq_indication_t *pNfapiMsg = (nfapi_nb_harq_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_NB_HARQ_INDICATION_BODY_TAG, &pNfapiMsg->nb_harq_indication_body, &unpack_nb_harq_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_nrach_indication_rel13_value(void *tlv, uint8_t **ppReadPackedMsg, uint8_t *end) +{ + nfapi_nrach_indication_pdu_rel13_t* value = (nfapi_nrach_indication_pdu_rel13_t*)tlv; + + return (pull16(ppReadPackedMsg, &value->rnti, end) && + pull8(ppReadPackedMsg, &value->initial_sc, end) && + pull16(ppReadPackedMsg, &value->timing_advance, end) && + pull8(ppReadPackedMsg, &value->nrach_ce_level, end)); +} + +static uint8_t unpack_ue_release_resp(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_ue_release_response_t *pNfapiMsg = (nfapi_ue_release_response_t*)msg; + if(pull32(ppReadPackedMsg, &pNfapiMsg->error_code, end) == 0){ + return 0; + } + else{ + NFAPI_TRACE(NFAPI_TRACE_INFO, "ue_release_response:error_code = %d\n", pNfapiMsg->error_code); + } + return 1; +} + +static uint8_t unpack_nrach_indication_body_value(void* tlv, uint8_t **ppReadPackedMsg, uint8_t *end, nfapi_p7_codec_config_t* config) +{ + nfapi_nrach_indication_body_t* value = (nfapi_nrach_indication_body_t*)tlv; + uint8_t* nrachBodyEnd = *ppReadPackedMsg + value->tl.length; + + if(nrachBodyEnd > end) + return 0; + + if(pull8(ppReadPackedMsg, &value->number_of_initial_scs_detected, end) == 0) + return 0; + + if(value->number_of_initial_scs_detected > NFAPI_PREAMBLE_MAX_PDU) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s number of detected scs ind pdus exceed maxium (count:%d max:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected, NFAPI_PREAMBLE_MAX_PDU); + return 0; + } + + value->nrach_pdu_list = (nfapi_nrach_indication_pdu_t*)nfapi_p7_allocate(sizeof(nfapi_nrach_indication_pdu_t) * value->number_of_initial_scs_detected, config); + if(value->nrach_pdu_list == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate nrach ind pdu list (count:%d)\n", __FUNCTION__, value->number_of_initial_scs_detected); + return 0; + } + + uint8_t i = 0; + for(i = 0; i < value->number_of_initial_scs_detected; ++i) + { + nfapi_nrach_indication_pdu_t* pdu = &(value->nrach_pdu_list[i]); + + uint8_t* nrachPduInstanceEnd = *ppReadPackedMsg + 4 + 6; + + unpack_tlv_t unpack_fns[] = + { + { NFAPI_NRACH_INDICATION_REL13_TAG, &pdu->nrach_indication_rel13, &unpack_nrach_indication_rel13_value}, + }; + + if(unpack_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, nrachPduInstanceEnd, 0, 0) == 0) + return 0; + + } + + return 1; +} + +static uint8_t unpack_nrach_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nrach_indication_t *pNfapiMsg = (nfapi_nrach_indication_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + { NFAPI_NRACH_INDICATION_BODY_TAG, &pNfapiMsg->nrach_indication_body, &unpack_nrach_indication_body_value}, + }; + + return (pull16(ppReadPackedMsg, &pNfapiMsg->sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_nr_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_dl_node_sync_t *pNfapiMsg = (nfapi_nr_dl_node_sync_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_slot, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_dl_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_dl_node_sync_t *pNfapiMsg = (nfapi_dl_node_sync_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->delta_sfn_sf, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + +static uint8_t unpack_nr_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_ul_node_sync_t *pNfapiMsg = (nfapi_nr_ul_node_sync_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + +static uint8_t unpack_ul_node_sync(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_ul_node_sync_t *pNfapiMsg = (nfapi_ul_node_sync_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->t1, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->t2, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->t3, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + +static uint8_t unpack_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_timing_info_t *pNfapiMsg = (nfapi_timing_info_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn_sf, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->dl_config_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->tx_request_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->ul_config_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_jitter, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->dl_config_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->tx_request_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_config_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->hi_dci0_earliest_arrival, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + +static uint8_t unpack_nr_timing_info(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t* config) +{ + nfapi_nr_timing_info_t *pNfapiMsg = (nfapi_nr_timing_info_t*)msg; + + unpack_p7_tlv_t unpack_fns[] = + { + }; + + return (pull32(ppReadPackedMsg, &pNfapiMsg->last_sfn, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->last_slot, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->time_since_last_timing_info, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->dl_tti_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->ul_tti_jitter, end) && + pull32(ppReadPackedMsg, &pNfapiMsg->ul_dci_jitter, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_latest_delay, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->dl_tti_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->tx_data_request_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_tti_earliest_arrival, end) && + pulls32(ppReadPackedMsg, &pNfapiMsg->ul_dci_earliest_arrival, end) && + unpack_p7_tlv_list(unpack_fns, sizeof(unpack_fns)/sizeof(unpack_tlv_t), ppReadPackedMsg, end, config, &pNfapiMsg->vendor_extension)); +} + + + +// unpack length check + +static int check_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) +{ + int retLen = 0; + + switch (msgId) + { + case NFAPI_DL_CONFIG_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_dl_config_request_t)) + retLen = sizeof(nfapi_dl_config_request_t); + break; + + case NFAPI_UL_CONFIG_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_ul_config_request_t)) + retLen = sizeof(nfapi_ul_config_request_t); + break; + + case NFAPI_SUBFRAME_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t)) + retLen = sizeof(nfapi_subframe_indication_t); + break; + + case NFAPI_HI_DCI0_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_hi_dci0_request_t)) + retLen = sizeof(nfapi_hi_dci0_request_t); + break; + + case NFAPI_TX_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_tx_request_t)) + retLen = sizeof(nfapi_tx_request_t); + break; + + case NFAPI_HARQ_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_harq_indication_t)) + retLen = sizeof(nfapi_harq_indication_t); + break; + + case NFAPI_CRC_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_crc_indication_t)) + retLen = sizeof(nfapi_crc_indication_t); + break; + + case NFAPI_RX_ULSCH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_rx_indication_t)) + retLen = sizeof(nfapi_rx_indication_t); + break; + + case NFAPI_RACH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_rach_indication_t)) + retLen = sizeof(nfapi_rach_indication_t); + break; + + case NFAPI_SRS_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_srs_indication_t)) + retLen = sizeof(nfapi_srs_indication_t); + break; + + case NFAPI_RX_SR_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_sr_indication_t)) + retLen = sizeof(nfapi_sr_indication_t); + break; + + case NFAPI_RX_CQI_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t)) + retLen = sizeof(nfapi_cqi_indication_t); + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t)) + retLen = sizeof(nfapi_lbt_dl_config_request_t); + break; + + case NFAPI_LBT_DL_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t)) + retLen = sizeof(nfapi_lbt_dl_indication_t); + break; + + case NFAPI_NB_HARQ_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t)) + retLen = sizeof(nfapi_nb_harq_indication_t); + break; + + case NFAPI_NRACH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t)) + retLen = sizeof(nfapi_nrach_indication_t); + break; + + case NFAPI_DL_NODE_SYNC: + if (unpackedBufLen >= sizeof(nfapi_dl_node_sync_t)) + retLen = sizeof(nfapi_dl_node_sync_t); + break; + + case NFAPI_UL_NODE_SYNC: + if (unpackedBufLen >= sizeof(nfapi_ul_node_sync_t)) + retLen = sizeof(nfapi_ul_node_sync_t); + break; + + case NFAPI_TIMING_INFO: + if (unpackedBufLen >= sizeof(nfapi_timing_info_t)) + retLen = sizeof(nfapi_timing_info_t); + break; + + case NFAPI_UE_RELEASE_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t)) + retLen = sizeof(nfapi_ue_release_request_t); + break; + + case NFAPI_UE_RELEASE_RESPONSE: + if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t)) + retLen = sizeof(nfapi_ue_release_response_t); + break; + + default: + NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); + break; + } + + return retLen; +} + +static int check_nr_unpack_length(nfapi_message_id_e msgId, uint32_t unpackedBufLen) +{ + int retLen = 0; + + switch (msgId) + { + case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_nr_dl_tti_request_t)) + retLen = sizeof(nfapi_nr_dl_tti_request_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_nr_ul_tti_request_t)) + retLen = sizeof(nfapi_nr_ul_tti_request_t); + break; + + case NFAPI_SUBFRAME_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_subframe_indication_t)) + retLen = sizeof(nfapi_subframe_indication_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_nr_ul_dci_request_t)) + retLen = sizeof(nfapi_nr_ul_dci_request_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_nr_tx_data_request_t)) + retLen = sizeof(nfapi_nr_tx_data_request_t); + break; + + case NFAPI_HARQ_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_harq_indication_t)) + retLen = sizeof(nfapi_harq_indication_t); + break; + + case NFAPI_CRC_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_crc_indication_t)) + retLen = sizeof(nfapi_crc_indication_t); + break; + + case NFAPI_RX_ULSCH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_rx_indication_t)) + retLen = sizeof(nfapi_rx_indication_t); + break; + + case NFAPI_RACH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_rach_indication_t)) + retLen = sizeof(nfapi_rach_indication_t); + break; + + case NFAPI_SRS_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_srs_indication_t)) + retLen = sizeof(nfapi_srs_indication_t); + break; + + case NFAPI_RX_SR_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_sr_indication_t)) + retLen = sizeof(nfapi_sr_indication_t); + break; + + case NFAPI_RX_CQI_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_cqi_indication_t)) + retLen = sizeof(nfapi_cqi_indication_t); + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_lbt_dl_config_request_t)) + retLen = sizeof(nfapi_lbt_dl_config_request_t); + break; + + case NFAPI_LBT_DL_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_lbt_dl_indication_t)) + retLen = sizeof(nfapi_lbt_dl_indication_t); + break; + + case NFAPI_NB_HARQ_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_nb_harq_indication_t)) + retLen = sizeof(nfapi_nb_harq_indication_t); + break; + + case NFAPI_NRACH_INDICATION: + if (unpackedBufLen >= sizeof(nfapi_nrach_indication_t)) + retLen = sizeof(nfapi_nrach_indication_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: + if (unpackedBufLen >= sizeof(nfapi_nr_dl_node_sync_t)) + retLen = sizeof(nfapi_nr_dl_node_sync_t); + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: + if (unpackedBufLen >= sizeof(nfapi_nr_ul_node_sync_t)) + retLen = sizeof(nfapi_nr_ul_node_sync_t); + break; + + case NFAPI_TIMING_INFO: + if (unpackedBufLen >= sizeof(nfapi_timing_info_t)) + retLen = sizeof(nfapi_timing_info_t); + break; + + case NFAPI_UE_RELEASE_REQUEST: + if (unpackedBufLen >= sizeof(nfapi_ue_release_request_t)) + retLen = sizeof(nfapi_ue_release_request_t); + break; + + case NFAPI_UE_RELEASE_RESPONSE: + if (unpackedBufLen >= sizeof(nfapi_ue_release_response_t)) + retLen = sizeof(nfapi_ue_release_response_t); + break; + + default: + NFAPI_TRACE(NFAPI_TRACE_ERROR, "Unknown message ID %d\n", msgId); + break; + } + + return retLen; +} + + + +// Main unpack functions - public + +int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) +{ + nfapi_p7_message_header_t *pMessageHeader = pUnpackedBuf; + uint8_t *pReadPackedMessage = pMessageBuf; + uint8_t *end = pMessageBuf + messageBufLen; + + if (pMessageBuf == NULL || pUnpackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied pointers are null\n"); + return -1; + } + + if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 header unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); + return -1; + } + + // process the header + if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && + pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && + pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && + pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) + return -1; + + return 0; +} + +int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) +{ + int result = 0; + nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; + uint8_t *pReadPackedMessage = pMessageBuf; + uint8_t *end = pMessageBuf + messageBufLen; + + if (pMessageBuf == NULL || pUnpackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n"); + return -1; + } + + if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); + return -1; + } + /* + uint8_t *ptr = pMessageBuf; + printf("\n Read P7 message unpack: "); + while(ptr < end){ + printf(" %d ", *ptr); + ptr++; + } + printf("\n"); +*/ + // clean the supplied buffer for - tag value blanking + (void)memset(pUnpackedBuf, 0, unpackedBufLen); + + // process the header + if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && + pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && + pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && + pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n"); + return -1; + } + + if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n"); + return -1; + } + + /* + if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n"); + return -1; + } + */ + + // look for the specific message + switch (pMessageHeader->message_id) + { + case NFAPI_DL_CONFIG_REQUEST: + if (check_unpack_length(NFAPI_DL_CONFIG_REQUEST, unpackedBufLen)) + result = unpack_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UL_CONFIG_REQUEST: + if (check_unpack_length(NFAPI_UL_CONFIG_REQUEST, unpackedBufLen)) + result = unpack_ul_config_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + case NFAPI_TX_REQUEST: + if (check_unpack_length(NFAPI_TX_REQUEST, unpackedBufLen)) + result = unpack_tx_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + case NFAPI_HI_DCI0_REQUEST: + if (check_unpack_length(NFAPI_HI_DCI0_REQUEST, unpackedBufLen)) + result = unpack_hi_dci0_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UE_RELEASE_REQUEST: + if (check_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) + result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_HARQ_INDICATION: + if (check_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) + result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_CRC_INDICATION: + if (check_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen)) + result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_ULSCH_INDICATION: + if (check_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen)) + result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RACH_INDICATION: + if (check_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen)) + result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_SRS_INDICATION: + if (check_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen)) + result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_SR_INDICATION: + if (check_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen)) + result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_CQI_INDICATION: + if (check_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen)) + result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + if (check_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen)) + result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_LBT_DL_INDICATION: + if (check_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen)) + result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NB_HARQ_INDICATION: + if (check_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen)) + result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NRACH_INDICATION: + if (check_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen)) + result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_DL_NODE_SYNC: + if (check_unpack_length(NFAPI_DL_NODE_SYNC, unpackedBufLen)) + result = unpack_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UL_NODE_SYNC: + if (check_unpack_length(NFAPI_UL_NODE_SYNC, unpackedBufLen)) + result = unpack_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config); + else + return -1; + break; + + case NFAPI_TIMING_INFO: + if (check_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen)) + result = unpack_timing_info(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UE_RELEASE_RESPONSE: + if (check_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) + result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + default: + + if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && + pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) + { + if(config && config->unpack_p7_vendor_extension) + { + result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config); + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); + } + break; + } + + if(result == 0) + return -1; + else + return 0; +} + +int nfapi_nr_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config) +{ + int result = 0; + nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf; + uint8_t *pReadPackedMessage = pMessageBuf; + uint8_t *end = pMessageBuf + messageBufLen; + + if (pMessageBuf == NULL || pUnpackedBuf == NULL) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied pointers are null\n"); + return -1; + } + + if (messageBufLen < NFAPI_P7_HEADER_LENGTH || unpackedBufLen < sizeof(nfapi_p7_message_header_t)) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack supplied message buffer is too small %d, %d\n", messageBufLen, unpackedBufLen); + return -1; + } + /* + uint8_t *ptr = pMessageBuf; + printf("\n Read P7 message unpack: "); + while(ptr < end){ + printf(" %d ", *ptr); + ptr++; + } + printf("\n"); +*/ + // clean the supplied buffer for - tag value blanking + (void)memset(pUnpackedBuf, 0, unpackedBufLen); + + // process the header + if(!(pull16(&pReadPackedMessage, &pMessageHeader->phy_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_id, end) && + pull16(&pReadPackedMessage, &pMessageHeader->message_length, end) && + pull16(&pReadPackedMessage, &pMessageHeader->m_segment_sequence, end) && + pull32(&pReadPackedMessage, &pMessageHeader->checksum, end) && + pull32(&pReadPackedMessage, &pMessageHeader->transmit_timestamp, end))) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack header failed\n"); + return -1; + } + + if((uint8_t*)(pMessageBuf + pMessageHeader->message_length) > end) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack message length is greater than the message buffer \n"); + return -1; + } + + /* + if(check_unpack_length(pMessageHeader->message_id, unpackedBufLen) == 0) + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "P7 unpack unpack buffer is not large enough \n"); + return -1; + } + */ + + // look for the specific message + switch (pMessageHeader->message_id) + { + case NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_TTI_REQUEST, unpackedBufLen)) + result = unpack_dl_tti_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST, unpackedBufLen)) + result = unpack_ul_tti_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + case NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_TX_DATA_REQUEST, unpackedBufLen)) + result = unpack_tx_data_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + case NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_DCI_REQUEST, unpackedBufLen)) + result = unpack_ul_dci_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UE_RELEASE_REQUEST: + if (check_nr_unpack_length(NFAPI_UE_RELEASE_REQUEST, unpackedBufLen)) + result = unpack_ue_release_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_HARQ_INDICATION: + if (check_nr_unpack_length(NFAPI_HARQ_INDICATION, unpackedBufLen)) + result = unpack_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_CRC_INDICATION: + if (check_nr_unpack_length(NFAPI_CRC_INDICATION, unpackedBufLen)) + result = unpack_crc_indication(&pReadPackedMessage,end , pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_ULSCH_INDICATION: + if (check_nr_unpack_length(NFAPI_RX_ULSCH_INDICATION, unpackedBufLen)) + result = unpack_rx_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RACH_INDICATION: + if (check_nr_unpack_length(NFAPI_RACH_INDICATION, unpackedBufLen)) + result = unpack_rach_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_SRS_INDICATION: + if (check_nr_unpack_length(NFAPI_SRS_INDICATION, unpackedBufLen)) + result = unpack_srs_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_SR_INDICATION: + if (check_nr_unpack_length(NFAPI_RX_SR_INDICATION, unpackedBufLen)) + result = unpack_sr_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_RX_CQI_INDICATION: + if (check_nr_unpack_length(NFAPI_RX_CQI_INDICATION, unpackedBufLen)) + result = unpack_cqi_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_LBT_DL_CONFIG_REQUEST: + if (check_nr_unpack_length(NFAPI_LBT_DL_CONFIG_REQUEST, unpackedBufLen)) + result = unpack_lbt_dl_config_request(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_LBT_DL_INDICATION: + if (check_nr_unpack_length(NFAPI_LBT_DL_INDICATION, unpackedBufLen)) + result = unpack_lbt_dl_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NB_HARQ_INDICATION: + if (check_nr_unpack_length(NFAPI_NB_HARQ_INDICATION, unpackedBufLen)) + result = unpack_nb_harq_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NRACH_INDICATION: + if (check_nr_unpack_length(NFAPI_NRACH_INDICATION, unpackedBufLen)) + result = unpack_nrach_indication(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, unpackedBufLen)) + result = unpack_nr_dl_node_sync(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC: + if (check_nr_unpack_length(NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC, unpackedBufLen)) + result = unpack_nr_ul_node_sync(&pReadPackedMessage, end , pMessageHeader, config); + else + return -1; + break; + + case NFAPI_TIMING_INFO: + if (check_nr_unpack_length(NFAPI_TIMING_INFO, unpackedBufLen)) + result = unpack_nr_timing_info(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + case NFAPI_UE_RELEASE_RESPONSE: + if (check_nr_unpack_length(NFAPI_UE_RELEASE_RESPONSE, unpackedBufLen)) + result = unpack_ue_release_resp(&pReadPackedMessage, end, pMessageHeader, config); + else + return -1; + break; + + default: + + if(pMessageHeader->message_id >= NFAPI_VENDOR_EXT_MSG_MIN && + pMessageHeader->message_id <= NFAPI_VENDOR_EXT_MSG_MAX) + { + if(config && config->unpack_p7_vendor_extension) + { + result = (config->unpack_p7_vendor_extension)(pMessageHeader, &pReadPackedMessage, end, config); + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s VE NFAPI message ID %d. No ve decoder provided\n", __FUNCTION__, pMessageHeader->message_id); + } + } + else + { + NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s NFAPI Unknown message ID %d\n", __FUNCTION__, pMessageHeader->message_id); + } + break; + } + + if(result == 0) + return -1; + else + return 0; +} + + diff --git a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h index fc9cd66077..8520a5d162 100644 --- a/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h +++ b/nfapi/open-nFAPI/pnf/public_inc/nfapi_pnf_interface.h @@ -27,7 +27,6 @@ extern "C" { #include #include "nfapi_nr_interface.h" #include "nfapi_nr_interface_scf.h" - #include #include "openair1/PHY/defs_gNB.h" diff --git a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp index 1c2f0bef80..4fe5065cea 100644 --- a/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp +++ b/nfapi/open-nFAPI/pnf_sim/src/fapi_stub.cpp @@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) { if(instance->tick == 1000) { if(instance->tx_byte_count > 0) { - printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count); + printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count); instance->tx_byte_count = 0; } @@ -319,7 +319,7 @@ void *fapi_thread_start(void *ptr) { millisec = now_ts.tv_nsec / 1e6; if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) { - printf("*** missing millisec %d %d\n", last_millisec, millisec); + printf("*** missing millisec %u %u\n", last_millisec, millisec); catchup = millisec - last_millisec - 1; } diff --git a/openair1/PHY/CODING/3gpplte_sse.c b/openair1/PHY/CODING/3gpplte_sse.c index 2a7b789650..fffd04ea3c 100644 --- a/openair1/PHY/CODING/3gpplte_sse.c +++ b/openair1/PHY/CODING/3gpplte_sse.c @@ -44,8 +44,6 @@ //#define DEBUG_TURBO_ENCODER 1 //#define CALLGRIND 1 -unsigned short threegpplte_interleaver_output; -unsigned long long threegpplte_interleaver_tmp; #if defined(__x86_64__) || defined(__i386__) struct treillis { diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c index e1ca906b55..bc1c0dac56 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c @@ -798,11 +798,11 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, n is the size in bits of the coded block, with the tail */ int n2; llr_t y8[3*(n+16)] __attribute__((aligned(16))); - llr_t systematic0[n+16] __attribute__ ((aligned(16))); - llr_t systematic1[n+16] __attribute__ ((aligned(16))); - llr_t systematic2[n+16] __attribute__ ((aligned(16))); - llr_t yparity1[n+16] __attribute__ ((aligned(16))); - llr_t yparity2[n+16] __attribute__ ((aligned(16))); + llr_t systematic0[n+32] __attribute__ ((aligned(16))); + llr_t systematic1[n+32] __attribute__ ((aligned(16))); + llr_t systematic2[n+32] __attribute__ ((aligned(16))); + llr_t yparity1[n+32] __attribute__ ((aligned(16))); + llr_t yparity2[n+32] __attribute__ ((aligned(16))); llr_t ext[n+128] __attribute__((aligned(16))); llr_t ext2[n+128] __attribute__((aligned(16))); llr_t alpha[(n+16)*8] __attribute__ ((aligned(16))); @@ -811,7 +811,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, llr_t m10[n+16] __attribute__ ((aligned(16))); // int *pi2_p,*pi4_p,*pi5_p,*pi6_p; int *pi4_p,*pi5_p,*pi6_p; - llr_t *s,*s1,*s2,*yp1,*yp2,*yp; + llr_t *s1,*s2,*yp1,*yp2,*yp; unsigned int i,j,iind;//,pi; unsigned char iteration_cnt=0; unsigned int crc,oldcrc,crc_len; @@ -927,7 +927,6 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, yp128 = (int8x16_t *)y8; #endif - s = systematic0; s1 = systematic1; s2 = systematic2; yp1 = yparity1; @@ -938,7 +937,7 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, for (i=0; i<16 ; i++ ) for (j=0; jn) { /* - s[n]=0;s[n+1]=0;s[n+2]=0;s[n+3]=0; - s[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0; + systematic0[n]=0;systematic0[n+1]=0;systematic0[n+2]=0;systematic0[n+3]=0; + systematic0[n+4]=0;s[n+5]=0;s[n+6]=0;s[n+7]=0; s1[n]=0;s1[n+1]=0;s1[n+2]=0;s1[n+3]=0; s1[n+4]=0;s1[n+5]=0;s1[n+6]=0;s1[n+7]=0; s2[n]=0;s2[n+1]=0;s2[n+2]=0;s2[n+3]=0; @@ -961,26 +960,26 @@ uint8_t phy_threegpplte_turbo_decoder8(int16_t *y, // Termination for (i=n2; i= maxlev) + qxd = maxlev - 1; + + return ((char) qxd); +} + + +#endif + diff --git a/openair1/PHY/CODING/TESTBENCH/ldpctest.c b/openair1/PHY/CODING/TESTBENCH/ldpctest.c index b42ac6e4c8..91c5d59611 100644 --- a/openair1/PHY/CODING/TESTBENCH/ldpctest.c +++ b/openair1/PHY/CODING/TESTBENCH/ldpctest.c @@ -26,9 +26,11 @@ #include "assertions.h" #include "SIMULATION/TOOLS/sim.h" #include "PHY/CODING/nrLDPC_extern.h" -#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" +//#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" #include "openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h" -#define MAX_NUM_DLSCH_SEGMENTS 16 +#include "openair1/PHY/defs_nr_common.h" +#include "coding_unitary_defs.h" + #define MAX_BLOCK_LENGTH 8448 #ifndef malloc16 @@ -81,9 +83,6 @@ typedef struct { int n_iter_max; } n_iter_stats_t; -RAN_CONTEXT_t RC; -PHY_VARS_UE ***PHY_vars_UE_g; -uint16_t NB_UE_INST = 1; nrLDPC_encoderfunc_t encoder_orig; short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384}; @@ -116,9 +115,8 @@ int test_ldpc(short No_iteration, double sigma; sigma = 1.0/sqrt(2*SNR); opp_enabled=1; - cpu_freq_GHz = get_cpu_freq_GHz(); //short test_input[block_length]; - unsigned char *test_input[MAX_NUM_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};; + unsigned char *test_input[MAX_NUM_NR_DLSCH_SEGMENTS]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};; //short *c; //padded codeword unsigned char *estimated_output[MAX_NUM_DLSCH_SEGMENTS]; unsigned char *estimated_output_bit[MAX_NUM_DLSCH_SEGMENTS]; @@ -144,7 +142,7 @@ int test_ldpc(short No_iteration, t_nrLDPC_procBuf nrLDPC_procBuf; t_nrLDPC_procBuf* p_nrLDPC_procBuf = &nrLDPC_procBuf; - t_nrLDPC_time_stats decoder_profiler; + t_nrLDPC_time_stats decoder_profiler = {0}; t_nrLDPC_time_stats* p_decoder_profiler =&decoder_profiler ; int32_t n_iter = 0; @@ -614,7 +612,6 @@ int main(int argc, char *argv[]) exit(1); break; } - cpu_freq_GHz = get_cpu_freq_GHz(); //printf("the decoder supports BG2, Kb=10, Z=128 & 256\n"); //printf(" range of blocklength: 1201 -> 1280, 2401 -> 2560\n"); printf("block length %d: \n", block_length); @@ -704,25 +701,25 @@ int main(int argc, char *argv[]) printf("SNR %f, Std iterations: %f\n",SNR, dec_iter->n_iter_std); printf("SNR %f, Max iterations: %d\n",SNR, dec_iter->n_iter_max); printf("\n"); - printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz); - printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2))); - printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/cpu_freq_GHz); + printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz()); + printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2))); + printf("Encoding time max: %15.3f us\n",(double)time_optim->max/1000.0/get_cpu_freq_GHz()); printf("\n"); - printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz); - printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2))); - printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/cpu_freq_GHz); + printf("Decoding time mean: %15.3f us\n",(double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz()); + printf("Decoding time std: %15.3f us\n",sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2))); + printf("Decoding time max: %15.3f us\n",(double)time_decoder->max/1000.0/get_cpu_freq_GHz()); fprintf(fd,"%f %f %f %f %f %f %f %f %f %f %f %f %d \n", SNR, (double)decoded_errors[i]/(double)n_trials , (double)errors_bit/(double)n_trials/(double)block_length/(double)n_segments , errors_bit_uncoded/(double)n_trials/(double)n_segments , - (double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz, - sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_optim->diff/time_optim->trials/1000.0/cpu_freq_GHz,2)), - (double)time_optim->max/1000.0/cpu_freq_GHz, - (double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz, - sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(cpu_freq_GHz,2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/cpu_freq_GHz,2)), - (double)time_decoder->max/1000.0/cpu_freq_GHz, + (double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(), + sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2)), + (double)time_optim->max/1000.0/get_cpu_freq_GHz(), + (double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(), + sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2)), + (double)time_decoder->max/1000.0/get_cpu_freq_GHz(), dec_iter->n_iter_mean, dec_iter->n_iter_std, dec_iter->n_iter_max diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index d9adf3e24f..8e7e377542 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -11,16 +11,12 @@ #include "PHY/CODING/nrPolar_tools/nr_polar_uci_defs.h" #include "PHY/CODING/coding_defs.h" #include "SIMULATION/TOOLS/sim.h" -#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" //#include "common/utils/LOG/log.h" - +#include "coding_unitary_defs.h" //#define DEBUG_DCI_POLAR_PARAMS //#define DEBUG_POLAR_TIMING //#define DEBUG_POLARTEST -RAN_CONTEXT_t RC; -PHY_VARS_UE ***PHY_vars_UE_g; -uint16_t NB_UE_INST = 1; int main(int argc, char *argv[]) { @@ -113,7 +109,6 @@ int main(int argc, char *argv[]) //Initiate timing. (Results depend on CPU Frequency. Therefore, might change due to performance variances during simulation.) time_stats_t timeEncoder,timeDecoder; opp_enabled=1; - cpu_freq_GHz = get_cpu_freq_GHz(); reset_meas(&timeEncoder); reset_meas(&timeDecoder); randominit(0); @@ -324,9 +319,9 @@ if (logFlag){ #endif //Iteration times are in microseconds. - timeEncoderCumulative+=(timeEncoder.diff/(cpu_freq_GHz*1000.0)); - timeDecoderCumulative+=(timeDecoder.diff/(cpu_freq_GHz*1000.0)); - if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(cpu_freq_GHz*1000.0)), (timeDecoder.diff/(cpu_freq_GHz*1000.0))); + timeEncoderCumulative+=(timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)); + timeDecoderCumulative+=(timeDecoder.diff/(get_cpu_freq_GHz()*1000.0)); + if (logFlag) fprintf(logFile,",%f,%d,%u,%f,%f\n", SNR, nBitError, blockErrorState, (timeEncoder.diff/(get_cpu_freq_GHz()*1000.0)), (timeDecoder.diff/(get_cpu_freq_GHz()*1000.0))); if (nBitError<0) { blockErrorCumulative++; @@ -348,7 +343,7 @@ if (logFlag){ printf("[ListSize=%d] SNR=%+8.3f, BLER=%9.6f, BER=%12.9f, t_Encoder=%9.3fus, t_Decoder=%9.3fus\n", decoderListSize, SNR, ((double)blockErrorCumulative/iterations), ((double)bitErrorCumulative / (iterations*testLength)), - (double)timeEncoder.diff/timeEncoder.trials/(cpu_freq_GHz*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(cpu_freq_GHz*1000.0)); + (double)timeEncoder.diff/timeEncoder.trials/(get_cpu_freq_GHz()*1000.0),(double)timeDecoder.diff/timeDecoder.trials/(get_cpu_freq_GHz()*1000.0)); //(timeEncoderCumulative/iterations),timeDecoderCumulative/iterations); if (blockErrorCumulative==0 && bitErrorCumulative==0) break; diff --git a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c index 02d5dc64e0..c9ed678a8f 100644 --- a/openair1/PHY/CODING/TESTBENCH/smallblocktest.c +++ b/openair1/PHY/CODING/TESTBENCH/smallblocktest.c @@ -1,19 +1,15 @@ #include #include "SIMULATION/TOOLS/sim.h" #include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h" -#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" +#include "coding_unitary_defs.h" //#define DEBUG_SMALLBLOCKTEST -RAN_CONTEXT_t RC; -PHY_VARS_UE ***PHY_vars_UE_g; -uint16_t NB_UE_INST = 1; int main(int argc, char *argv[]) { time_stats_t timeEncoder,timeDecoder; opp_enabled=1; - cpu_freq_GHz = get_cpu_freq_GHz(); reset_meas(&timeEncoder); reset_meas(&timeDecoder); randominit(0); @@ -141,8 +137,8 @@ int main(int argc, char *argv[]) SNR, ((double)bitErrorCumulative / (iterations*messageLength)), ((double)blockErrorCumulative/iterations), - ((double)timeEncoder.diff/timeEncoder.trials)/(cpu_freq_GHz), - ((double)timeDecoder.diff/timeDecoder.trials)/(cpu_freq_GHz*1000.0)); + ((double)timeEncoder.diff/timeEncoder.trials)/(get_cpu_freq_GHz()), + ((double)timeDecoder.diff/timeDecoder.trials)/(get_cpu_freq_GHz()*1000.0)); blockErrorCumulative=0; bitErrorCumulative=0; diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c index 785b588b9f..3226c97f87 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c @@ -39,7 +39,7 @@ #include "nrLDPC_bnProc.h" #define NR_LDPC_ENABLE_PARITY_CHECK -#define NR_LDPC_PROFILER_DETAIL +//#define NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_DEBUG_MODE #include "nrLDPC_tools/nrLDPC_debug.h" diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c index 18db8a01fb..8fe115b23a 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c @@ -40,9 +40,9 @@ #include "assertions.h" int8_t polar_decoder(double *input, - uint32_t *out, - t_nrPolar_params *polarParams, - uint8_t listSize) + uint32_t *out, + const t_nrPolar_params *polarParams, + uint8_t listSize) { //Assumes no a priori knowledge. uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize); @@ -299,7 +299,7 @@ int8_t polar_decoder(double *input, int8_t polar_decoder_dci(double *input, uint32_t *out, - t_nrPolar_params *polarParams, + const t_nrPolar_params *polarParams, uint8_t listSize, uint16_t n_RNTI) { uint8_t ***bit = nr_alloc_uint8_3D_array(polarParams->N, (polarParams->n+1), 2*listSize); diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h index a44a08a701..c2e9fd9381 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h @@ -138,22 +138,22 @@ typedef struct nrPolar_params t_nrPolar_params; void polar_encoder(uint32_t *input, uint32_t *output, - t_nrPolar_params *polarParams); + const t_nrPolar_params *polarParams); void polar_encoder_dci(uint32_t *in, uint32_t *out, - t_nrPolar_params *polarParams, + const t_nrPolar_params *polarParams, uint16_t n_RNTI); void polar_encoder_fast(uint64_t *A, void *out, int32_t crcmask, uint8_t ones_flag, - t_nrPolar_params *polarParams); + const t_nrPolar_params *polarParams); int8_t polar_decoder(double *input, - uint32_t *output, - t_nrPolar_params *polarParams, + uint32_t *output, + const t_nrPolar_params *polarParams, uint8_t listSize); uint32_t polar_decoder_int16(int16_t *input, @@ -163,21 +163,21 @@ uint32_t polar_decoder_int16(int16_t *input, int8_t polar_decoder_dci(double *input, uint32_t *out, - t_nrPolar_params *polarParams, + const t_nrPolar_params *polarParams, uint8_t listSize, uint16_t n_RNTI); void generic_polar_decoder(const t_nrPolar_params *pp, - decoder_node_t *node); + decoder_node_t *node); void applyFtoleft(const t_nrPolar_params *pp, - decoder_node_t *node); + decoder_node_t *node); void applyGtoright(const t_nrPolar_params *pp, - decoder_node_t *node); + decoder_node_t *node); void computeBeta(const t_nrPolar_params *pp, - decoder_node_t *node); + decoder_node_t *node); void build_decoder_tree(t_nrPolar_params *pp); void build_polar_tables(t_nrPolar_params *polarParams); diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c index 27c062c217..e61b3dff9b 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c @@ -43,7 +43,7 @@ void polar_encoder(uint32_t *in, uint32_t *out, - t_nrPolar_params *polarParams) { + const t_nrPolar_params *polarParams) { if (1) {//polarParams->idx == 0 || polarParams->idx == 1) { //PBCH or PDCCH /* uint64_t B = (((uint64_t)*in)&((((uint64_t)1)<<32)-1)) | (((uint64_t)crc24c((uint8_t*)in,polarParams->payloadBits)>>8)<payloadBits); @@ -154,7 +154,7 @@ void polar_encoder(uint32_t *in, void polar_encoder_dci(uint32_t *in, uint32_t *out, - t_nrPolar_params *polarParams, + const t_nrPolar_params *polarParams, uint16_t n_RNTI) { #ifdef DEBUG_POLAR_ENCODER_DCI printf("[polar_encoder_dci] in: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\n", in[0], in[1], in[2], in[3]); @@ -251,9 +251,9 @@ void polar_encoder_dci(uint32_t *in, #endif } -static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline)); +static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) __attribute__((always_inline)); -static inline void polar_rate_matching(t_nrPolar_params *polarParams,void *in,void *out) { +static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void *in,void *out) { // handle rate matching with a single 128 bit word using bit shuffling // can be done with SIMD intrisics if needed @@ -411,7 +411,7 @@ void polar_encoder_fast(uint64_t *A, void *out, int32_t crcmask, uint8_t ones_flag, - t_nrPolar_params *polarParams) { + const t_nrPolar_params *polarParams) { // AssertFatal(polarParams->K > 32, "K = %d < 33, is not supported yet\n",polarParams->K); AssertFatal(polarParams->K < 129, "K = %d > 128, is not supported yet\n",polarParams->K); AssertFatal(polarParams->payloadBits < 65, "payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits); diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c index 0990a58266..81fb28cc98 100644 --- a/openair1/PHY/INIT/init_top.c +++ b/openair1/PHY/INIT/init_top.c @@ -73,7 +73,6 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) { init_unscrambling_lut(); init_scrambling_lut(); //set_taus_seed(1328); - init_sss(); } void free_lte_top(void) { diff --git a/openair1/PHY/INIT/lte_init.c b/openair1/PHY/INIT/lte_init.c index 2c7e3e88eb..1daeb72187 100644 --- a/openair1/PHY/INIT/lte_init.c +++ b/openair1/PHY/INIT/lte_init.c @@ -35,7 +35,7 @@ #include "assertions.h" #include #include "nfapi/oai_integration/vendor_ext.h" - +#include extern uint32_t from_earfcn(int eutra_bandP,uint32_t dl_earfcn); extern int32_t get_uldl_offset(int eutra_bandP); @@ -46,6 +46,17 @@ uint8_t dmrs1_tab[8] = { 0, 2, 3, 4, 6, 8, 9, 10 }; int N_RB_DL_array[6] = { 6, 15, 25, 50, 75, 100 }; +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + +void pdsch_procedures(PHY_VARS_eNB *eNB, + L1_rxtx_proc_t *proc, + int harq_pid, + LTE_eNB_DLSCH_t *dlsch, + LTE_eNB_DLSCH_t *dlsch1); + +void init_sss(void); + int l1_north_init_eNB () { int i,j; @@ -347,6 +358,33 @@ void phy_config_sib13_eNB(module_id_t Mod_id,int CC_id,int mbsfn_Area_idx, lte_gold_mbsfn_khz_1dot25 (fp, RC.eNB[Mod_id][CC_id]->lte_gold_mbsfn_khz_1dot25_table, fp->Nid_cell_mbsfn); } +void fill_subframe_mask(PHY_VARS_eNB *eNB) { + + AssertFatal(eNB->subframe_mask!=NULL,"Subframe mask is null\n"); + int32_t **dummy_tx=eNB->common_vars.txdataF; + eNB->common_vars.txdataF = eNB->subframe_mask; + + for (int sf=0;sf<10;sf++) { + if (subframe_select(&eNB->frame_parms,sf)==SF_DL) { + LTE_DL_eNB_HARQ_t *dlsch_harq=eNB->dlsch[0][0]->harq_processes[0]; + L1_rxtx_proc_t proc; + proc.frame_tx=0; + proc.subframe_tx=sf; + eNB->dlsch[0][0]->harq_ids[0][sf]=0; + eNB->dlsch[0][0]->rnti=0x1234; + dlsch_harq->nb_rb=48; + dlsch_harq->rb_alloc[0]=(uint32_t)0xffffffff; + dlsch_harq->Qm=2; + dlsch_harq->Nl=1; + dlsch_harq->pdsch_start=1; + dlsch_harq->mimo_mode=(eNB->frame_parms.nb_antenna_ports_eNB>1) ? ALAMOUTI : SISO; + dlsch_harq->dl_power_off = 1; + computeRhoB_eNB(4,eNB->frame_parms.pdsch_config_common.p_b,eNB->frame_parms.nb_antenna_ports_eNB,eNB->dlsch[0][0],dlsch_harq->dl_power_off); + pdsch_procedures(eNB,&proc,0,eNB->dlsch[0][0],NULL); + } + } + eNB->common_vars.txdataF = dummy_tx; +} int phy_init_lte_eNB(PHY_VARS_eNB *eNB, unsigned char is_secondary_eNB, @@ -385,7 +423,9 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, lte_gold (fp, eNB->lte_gold_table, fp->Nid_cell); generate_pcfich_reg_mapping (fp); generate_phich_reg_mapping (fp); + init_sss(); + init_fde(); for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { eNB->first_run_timing_advance[UE_id] = 1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here. @@ -397,9 +437,13 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, eNB->first_run_I0_measurements = 1; ///This flag used to be static. With multiple eNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here. + eNB->use_DTX=1; if (NFAPI_MODE!=NFAPI_MODE_VNF) { common_vars->rxdata = (int32_t **)NULL; common_vars->txdataF = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t *)); + if (eNB->use_DTX==0) { + eNB->subframe_mask = (int32_t **)malloc16(NB_ANTENNA_PORTS_ENB*sizeof(int32_t *)); + } common_vars->rxdataF = (int32_t **)malloc16(64*sizeof(int32_t *)); LOG_I(PHY,"[INIT] NB_ANTENNA_PORTS_ENB:%d fp->nb_antenna_ports_eNB:%d\n", NB_ANTENNA_PORTS_ENB, fp->nb_antenna_ports_eNB); @@ -409,17 +453,19 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, LOG_I(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n", i,common_vars->txdataF[i], fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t)); + if (eNB->use_DTX==0 && inb_antenna_ports_eNB) eNB->subframe_mask[i] = malloc16_clear(fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) ); } } + LOG_I(PHY,"[INIT]SRS allocation\n"); // Channel estimates for SRS - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { - srs_vars[UE_id].srs_ch_estimates = (int32_t **) malloc16 (64 * sizeof (int32_t *)); - srs_vars[UE_id].srs_ch_estimates_time = (int32_t **) malloc16 (64 * sizeof (int32_t *)); + for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) { + srs_vars[srs_id].srs_ch_estimates = (int32_t **) malloc16 (64 * sizeof (int32_t *)); + srs_vars[srs_id].srs_ch_estimates_time = (int32_t **) malloc16 (64 * sizeof (int32_t *)); for (i = 0; i < 64; i++) { - srs_vars[UE_id].srs_ch_estimates[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size); - srs_vars[UE_id].srs_ch_estimates_time[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size * 2); + srs_vars[srs_id].srs_ch_estimates[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size); + srs_vars[srs_id].srs_ch_estimates_time[i] = (int32_t *) malloc16_clear (sizeof (int32_t) * fp->ofdm_symbol_size * 2); } } //UE_id @@ -427,10 +473,11 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, init_ulsch_power_LUT (); // SRS - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { - srs_vars[UE_id].srs = (int32_t *) malloc16_clear (2 * fp->ofdm_symbol_size * sizeof (int32_t)); + for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) { + srs_vars[srs_id].srs = (int32_t *) malloc16_clear (2 * fp->ofdm_symbol_size * sizeof (int32_t)); } + LOG_I(PHY,"PRACH allocation\n"); // PRACH prach_vars->prachF = (int16_t *) malloc16_clear (1024 * 2 * sizeof (int16_t)); // assume maximum of 64 RX antennas for PRACH receiver @@ -461,34 +508,33 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,prach_vars->rxsigF[i]); }*/ - for (UE_id=0; UE_idrxdataF_ext = (int32_t **) malloc16 (2 * sizeof (int32_t *)); - pusch_vars[UE_id]->rxdataF_ext2 = (int32_t **) malloc16 (2 * sizeof (int32_t *)); - pusch_vars[UE_id]->drs_ch_estimates = (int32_t **) malloc16 (2 * sizeof (int32_t *)); - pusch_vars[UE_id]->drs_ch_estimates_time = (int32_t **) malloc16 (2 * sizeof (int32_t *)); - pusch_vars[UE_id]->rxdataF_comp = (int32_t **) malloc16 (2 * sizeof (int32_t *)); - pusch_vars[UE_id]->ul_ch_mag = (int32_t **) malloc16 (2 * sizeof (int32_t *)); - pusch_vars[UE_id]->ul_ch_magb = (int32_t **) malloc16 (2 * sizeof (int32_t *)); + pusch_vars[ULSCH_id] = (LTE_eNB_PUSCH *) malloc16_clear (NUMBER_OF_ULSCH_MAX * sizeof (LTE_eNB_PUSCH)); + pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **) malloc16 (4 * sizeof (int32_t *)); + pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **) malloc16 (4 * sizeof (int32_t *)); + pusch_vars[ULSCH_id]->drs_ch_estimates = (int32_t **) malloc16 (4 * sizeof (int32_t *)); + pusch_vars[ULSCH_id]->drs_ch_estimates_time = (int32_t **) malloc16 (4 * sizeof (int32_t *)); + pusch_vars[ULSCH_id]->rxdataF_comp = (int32_t **) malloc16 (4 * sizeof (int32_t *)); + pusch_vars[ULSCH_id]->ul_ch_mag = (int32_t **) malloc16 (4 * sizeof (int32_t *)); + pusch_vars[ULSCH_id]->ul_ch_magb = (int32_t **) malloc16 (4 * sizeof (int32_t *)); AssertFatal (fp->ofdm_symbol_size > 127, "fp->ofdm_symbol_size %d<128\n", fp->ofdm_symbol_size); AssertFatal (fp->symbols_per_tti > 11, "fp->symbols_per_tti %d < 12\n", fp->symbols_per_tti); AssertFatal (fp->N_RB_UL > 5, "fp->N_RB_UL %d < 6\n", fp->N_RB_UL); - - for (i = 0; i < 2; i++) { - // RK 2 times because of output format of FFT! + AssertFatal (fp->nb_antennas_rx > 0,"fp->nb_antennas_rx = %d\n",fp->nb_antennas_rx); + for (i = 0; i < fp->nb_antennas_rx; i++) { // FIXME We should get rid of this - pusch_vars[UE_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti ); - pusch_vars[UE_id]->rxdataF_ext2[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti ); - pusch_vars[UE_id]->drs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti ); - pusch_vars[UE_id]->drs_ch_estimates_time[i] = (int32_t *)malloc16_clear( 2*sizeof(int32_t)*fp->ofdm_symbol_size ); - pusch_vars[UE_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti ); - pusch_vars[UE_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 ); - pusch_vars[UE_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 ); + pusch_vars[ULSCH_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti ); + pusch_vars[ULSCH_id]->drs_ch_estimates[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti ); + pusch_vars[ULSCH_id]->drs_ch_estimates_time[i] = (int32_t *)malloc16_clear( 4*sizeof(int32_t)*fp->ofdm_symbol_size ); + pusch_vars[ULSCH_id]->rxdataF_comp[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->N_RB_UL*12*fp->symbols_per_tti ); + pusch_vars[ULSCH_id]->ul_ch_mag[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 ); + pusch_vars[ULSCH_id]->ul_ch_magb[i] = (int32_t *)malloc16_clear( fp->symbols_per_tti*sizeof(int32_t)*fp->N_RB_UL*12 ); } - pusch_vars[UE_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); - } //UE_id + pusch_vars[ULSCH_id]->llr = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) ); + } //ULSCH_id for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) eNB->UE_stats_ptr[UE_id] = &eNB->UE_stats[UE_id]; @@ -518,19 +564,19 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) { free_and_zero(common_vars->rxdataF); // Channel estimates for SRS - for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) { + for (int srs_id = 0; srs_id < NUMBER_OF_SRS_MAX; srs_id++) { for (i=0; i<64; i++) { - free_and_zero(srs_vars[UE_id].srs_ch_estimates[i]); - free_and_zero(srs_vars[UE_id].srs_ch_estimates_time[i]); + free_and_zero(srs_vars[srs_id].srs_ch_estimates[i]); + free_and_zero(srs_vars[srs_id].srs_ch_estimates_time[i]); } - free_and_zero(srs_vars[UE_id].srs_ch_estimates); - free_and_zero(srs_vars[UE_id].srs_ch_estimates_time); + free_and_zero(srs_vars[srs_id].srs_ch_estimates); + free_and_zero(srs_vars[srs_id].srs_ch_estimates_time); } //UE_id free_ul_ref_sigs(); - for (UE_id=0; UE_idprachF); @@ -548,26 +594,26 @@ void phy_free_lte_eNB(PHY_VARS_eNB *eNB) { free_and_zero(prach_vars_br->prachF); free_and_zero(prach_vars->rxsigF[0]); - for (UE_id=0; UE_idrxdataF_ext[i]); - free_and_zero(pusch_vars[UE_id]->rxdataF_ext2[i]); - free_and_zero(pusch_vars[UE_id]->drs_ch_estimates[i]); - free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time[i]); - free_and_zero(pusch_vars[UE_id]->rxdataF_comp[i]); - free_and_zero(pusch_vars[UE_id]->ul_ch_mag[i]); - free_and_zero(pusch_vars[UE_id]->ul_ch_magb[i]); + for (int ULSCH_id=0; ULSCH_idnb_antennas_rx; i++) { + free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]); + free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]); + free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates[i]); + free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates_time[i]); + free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp[i]); + free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag[i]); + free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb[i]); } - free_and_zero(pusch_vars[UE_id]->rxdataF_ext); - free_and_zero(pusch_vars[UE_id]->rxdataF_ext2); - free_and_zero(pusch_vars[UE_id]->drs_ch_estimates); - free_and_zero(pusch_vars[UE_id]->drs_ch_estimates_time); - free_and_zero(pusch_vars[UE_id]->rxdataF_comp); - free_and_zero(pusch_vars[UE_id]->ul_ch_mag); - free_and_zero(pusch_vars[UE_id]->ul_ch_magb); - free_and_zero(pusch_vars[UE_id]->llr); - free_and_zero(pusch_vars[UE_id]); + free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext); + free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2); + free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates); + free_and_zero(pusch_vars[ULSCH_id]->drs_ch_estimates_time); + free_and_zero(pusch_vars[ULSCH_id]->rxdataF_comp); + free_and_zero(pusch_vars[ULSCH_id]->ul_ch_mag); + free_and_zero(pusch_vars[ULSCH_id]->ul_ch_magb); + free_and_zero(pusch_vars[ULSCH_id]->llr); + free_and_zero(pusch_vars[ULSCH_id]); } //UE_id for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) eNB->UE_stats_ptr[UE_id] = NULL; diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c index 8ad928f8a0..a856c33999 100644 --- a/openair1/PHY/INIT/lte_init_ru.c +++ b/openair1/PHY/INIT/lte_init_ru.c @@ -21,9 +21,8 @@ #include "phy_init.h" #include "SCHED/sched_eNB.h" -#include "PHY/phy_extern.h" #include "PHY/LTE_REFSIG/lte_refsig.h" -#include "SIMULATION/TOOLS/sim.h" +//#include "SIMULATION/TOOLS/sim.h" #include "LTE_RadioResourceConfigCommonSIB.h" #include "LTE_RadioResourceConfigDedicated.h" #include "LTE_TDD-Config.h" @@ -34,6 +33,8 @@ void init_7_5KHz(void); +extern const char ru_if_types[MAX_RU_IF_TYPES][20]; + int phy_init_RU(RU_t *ru) { LTE_DL_FRAME_PARMS *fp = ru->frame_parms; RU_CALIBRATION *calibration = &ru->calibration; @@ -44,6 +45,7 @@ int phy_init_RU(RU_t *ru) { if (ru->is_slave == 1) { generate_ul_ref_sigs_rx(); } + else generate_ul_ref_sigs(); if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals // Time-domain signals @@ -135,14 +137,14 @@ int phy_init_RU(RU_t *ru) { } } - AssertFatal(RC.nb_L1_inst <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n", - RC.nb_L1_inst,NUMBER_OF_eNB_MAX); - LOG_D(PHY,"[INIT] %s() RC.nb_L1_inst:%d \n", __FUNCTION__, RC.nb_L1_inst); + AssertFatal(ru->num_eNB <= NUMBER_OF_eNB_MAX,"eNB instances %d > %d\n", + ru->num_eNB,NUMBER_OF_eNB_MAX); + LOG_D(PHY,"[INIT] %s() ru->num_eNB:%d \n", __FUNCTION__, ru->num_eNB); int starting_antenna_index=0; for (i=0; iidx; i++) starting_antenna_index+=ru->nb_tx; - for (i=0; inum_eNB; i++) { for (p=0; p<15; p++) { LOG_D(PHY,"[INIT] %s() nb_antenna_ports_eNB:%d \n", __FUNCTION__, ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB); @@ -240,7 +242,7 @@ void phy_free_RU(RU_t *ru) { free_and_zero(ru->prach_rxsigF[0]); /* ru->prach_rxsigF_br is not allocated -> don't free */ - for (i = 0; i < RC.nb_L1_inst; i++) { + for (i = 0; i < ru->num_eNB; i++) { for (p = 0; p < 15; p++) { if (p < ru->eNB_list[i]->frame_parms.nb_antenna_ports_eNB || p == 5) { for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]); diff --git a/openair1/PHY/INIT/lte_init_ue.c b/openair1/PHY/INIT/lte_init_ue.c index 64a5992a64..b756735816 100644 --- a/openair1/PHY/INIT/lte_init_ue.c +++ b/openair1/PHY/INIT/lte_init_ue.c @@ -39,6 +39,7 @@ void init_7_5KHz(void); uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10}; +void init_sss(void); void phy_config_sib1_ue(module_id_t Mod_id,int CC_id, uint8_t eNB_id, @@ -629,6 +630,7 @@ int init_lte_ue_signal(PHY_VARS_UE *ue, init_frame_parms(&ue->frame_parms,1); lte_sync_time_init(&ue->frame_parms); init_lte_top(&ue->frame_parms); + init_sss(); init_7_5KHz(); init_ul_hopping(&ue->frame_parms); // many memory allocation sizes are hard coded diff --git a/openair1/PHY/INIT/lte_param_init.c b/openair1/PHY/INIT/lte_param_init.c index 1505ee018e..504c8fa80a 100644 --- a/openair1/PHY/INIT/lte_param_init.c +++ b/openair1/PHY/INIT/lte_param_init.c @@ -25,7 +25,6 @@ #include #include -#include "SIMULATION/TOOLS/sim.h" #include "PHY/types.h" #include "PHY/defs_eNB.h" #include "PHY/defs_UE.h" @@ -33,7 +32,9 @@ #include "phy_init.h" #include "PHY/LTE_REFSIG/lte_refsig.h" #include "PHY/LTE_TRANSPORT/transport_common_proto.h" -#include "targets/RT/USER/lte-softmodem.h" +#include "executables/softmodem-common.h" +#include "SIMULATION/TOOLS/sim.h" + extern PHY_VARS_eNB *eNB; extern PHY_VARS_UE *UE; extern RU_t *ru; diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 0e6b253c2b..f9be627974 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -110,7 +110,7 @@ int l1_north_init_gNB() { int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, - unsigned char abstraction_flag) { + unsigned char lowmem_flag) { // shortcuts NR_DL_FRAME_PARMS *const fp = &gNB->frame_parms; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; @@ -128,6 +128,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, while(gNB->configured == 0) usleep(10000); + if (lowmem_flag == 1) { + gNB->number_of_nr_dlsch_max = 2; + gNB->number_of_nr_ulsch_max = 2; + } + else { + gNB->number_of_nr_dlsch_max = NUMBER_OF_NR_DLSCH_MAX; + gNB->number_of_nr_ulsch_max = NUMBER_OF_NR_ULSCH_MAX; + } + load_dftslib(); LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_gNB][MOD %02"PRIu8"][]\n", gNB->Mod_id); @@ -142,6 +151,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n"); + gNB->bad_pucch = 0; + for (int slot=0; slotslots_per_frame; slot++) { pdcch_dmrs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *)); AssertFatal(pdcch_dmrs[slot]!=NULL, "NR init: pdcch_dmrs for slot %d - malloc failed\n", slot); @@ -231,13 +242,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, common_vars->rxdata = (int32_t **)malloc16(Prx*sizeof(int32_t*)); common_vars->txdataF = (int32_t **)malloc16(Ptx*sizeof(int32_t*)); common_vars->rxdataF = (int32_t **)malloc16(Prx*sizeof(int32_t*)); + common_vars->beam_id = (uint8_t **)malloc16(Ptx*sizeof(uint8_t*)); for (i=0;itxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP LOG_D(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n", i,common_vars->txdataF[i], fp->samples_per_frame_wCP*sizeof(int32_t)); - + common_vars->beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t)); + memset(common_vars->beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame); } for (i=0;irxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); @@ -283,7 +296,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, int N_RB_UL = cfg->carrier_config.ul_grid_size[cfg->ssb_config.scs_common.value].value; - for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) { pusch_vars[ULSCH_id] = (NR_gNB_PUSCH *)malloc16_clear( sizeof(NR_gNB_PUSCH) ); pusch_vars[ULSCH_id]->rxdataF_ext = (int32_t **)malloc16(Prx*sizeof(int32_t *) ); pusch_vars[ULSCH_id]->rxdataF_ext2 = (int32_t **)malloc16(Prx*sizeof(int32_t *) ); @@ -368,7 +381,7 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) free_and_zero(prach_vars->prach_ifft[0]); free_and_zero(prach_vars->rxsigF[0]); */ - for (int ULSCH_id=0; ULSCH_idnumber_of_nr_ulsch_max; ULSCH_id++) { for (int i = 0; i < 2; i++) { free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext[i]); free_and_zero(pusch_vars[ULSCH_id]->rxdataF_ext2[i]); @@ -474,7 +487,8 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, fp->nr_band = 261; // fp->threequarter_fs= 0; } - + + fp->threequarter_fs = 0; gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band); nr_init_frame_parms(gNB_config, fp); @@ -558,9 +572,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) { AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i); } - for (i=0; inumber_of_nr_dlsch_max; i++) { - LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,NUMBER_OF_NR_DLSCH_MAX); + LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max); for (j=0; j<2; j++) { gNB->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size); @@ -568,9 +582,9 @@ void init_nr_transport(PHY_VARS_gNB *gNB) { } } - for (i=0; inumber_of_nr_ulsch_max; i++) { - LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i); + LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max); for (j=0; j<2; j++) { // ULSCH for data diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c index 648b820f07..5ab46ccda2 100644 --- a/openair1/PHY/INIT/nr_init_ru.c +++ b/openair1/PHY/INIT/nr_init_ru.c @@ -21,9 +21,6 @@ #include "phy_init.h" #include "SCHED/sched_common.h" -#include "PHY/phy_extern.h" -#include "PHY/NR_TRANSPORT/nr_transport_proto.h" -#include "SIMULATION/TOOLS/sim.h" /*#include "RadioResourceConfigCommonSIB.h" #include "RadioResourceConfigDedicated.h" #include "TDD-Config.h" @@ -33,6 +30,10 @@ #include #include "openair1/PHY/defs_RU.h" +void init_prach_ru_list(RU_t *ru); + +extern const char ru_if_types[MAX_RU_IF_TYPES][20]; + int nr_phy_init_RU(RU_t *ru) { NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; @@ -44,7 +45,7 @@ int nr_phy_init_RU(RU_t *ru) { nfapi_nr_config_request_scf_t *cfg; ru->nb_log_antennas=0; - for (int n=0;nnum_gNB;n++) { cfg = &ru->config; if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas) ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value; } @@ -117,35 +118,41 @@ int nr_phy_init_RU(RU_t *ru) { } } - AssertFatal(RC.nb_nr_L1_inst <= NUMBER_OF_eNB_MAX,"gNB instances %d > %d\n", - RC.nb_nr_L1_inst,NUMBER_OF_gNB_MAX); + AssertFatal(ru->num_gNB <= NUMBER_OF_gNB_MAX,"gNB instances %d > %d\n", + ru->num_gNB,NUMBER_OF_gNB_MAX); - LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst); + LOG_E(PHY,"[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB); int beam_count = 0; if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1 for (p=0;pnb_log_antennas;p++) { - if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0 + //if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0 beam_count++; } AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx)); int l_ind = 0; - for (i=0; inum_gNB; i++) { for (p=0;pnb_log_antennas;p++) { - if ((fp->L_ssb >> (63-p)) & 0x01) { + //if ((fp->L_ssb >> (63-p)) & 0x01) { ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); for (j=0; jnb_tx; j++) { ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t)); for (re=0; reofdm_symbol_size; re++) - ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind]; + ru->beam_weights[i][p][j][re] = ru->bw_list[j][l_ind]; //printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j); l_ind++; } // for j - } // for p - } + //} + } // for p } //for i } + + ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*)); + for(i=0; i< ru->nb_tx; ++i) { + ru->common.beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t)); + memset(ru->common.beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame); + } } // !=IF5 ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_subframe_wCP ); @@ -193,8 +200,7 @@ void nr_phy_free_RU(RU_t *ru) free_and_zero(ru->prach_rxsigF[j][i]); } } - - for (i = 0; i < RC.nb_nr_L1_inst; i++) { + for (i = 0; i < ru->num_gNB; i++) { for (p = 0; p < 15; p++) { for (j=0; jnb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]); free_and_zero(ru->beam_weights[i][p]); diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index 3132fb9960..a9c71d1582 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -28,6 +28,7 @@ #include "TDD-Config.h" #include "MBSFN-SubframeConfigList.h"*/ #include "openair1/PHY/defs_RU.h" +#include "openair1/PHY/impl_defs_nr.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "assertions.h" #include @@ -71,33 +72,39 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, pdsch->llr128 = (int16_t **)malloc16_clear( sizeof(int16_t *) ); // FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV // FK, 11-3-2015: this is only as a temporary pointer, no memory is stored there - pdsch->rxdataF_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->rxdataF_uespec_pilots = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->rxdataF_comp0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); - pdsch->dl_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); + pdsch->rxdataF_ext = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->rxdataF_uespec_pilots = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->rxdataF_comp0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->rho = (int32_t ***)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t **) ); + pdsch->dl_ch_estimates = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); //pdsch->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); //pdsch->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) ); - pdsch->dl_ch_mag0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_ch_magr0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->ptrs_phase_per_slot = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->ptrs_re_per_slot = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); - pdsch->dl_ch_ptrs_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) ); + pdsch->dl_ch_mag0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_ch_magr0 = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->ptrs_phase_per_slot = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->ptrs_re_per_slot = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); + pdsch->dl_ch_ptrs_estimates_ext = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) ); // the allocated memory size is fixed: - AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" ); + AssertFatal( fp->nb_antennas_rx <= 4, "nb_antennas_rx > 4" );//Extend the max number of UE Rx antennas to 4 + const size_t num = 7*2*fp->N_RB_DL*12; for (int i=0; inb_antennas_rx; i++) { - pdsch->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) ); + pdsch->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); + pdsch->rxdataF_uespec_pilots[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12); + pdsch->ptrs_phase_per_slot[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14 ); + pdsch->ptrs_re_per_slot[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14); + pdsch->dl_ch_ptrs_estimates_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t) * num); + pdsch->rho[i] = (int32_t **)malloc16_clear( NR_MAX_NB_LAYERS*NR_MAX_NB_LAYERS*sizeof(int32_t *) ); - for (int j=0; j<4; j++) { //fp->nb_antennas_tx; j++) - const int idx = (j<<1)+i; - const size_t num = 7*2*fp->N_RB_DL*12; - pdsch->rxdataF_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); - pdsch->rxdataF_uespec_pilots[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12); + for (int j=0; jnb_antennas_rx)+i; + for (int k=0; krho[i][j*NR_MAX_NB_LAYERS+k] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); + } pdsch->rxdataF_comp0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->ofdm_symbol_size*7*2); pdsch->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); @@ -108,9 +115,6 @@ void phy_init_nr_ue__PDSCH(NR_UE_PDSCH *const pdsch, pdsch->dl_ch_mag0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_magb0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); pdsch->dl_ch_magr0[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); - pdsch->ptrs_re_per_slot[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * 14); - pdsch->ptrs_phase_per_slot[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * 14 ); - pdsch->dl_ch_ptrs_estimates_ext[idx]= (int32_t *)malloc16_clear( sizeof(int32_t) * num); } } } @@ -139,16 +143,14 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, uint16_t N_n_scid[2] = {0,1}; // [HOTFIX] This is a temporary implementation of scramblingID0 and scramblingID1 which are given by DMRS-UplinkConfig int n_scid; abstraction_flag = 0; - fp->nb_antennas_tx = 1; - fp->nb_antennas_rx=1; // dmrs_UplinkConfig_t *dmrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig; // ptrs_UplinkConfig_t *ptrs_Uplink_Config = &ue->pusch_config.dmrs_UplinkConfig.ptrs_UplinkConfig; LOG_I(PHY, "Initializing UE vars (abstraction %u) for gNB TXant %u, UE RXant %u\n", abstraction_flag, fp->nb_antennas_tx, fp->nb_antennas_rx); - //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST); + //LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_gNB_INST); phy_init_nr_top(ue); // many memory allocation sizes are hard coded - AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" ); - AssertFatal(nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" ); + AssertFatal( fp->nb_antennas_rx <= 4, "hard coded allocation for ue_common_vars->dl_ch_estimates[gNB_id]" ); + AssertFatal( nb_connected_gNB <= NUMBER_OF_CONNECTED_gNB_MAX, "n_connected_gNB is too large" ); // init phy_vars_ue for (i=0; i<4; i++) { @@ -195,7 +197,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } for (i=0;iPDSCH_Config.pdsch_TimeDomainResourceAllocation[i] = (NR_PDSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(NR_PDSCH_TimeDomainResourceAllocation_t)); + ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[i] = (PDSCH_TimeDomainResourceAllocation_t *)malloc16(sizeof(PDSCH_TimeDomainResourceAllocation_t)); ue->PDSCH_Config.pdsch_TimeDomainResourceAllocation[i]->mappingType = typeA; } @@ -276,7 +278,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } } - //PDCCH DMRS init (eNB offset = 0) + //PDCCH DMRS init (gNB offset = 0) ue->nr_gold_pdcch[0] = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); uint32_t ***pdcch_dmrs = ue->nr_gold_pdcch[0]; AssertFatal(pdcch_dmrs!=NULL, "NR init: pdcch_dmrs malloc failed\n"); @@ -291,6 +293,9 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } } + ue->scramblingID_pdcch = fp->Nid_cell; + nr_gold_pdcch(ue,fp->Nid_cell); + //PDSCH DMRS init (eNB offset = 0) ue->nr_gold_pdsch[0] = (uint32_t ****)malloc16(fp->slots_per_frame*sizeof(uint32_t ***)); uint32_t ****pdsch_dmrs = ue->nr_gold_pdsch[0]; @@ -310,6 +315,12 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } } + // initializing the scrambling IDs for PDSCH DMRS + for (int i=0; i<2; i++) + ue->scramblingID[i]=fp->Nid_cell; + + nr_gold_pdsch(ue,ue->scramblingID); + // DLSCH for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) { for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12); - ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts; - ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t)); - ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear((8*(3*8*8448))*sizeof(int16_t)); - ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear(sizeof(int16_t *)); - ue->pdsch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16_clear(fp->nb_antennas_rx*sizeof(int32_t *)); + ue->pdsch_vars[th_id][gNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12); + ue->pdsch_vars[th_id][gNB_id]->llr_shifts_p = ue->pdsch_vars[0][gNB_id]->llr_shifts; + ue->pdsch_vars[th_id][gNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) ); + ue->pdsch_vars[th_id][gNB_id]->layer_llr[1] = (int16_t *)malloc16_clear( (8*(3*8*8448))*sizeof(int16_t) ); + ue->pdsch_vars[th_id][gNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) ); } - for (int i=0; inb_antennas_rx; i++) { - for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12)); - } - } for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); } for (i=0; inb_antennas_rx; i++) for (j=0; j<4; j++) { - const int idx = (j<<1)+i; + const int idx = (j*fp->nb_antennas_rx)+i; const size_t num = 7*2*fp->N_RB_DL*12+4; for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho2_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num ); } } @@ -361,15 +366,15 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, for (k=0; k<8; k++) { //harq_pid for (l=0; l<8; l++) { //round for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); + ue->pdsch_vars[th_id][gNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdsch_vars[th_id][gNB_id]->dl_ch_magb1[k][l] = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); } for (int i=0; inb_antennas_rx; i++) for (int j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++) - const int idx = (j<<1)+i; + const int idx = (j*fp->nb_antennas_rx)+i; for (th_id=0; th_idpdsch_vars[th_id][gNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear(7*2*sizeof(int32_t)*(fp->N_RB_DL*12)); @@ -383,26 +388,26 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, // 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE for (th_id=0; th_idpdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t)); - ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t)); - ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear(2*4*100*12*sizeof(uint16_t)); - ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear(4*2*100*12 ); - ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); + ue->pdcch_vars[th_id][gNB_id]->llr = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); + ue->pdcch_vars[th_id][gNB_id]->llr16 = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); + ue->pdcch_vars[th_id][gNB_id]->wbar = (int16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) ); + ue->pdcch_vars[th_id][gNB_id]->e_rx = (int16_t *)malloc16_clear( 4*2*100*12 ); + ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdcch_vars[th_id][gNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdcch_vars[th_id][gNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); // Channel estimates - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *)); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(4*fp->nb_antennas_rx*sizeof(int32_t *)); for (i=0; inb_antennas_rx; i++) { ue->pdcch_vars[th_id][gNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4)); for (j=0; j<4; j++) { - int idx = (j<<1) + i; - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)); - ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*fp->ofdm_symbol_size*2); + int idx = (j*fp->nb_antennas_rx)+i; + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_slot*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) ); + ue->pdcch_vars[th_id][gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 ); // size_t num = 7*2*fp->N_RB_DL*12; size_t num = 4*273*12; // 4 symbols, 100 PRBs, 12 REs per PRB ue->pdcch_vars[th_id][gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t) * num); @@ -414,24 +419,24 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, } // PBCH - pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16(fp->nb_antennas_rx*sizeof(int32_t *)); - pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear(8*sizeof(int32_t *)); - pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear(1920); // - prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12))); - prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear(sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12))); + pbch_vars[gNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->dl_ch_estimates = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->dl_ch_estimates_time = (int32_t **)malloc16_clear( 4*fp->nb_antennas_rx*sizeof(int32_t *) ); + pbch_vars[gNB_id]->llr = (int16_t *)malloc16_clear( 1920 ); // + prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); + prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) ); for (i=0; inb_antennas_rx; i++) { pbch_vars[gNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 ); for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) { - int idx = (j<<1)+i; - pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4); - pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size)); - pbch_vars[gNB_id]->dl_ch_estimates_time[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size)); - pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear(sizeof(int32_t)*20*12*4); + int idx = (j*fp->nb_antennas_rx)+i; + pbch_vars[gNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 ); + pbch_vars[gNB_id]->dl_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) ); + pbch_vars[gNB_id]->dl_ch_estimates_time[idx]= (int32_t *)malloc16_clear( sizeof(int32_t)*7*2*sizeof(int)*(fp->ofdm_symbol_size) ); + pbch_vars[gNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*20*12*4 ); } } } diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index bacc671adc..34938501e3 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -27,12 +27,9 @@ uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3}; uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16}; -int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp) -{ +int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb) { int mu = fp->numerology_index; - uint8_t half_frame_index = fp->half_frame_bit; - uint8_t i_ssb = fp->ssb_index; int symbol = 0; uint8_t n, n_temp; nr_ssb_type_e type = fp->ssb_type; @@ -69,9 +66,6 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp) AssertFatal(0==1, "Invalid numerology index %d for the synchronization block\n", mu); } - if (half_frame_index) - symbol += (5 * fp->symbols_per_slot * fp->slots_per_subframe); - return symbol; } @@ -204,9 +198,9 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, fp->slots_per_frame = 10* fp->slots_per_subframe; - fp->nb_antenna_ports_gNB = cfg->carrier_config.num_tx_ant.value;// It corresponds to pdsch_AntennaPorts + fp->nb_antenna_ports_gNB = 1; // It corresponds to the number of common antenna ports fp->nb_antennas_rx = cfg->carrier_config.num_rx_ant.value; // It denotes the number of rx antennas at gNB - fp->nb_antennas_tx = 1; // It corresponds to the number of UE Tx antennas + fp->nb_antennas_tx = cfg->carrier_config.num_tx_ant.value; // It corresponds to pdsch_AntennaPorts fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats fp->samples_per_subframe_wCP = fp->ofdm_symbol_size * fp->symbols_per_slot * fp->slots_per_subframe; @@ -254,6 +248,11 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, uint8_t Nid_cell = 0; int Ncp = NORMAL; + if(fp->nb_antennas_rx == 0) + fp->nb_antennas_rx = 1; + if(fp->nb_antennas_tx == 0) + fp->nb_antennas_tx = 1; + // default values until overwritten by RRCConnectionReconfiguration fp->nb_antenna_ports_gNB = nb_ant_ports_gNB; fp->tdd_config = tdd_cfg; diff --git a/openair1/PHY/INIT/phy_init.h b/openair1/PHY/INIT/phy_init.h index 9c474264c8..2ab610739d 100644 --- a/openair1/PHY/INIT/phy_init.h +++ b/openair1/PHY/INIT/phy_init.h @@ -392,14 +392,14 @@ void phy_config_update_sib13_request(PHY_Config_t *phy_config); int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf); void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms); -int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp); +int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb); int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band); int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag); void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag); void init_N_TA_offset(PHY_VARS_NR_UE *ue); void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms); -int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char abstraction_flag); +int phy_init_nr_gNB(PHY_VARS_gNB *gNB, unsigned char is_secondary_gNB, unsigned char lowmem_flag); void nr_phy_config_request(NR_PHY_Config_t *gNB); void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst); void phy_free_nr_gNB(PHY_VARS_gNB *gNB); @@ -408,6 +408,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB); void init_dfts(void); +void fill_subframe_mask(PHY_VARS_eNB *eNB); /** @} */ #endif diff --git a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c index 3fd58a4989..6d382bdd63 100644 --- a/openair1/PHY/LTE_ESTIMATION/freq_equalization.c +++ b/openair1/PHY/LTE_ESTIMATION/freq_equalization.c @@ -20,11 +20,11 @@ */ #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" #include "PHY/sse_intrin.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" -// This is 512/(1:256) in __m128i format -int16_t inv_ch[256*8] = {512,512,512,512,512,512,512,512, +// This is 4096/(1:4096) in __m128i format +__m128i inv_ch[4096];/* = {512,512,512,512,512,512,512,512, 256,256,256,256,256,256,256,256, 170,170,170,170,170,170,170,170, 128,128,128,128,128,128,128,128, @@ -280,7 +280,11 @@ int16_t inv_ch[256*8] = {512,512,512,512,512,512,512,512, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, 2,2,2,2,2,2,2,2, - }; + };*/ + +void init_fde() { + for (int i=1;i<4096;i++) inv_ch[i] = _mm_set1_epi16(4096/i); +} void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms, int32_t **rxdataF_comp, @@ -313,12 +317,12 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms, amp=(*((int16_t*)&ul_ch_mag128[re])); - if (amp>255) - amp=255; + if (amp>4095) + amp=4095; - // printf("freq_eq: symbol %d re %d => %d,%d,%d, (%d) (%d,%d) => ",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,inv_ch[8*amp],*((int16_t*)(&ul_ch_mag128[re]))*inv_ch[8*amp],*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re]))); + //printf("freq_eq: symbol %d re %d => mag %d,amp %d,inv %d, prod %d (%d,%d)\n",symbol,re,*((int16_t*)(&ul_ch_mag128[re])),amp,_mm_extract_epi16(inv_ch[amp],0),(*((int16_t*)(&ul_ch_mag128[re]))*_mm_extract_epi16(inv_ch[amp],0))>>3,*(int16_t*)&(rxdataF_comp128[re]),*(1+(int16_t*)&(rxdataF_comp128[re]))); #if defined(__x86_64__) || defined(__i386__) - rxdataF_comp128[re] = _mm_mullo_epi16(rxdataF_comp128[re],*((__m128i *)&inv_ch[8*amp])); + rxdataF_comp128[re] = _mm_srai_epi16(_mm_mullo_epi16(rxdataF_comp128[re],inv_ch[amp]),3); if (Qm==4) ul_ch_mag128[re] = _mm_set1_epi16(324); // this is 512*2/sqrt(10) @@ -327,7 +331,7 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms, ul_ch_magb128[re] = _mm_set1_epi16(158); // this is 512*2/sqrt(42) } #elif defined(__arm__) - rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],*((int16x8_t *)&inv_ch[8*amp])); + rxdataF_comp128[re] = vmulq_s16(rxdataF_comp128[re],inv_ch[amp]); if (Qm==4) ul_ch_mag128[re] = vdupq_n_s16(324); // this is 512*2/sqrt(10) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c index f85162e095..aac8e71828 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_adjust_sync_eNB.c @@ -21,7 +21,6 @@ #include "PHY/types.h" #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" #include "common/utils/LOG/vcd_signal_dumper.h" @@ -118,12 +117,12 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms, int temp, i, aa, max_pos=0, max_val=0; short Re,Im; - uint8_t cyclic_shift = 0; - int sync_pos = (frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size); + // uint8_t cyclic_shift = 0; + int sync_pos = 0;//(frame_parms->ofdm_symbol_size-cyclic_shift*frame_parms->ofdm_symbol_size/12)%(frame_parms->ofdm_symbol_size); AssertFatal(frame_parms->ofdm_symbol_size > 127,"frame_parms->ofdm_symbol_size %d<128\n",frame_parms->ofdm_symbol_size); - AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<3,"frame_parms->nb_antennas_rx %d not in [0,1]\n", - frame_parms->nb_antennas_rx); + AssertFatal(frame_parms->nb_antennas_rx >0 && frame_parms->nb_antennas_rx<=4,"frame_parms->nb_antennas_rx %d not in [1...%d]\n", + frame_parms->nb_antennas_rx,4); for (i = 0; i < frame_parms->ofdm_symbol_size; i++) { temp = 0; @@ -142,9 +141,5 @@ int lte_est_timing_advance_pusch(LTE_DL_FRAME_PARMS *frame_parms, if (max_pos>frame_parms->ofdm_symbol_size/2) max_pos = max_pos-frame_parms->ofdm_symbol_size; - //#ifdef DEBUG_PHY - LOG_D(PHY,"max_pos = %d, sync_pos=%d\n",max_pos,sync_pos); - //#endif //DEBUG_PHY - return max_pos - sync_pos; } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c index 2d79158920..7eeeb998ba 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c @@ -32,6 +32,30 @@ int32_t rx_power_avg_eNB[3]; +void dump_I0_stats(FILE *fd,PHY_VARS_eNB *eNB) { + + + int min_I0=1000,max_I0=0; + int amin=0,amax=0; + for (int i=0; iframe_parms.N_RB_UL; i++) { + if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2; + + if (eNB->measurements.n0_subband_power_tot_dB[i]measurements.n0_subband_power_tot_dB[i]; amin=i;} + + if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amax=i;} + } + + for (int i=0; iframe_parms.N_RB_UL; i++) { + fprintf(fd,"%2d.",eNB->measurements.n0_subband_power_tot_dB[i]-eNB->measurements.n0_subband_power_avg_dB); + if (i%25 == 24) fprintf(fd,"\n"); + } + + fprintf(fd,"\nmax_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, eNB->measurements.n0_subband_power_avg_dB); + + fprintf(fd,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10); + + +} void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB, int subframe, module_id_t eNB_id, @@ -87,46 +111,45 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB, nb_rb++; for (aarx=0; aarxnb_antennas_rx; aarx++) { measurements->n0_subband_power[aarx][rb] = 0; - for (int s=0;s<14-(frame_parms->Ncp<<1);s++) { - // select the 7th symbol in an uplink subframe - offset = offset0 + (s*frame_parms->ofdm_symbol_size); - ul_ch = &common_vars->rxdataF[aarx][offset]; - len = 12; + for (int s=0;s<(14-(frame_parms->Ncp<<1));s++) { + offset = offset0 + (s*frame_parms->ofdm_symbol_size); + ul_ch = &common_vars->rxdataF[aarx][offset]; + len = 12; // just do first half of middle PRB for odd number of PRBs - if (((frame_parms->N_RB_UL&1) == 1) && - (rb==(frame_parms->N_RB_UL>>1))) { - len=6; - } + if (((frame_parms->N_RB_UL&1) == 1) && + (rb==(frame_parms->N_RB_UL>>1))) { + len=6; + } - AssertFatal(ul_ch, "RX signal buffer (freq) problem"); + AssertFatal(ul_ch, "RX signal buffer (freq) problem"); - measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len); + measurements->n0_subband_power[aarx][rb] += signal_energy_nodc(ul_ch,len); - } + } // symbol measurements->n0_subband_power[aarx][rb]/=(14-(frame_parms->Ncp<<1)); measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]); n0_power_tot += measurements->n0_subband_power[aarx][rb]; - } + } //antenna n0_power_tot/=frame_parms->nb_antennas_rx; n0_power_tot2 += n0_power_tot; - measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot/frame_parms->nb_antennas_rx); + measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_power_tot); measurements->n0_subband_power_tot_dBm[rb] = measurements->n0_subband_power_tot_dB[rb] - eNB->rx_total_gain_dB - dB_fixed(frame_parms->N_RB_UL); - } - } + } //rb not used in subframe + } //rb if (nb_rb>0) measurements->n0_subband_power_avg_dB = dB_fixed(n0_power_tot2/nb_rb); } void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB, module_id_t eNB_id, - module_id_t UE_id, + module_id_t srs_id, unsigned char init_averaging) { LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; PHY_MEASUREMENTS_eNB *measurements = &eNB->measurements; - LTE_eNB_SRS *srs_vars = &eNB->srs_vars[UE_id]; + LTE_eNB_SRS *srs_vars = &eNB->srs_vars[srs_id]; int32_t aarx,rx_power_correction; int32_t rx_power; @@ -136,7 +159,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB, //printf("Running eNB_srs_measurements for eNB_id %d\n",eNB_id); if (init_averaging == 1) - rx_power_avg_eNB[UE_id] = 0; + rx_power_avg_eNB[srs_id] = 0; rx_power = 0; @@ -152,24 +175,24 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB, for (aarx=0; aarxnb_antennas_rx; aarx++) { - measurements->rx_spatial_power[UE_id][0][aarx] = + measurements->rx_spatial_power[srs_id][0][aarx] = ((signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][frame_parms->first_carrier_offset], (frame_parms->N_RB_DL*6)) + signal_energy_nodc(&srs_vars->srs_ch_estimates[aarx][1], (frame_parms->N_RB_DL*6)))*rx_power_correction) - measurements->n0_power[aarx]; - measurements->rx_spatial_power[UE_id][0][aarx]<<=1; // because of noise only in odd samples + measurements->rx_spatial_power[srs_id][0][aarx]<<=1; // because of noise only in odd samples - measurements->rx_spatial_power_dB[UE_id][0][aarx] = (unsigned short) dB_fixed(measurements->rx_spatial_power[UE_id][0][aarx]); + measurements->rx_spatial_power_dB[srs_id][0][aarx] = (unsigned short) dB_fixed(measurements->rx_spatial_power[srs_id][0][aarx]); - measurements->wideband_cqi[UE_id][aarx] = measurements->rx_spatial_power[UE_id][0][aarx]; + measurements->wideband_cqi[srs_id][aarx] = measurements->rx_spatial_power[srs_id][0][aarx]; // measurements->rx_power[UE_id][aarx]/=frame_parms->nb_antennas_tx; - measurements->wideband_cqi_dB[UE_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[UE_id][aarx]); - rx_power += measurements->wideband_cqi[UE_id][aarx]; + measurements->wideband_cqi_dB[srs_id][aarx] = (unsigned short) dB_fixed(measurements->wideband_cqi[srs_id][aarx]); + rx_power += measurements->wideband_cqi[srs_id][aarx]; // measurements->rx_avg_power_dB[UE_id] += measurements->rx_power_dB[UE_id][aarx]; } @@ -177,14 +200,14 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB, // measurements->rx_avg_power_dB[UE_id]/=frame_parms->nb_antennas_rx; if (init_averaging == 0) - rx_power_avg_eNB[UE_id] = ((k1*rx_power_avg_eNB[UE_id]) + (k2*rx_power))>>10; + rx_power_avg_eNB[srs_id] = ((k1*rx_power_avg_eNB[srs_id]) + (k2*rx_power))>>10; else - rx_power_avg_eNB[UE_id] = rx_power; + rx_power_avg_eNB[srs_id] = rx_power; - measurements->wideband_cqi_tot[UE_id] = dB_fixed2(rx_power,2*measurements->n0_power_tot); + measurements->wideband_cqi_tot[srs_id] = dB_fixed2(rx_power,2*measurements->n0_power_tot); // times 2 since we have noise only in the odd carriers of the srs comb - measurements->rx_rssi_dBm[UE_id] = (int32_t)dB_fixed(rx_power_avg_eNB[UE_id])-eNB->rx_total_gain_dB; + measurements->rx_rssi_dBm[srs_id] = (int32_t)dB_fixed(rx_power_avg_eNB[srs_id])-eNB->rx_total_gain_dB; @@ -200,21 +223,21 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB, else if (rb>12) ul_ch = &srs_vars->srs_ch_estimates[aarx][6 + (rb-13)*12]; else { - measurements->subband_cqi_dB[UE_id][aarx][rb] = 0; + measurements->subband_cqi_dB[srs_id][aarx][rb] = 0; continue; } // cqi if (aarx==0) - measurements->subband_cqi_tot[UE_id][rb]=0; + measurements->subband_cqi_tot[srs_id][rb]=0; - measurements->subband_cqi[UE_id][aarx][rb] = (signal_energy_nodc(ul_ch,12))*rx_power_correction - measurements->n0_power[aarx]; + measurements->subband_cqi[srs_id][aarx][rb] = (signal_energy_nodc(ul_ch,12))*rx_power_correction - measurements->n0_power[aarx]; - if (measurements->subband_cqi[UE_id][aarx][rb] < 0) - measurements->subband_cqi[UE_id][aarx][rb]=0; + if (measurements->subband_cqi[srs_id][aarx][rb] < 0) + measurements->subband_cqi[srs_id][aarx][rb]=0; - measurements->subband_cqi_tot[UE_id][rb] += measurements->subband_cqi[UE_id][aarx][rb]; - measurements->subband_cqi_dB[UE_id][aarx][rb] = dB_fixed2(measurements->subband_cqi[UE_id][aarx][rb], + measurements->subband_cqi_tot[srs_id][rb] += measurements->subband_cqi[srs_id][aarx][rb]; + measurements->subband_cqi_dB[srs_id][aarx][rb] = dB_fixed2(measurements->subband_cqi[srs_id][aarx][rb], 2*measurements->n0_power[aarx]); // 2*n0_power since we have noise from the odd carriers in the comb of the srs @@ -225,7 +248,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB, for (rb=0; rbN_RB_DL; rb++) { - measurements->subband_cqi_tot_dB[UE_id][rb] = dB_fixed2(measurements->subband_cqi_tot[UE_id][rb], + measurements->subband_cqi_tot_dB[srs_id][rb] = dB_fixed2(measurements->subband_cqi_tot[srs_id][rb], measurements->n0_power_tot); /* if (measurements->subband_cqi_tot_dB[UE_id][rb] == 65) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h index fc40280853..6ba901e29f 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_estimation.h +++ b/openair1/PHY/LTE_ESTIMATION/lte_estimation.h @@ -288,6 +288,8 @@ void freq_equalization(LTE_DL_FRAME_PARMS *frame_parms, unsigned short Msc_RS, unsigned char Qm); +void init_fde(void); +void dump_I0_stats(FILE *fd,PHY_VARS_eNB *eNB); /** @} */ #endif diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c index 0d765a18b3..1fbc8b7ef2 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c @@ -27,276 +27,89 @@ //#include #include -#include "LAYER2/MAC/mac.h" #include "PHY/defs_UE.h" #include "PHY/phy_extern_ue.h" -#include "PHY_INTERFACE/phy_interface.h" #include "PHY/LTE_REFSIG/lte_refsig.h" -#include "RRC/LTE/rrc_extern.h" // Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs) #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" -int* sync_corr_ue0 = NULL; -int* sync_corr_ue1 = NULL; -int* sync_corr_ue2 = NULL; -int sync_tmp[2048*4] __attribute__((aligned(32))); -short syncF_tmp[2048*2] __attribute__((aligned(32))); +static struct complex16 *primary_synch0_time __attribute__((aligned(32))); +static struct complex16 *primary_synch1_time __attribute__((aligned(32))); +static struct complex16 *primary_synch2_time __attribute__((aligned(32))); +static void doIdft(int size, short *in, short *out) { + switch (size) { + case 6: + idft(IDFT_128,in,out,1); + break; -int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *common_vars -{ - int i,k; + case 25: + idft(IDFT_512,in,out,1); + break; - sync_corr_ue0 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti); - sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti); - sync_corr_ue2 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti); + case 50: + idft(IDFT_1024,in,out,1); + break; + + case 75: + idft(IDFT_1536,in,out,1); + break; - if (sync_corr_ue0) { -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue0); -#endif - //common_vars->sync_corr = sync_corr; - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue0 not allocated\n"); - return(-1); + case 100: + idft(IDFT_2048,in,out,1); + break; + + default: + LOG_E(PHY,"Unsupported N_RB_DL %d\n",size); + abort(); + break; + } } - if (sync_corr_ue1) { -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue1); -#endif - //common_vars->sync_corr = sync_corr; - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue1 not allocated\n"); - return(-1); +static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSize) { + int k=ofdmSize-36; + + for (int i=0; i<72; i++) { + out[k].r = in[i].r>>1; //we need to shift input to avoid overflow in fft + out[k].i = in[i].i>>1; + k++; + + if (k >= ofdmSize) { + k++; // skip DC carrier + k-=ofdmSize; + } + } } - if (sync_corr_ue2) { -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue allocated at %p\n", sync_corr_ue2); -#endif - //common_vars->sync_corr = sync_corr; - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] sync_corr_ue2 not allocated\n"); - return(-1); - } - - // primary_synch0_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - primary_synch0_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); - - if (primary_synch0_time) { - // bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - bzero(primary_synch0_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time allocated at %p\n", primary_synch0_time); -#endif - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch0_time not allocated\n"); - return(-1); - } - - // primary_synch1_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - primary_synch1_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); - - if (primary_synch1_time) { - // bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - bzero(primary_synch1_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time allocated at %p\n", primary_synch1_time); -#endif - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch1_time not allocated\n"); - return(-1); - } - - // primary_synch2_time = (int *)malloc16((frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - primary_synch2_time = (int16_t *)malloc16((frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); - - if (primary_synch2_time) { - // bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*sizeof(int)); - bzero(primary_synch2_time,(frame_parms->ofdm_symbol_size)*sizeof(int16_t)*2); -#ifdef DEBUG_PHY - LOG_D(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time allocated at %p\n", primary_synch2_time); -#endif - } else { - LOG_E(PHY,"[openair][LTE_PHY][SYNC] primary_synch2_time not allocated\n"); - return(-1); - } - - +int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars + struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {{0}}; + int sz=frame_parms->ofdm_symbol_size*sizeof(*primary_synch0_time); + AssertFatal( NULL != (primary_synch0_time = (struct complex16 *)malloc16(sz)),""); + bzero(primary_synch0_time,sz); + AssertFatal( NULL != (primary_synch1_time = (struct complex16 *)malloc16(sz)),""); + bzero(primary_synch1_time,sz); + AssertFatal( NULL != (primary_synch2_time = (struct complex16 *)malloc16(sz)),""); + bzero(primary_synch2_time,sz); // generate oversampled sync_time sequences - k=frame_parms->ofdm_symbol_size-36; - - for (i=0; i<72; i++) { - syncF_tmp[2*k] = primary_synch0[2*i]>>2; //we need to shift input to avoid overflow in fft - syncF_tmp[2*k+1] = primary_synch0[2*i+1]>>2; - k++; - - if (k >= frame_parms->ofdm_symbol_size) { - k++; // skip DC carrier - k-=frame_parms->ofdm_symbol_size; - } - } - - switch (frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, - 1); /// complex output - break; - case 100: - idft(IDFT_2048,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL); - break; - } - - for (i=0; iofdm_symbol_size; i++) - ((int32_t*)primary_synch0_time)[i] = sync_tmp[i]; - - k=frame_parms->ofdm_symbol_size-36; - - for (i=0; i<72; i++) { - syncF_tmp[2*k] = primary_synch1[2*i]>>2; //we need to shift input to avoid overflow in fft - syncF_tmp[2*k+1] = primary_synch1[2*i+1]>>2; - k++; - - if (k >= frame_parms->ofdm_symbol_size) { - k++; // skip DC carrier - k-=frame_parms->ofdm_symbol_size; - } - } - - switch (frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 100: - idft(IDFT_2048,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL); - break; - } - - for (i=0; iofdm_symbol_size; i++) - ((int32_t*)primary_synch1_time)[i] = sync_tmp[i]; - - k=frame_parms->ofdm_symbol_size-36; - - for (i=0; i<72; i++) { - syncF_tmp[2*k] = primary_synch2[2*i]>>2; //we need to shift input to avoid overflow in fft - syncF_tmp[2*k+1] = primary_synch2[2*i+1]>>2; - k++; - - if (k >= frame_parms->ofdm_symbol_size) { - k++; // skip DC carrier - k-=frame_parms->ofdm_symbol_size; - } - } - - switch (frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - case 100: - idft(IDFT_2048,(short*)syncF_tmp, /// complex input - (short*)sync_tmp, /// complex output - 1); - break; - default: - LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL); - break; - } - - for (i=0; iofdm_symbol_size; i++) - ((int32_t*)primary_synch2_time)[i] = sync_tmp[i]; - + copyPrimary( syncF_tmp, (struct complex16 *) primary_synch0, frame_parms->ofdm_symbol_size); + doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch0_time); + copyPrimary( syncF_tmp, (struct complex16 *) primary_synch1, frame_parms->ofdm_symbol_size); + doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch1_time); + copyPrimary( syncF_tmp, (struct complex16 *) primary_synch2, frame_parms->ofdm_symbol_size); + doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch2_time); if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){ LOG_M("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1); LOG_M("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1); LOG_M("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1); } + return (1); } -void lte_sync_time_free(void) -{ - if (sync_corr_ue0) { - LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue0); - free(sync_corr_ue0); - } - - if (sync_corr_ue1) { - LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue1); - free(sync_corr_ue1); - } - - if (sync_corr_ue2) { - LOG_D(PHY,"Freeing sync_corr_ue (%p)...\n",sync_corr_ue2); - free(sync_corr_ue2); - } - +void lte_sync_time_free(void) { if (primary_synch0_time) { LOG_D(PHY,"Freeing primary_sync0_time ...\n"); free(primary_synch0_time); @@ -312,126 +125,81 @@ void lte_sync_time_free(void) free(primary_synch2_time); } - sync_corr_ue0 = NULL; - sync_corr_ue1 = NULL; - sync_corr_ue2 = NULL; primary_synch0_time = NULL; primary_synch1_time = NULL; primary_synch2_time = NULL; } -static inline int abs32(int x) -{ +static inline int abs32(int x) { return (((int)((short*)&x)[0])*((int)((short*)&x)[0]) + ((int)((short*)&x)[1])*((int)((short*)&x)[1])); } +static inline double absF(struct complexd x) { + return x.r*x.r+x.i*x.i; +} + +#define complexNull(c) bzero((void*) &(c), sizeof(c)) #define SHIFT 17 int lte_sync_time(int **rxdata, ///rx data in time domain LTE_DL_FRAME_PARMS *frame_parms, - int *eNB_id) -{ + int *eNB_id) { // perform a time domain correlation using the oversampled sync sequence - unsigned int n, ar, s, peak_pos, peak_val, sync_source; int result,result2; - int sync_out[3] = {0,0,0},sync_out2[3] = {0,0,0}; - int tmp[3] = {0,0,0}; + struct complexd sync_out[3]= {{0}}, sync_out2[3]= {{0}}; int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti>>1; - - //LOG_D(PHY,"[SYNC TIME] Calling sync_time.\n"); - AssertFatal(sync_corr_ue0 != NULL, - "sync_corr_ue0 not yet allocated! Exiting.\n"); - AssertFatal(sync_corr_ue1 != NULL, - "sync_corr_ue0 not yet allocated! Exiting.\n"); - AssertFatal(sync_corr_ue2 != NULL, - "sync_corr_ue0 not yet allocated! Exiting.\n"); - peak_val = 0; peak_pos = 0; sync_source = 0; - for (n=0; nofdm_symbol_size-frame_parms->nb_prefix_samples)) { if (n<(length-frame_parms->ofdm_symbol_size)) { - //calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; for (ar=0; arnb_antennas_rx; ar++) { - - result = dot_product((short*)primary_synch0_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); - result2 = dot_product((short*)primary_synch0_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); - - ((short*)sync_corr_ue0)[2*n] += ((short*) &result)[0]; - ((short*)sync_corr_ue0)[2*n+1] += ((short*) &result)[1]; - ((short*)sync_corr_ue0)[2*(length+n)] += ((short*) &result2)[0]; - ((short*)sync_corr_ue0)[(2*(length+n))+1] += ((short*) &result2)[1]; - ((short*)sync_out)[0] += ((short*) &result)[0]; - ((short*)sync_out)[1] += ((short*) &result)[1]; - ((short*)sync_out2)[0] += ((short*) &result2)[0]; - ((short*)sync_out2)[1] += ((short*) &result2)[1]; + result = dot_product((short *)primary_synch0_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result2 = dot_product((short *)primary_synch0_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); + sync_out[0].r += ((short *) &result)[0]; + sync_out[0].i += ((short *) &result)[1]; + sync_out2[0].r += ((short *) &result2)[0]; + sync_out2[0].i += ((short *) &result2)[1]; } for (ar=0; arnb_antennas_rx; ar++) { - result = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); - result2 = dot_product((short*)primary_synch1_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); - ((short*)sync_corr_ue1)[2*n] += ((short*) &result)[0]; - ((short*)sync_corr_ue1)[2*n+1] += ((short*) &result)[1]; - ((short*)sync_corr_ue1)[2*(length+n)] += ((short*) &result2)[0]; - ((short*)sync_corr_ue1)[(2*(length+n))+1] += ((short*) &result2)[1]; - - ((short*)sync_out)[2] += ((short*) &result)[0]; - ((short*)sync_out)[3] += ((short*) &result)[1]; - ((short*)sync_out2)[2] += ((short*) &result2)[0]; - ((short*)sync_out2)[3] += ((short*) &result2)[1]; + result = dot_product((short *)primary_synch1_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result2 = dot_product((short *)primary_synch1_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); + sync_out[1].r += ((short *) &result)[0]; + sync_out[1].i += ((short *) &result)[1]; + sync_out2[1].r += ((short *) &result2)[0]; + sync_out2[1].i += ((short *) &result2)[1]; } for (ar=0; arnb_antennas_rx; ar++) { - - result = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); - result2 = dot_product((short*)primary_synch2_time, (short*) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); - ((short*)sync_corr_ue2)[2*n] += ((short*) &result)[0]; - ((short*)sync_corr_ue2)[2*n+1] += ((short*) &result)[1]; - ((short*)sync_corr_ue2)[2*(length+n)] += ((short*) &result2)[0]; - ((short*)sync_corr_ue2)[(2*(length+n))+1] += ((short*) &result2)[1]; - ((short*)sync_out)[4] += ((short*) &result)[0]; - ((short*)sync_out)[5] += ((short*) &result)[1]; - ((short*)sync_out2)[4] += ((short*) &result2)[0]; - ((short*)sync_out2)[5] += ((short*) &result2)[1]; + result = dot_product((short *)primary_synch2_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result2 = dot_product((short *)primary_synch2_time, (short *) &(rxdata[ar][n+length]), frame_parms->ofdm_symbol_size, SHIFT); + sync_out[2].r += ((short *) &result)[0]; + sync_out[2].i += ((short *) &result)[1]; + sync_out2[2].r += ((short *) &result2)[0]; + sync_out2[2].i += ((short *) &result2)[1]; } - } // calculate the absolute value of sync_corr[n] - sync_corr_ue0[n] = abs32(sync_corr_ue0[n]); - sync_corr_ue0[n+length] = abs32(sync_corr_ue0[n+length]); - sync_corr_ue1[n] = abs32(sync_corr_ue1[n]); - sync_corr_ue1[n+length] = abs32(sync_corr_ue1[n+length]); - sync_corr_ue2[n] = abs32(sync_corr_ue2[n]); - sync_corr_ue2[n+length] = abs32(sync_corr_ue2[n+length]); - for (s=0; s<3; s++) { - tmp[s] = (abs32(sync_out[s])>>1) + (abs32(sync_out2[s])>>1); + double tmp = absF(sync_out[s]) + absF(sync_out2[s]); - if (tmp[s]>peak_val) { - peak_val = tmp[s]; + if (tmp>peak_val) { + peak_val = tmp; peak_pos = n; sync_source = s; /* @@ -443,42 +211,22 @@ int lte_sync_time(int **rxdata, ///rx data in time domain } *eNB_id = sync_source; - - LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val,dB_fixed(peak_val)/2); - - - if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){ - static int debug_cnt; - if (debug_cnt == 0) { - LOG_M("sync_corr0_ue.m","synccorr0",sync_corr_ue0,2*length,1,2); - LOG_M("sync_corr1_ue.m","synccorr1",sync_corr_ue1,2*length,1,2); - LOG_M("sync_corr2_ue.m","synccorr2",sync_corr_ue2,2*length,1,2); - LOG_M("rxdata0.m","rxd0",rxdata[0],length<<1,1,1); - // exit(-1); - } else { - debug_cnt++; - } -} + LOG_I(PHY,"[UE] lte_sync_time: Sync source = %d, Peak found at pos %d, val = %d (%d dB)\n",sync_source,peak_pos,peak_val/2,dB_fixed(peak_val/2)/2); return(peak_pos); } -int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars -{ +int ru_sync_time_init(RU_t *ru) { // LTE_UE_COMMON *common_vars /* int16_t dmrs[2048]; int16_t *dmrsp[2] = {dmrs,NULL}; */ - int32_t dmrs[ru->frame_parms->ofdm_symbol_size*14] __attribute__((aligned(32))); //int32_t *dmrsp[2] = {&dmrs[(3-ru->frame_parms->Ncp)*ru->frame_parms->ofdm_symbol_size],NULL}; int32_t *dmrsp[2] = {&dmrs[0],NULL}; - generate_ul_ref_sigs(); - - ru->dmrssync = (int16_t*)malloc16_clear(ru->frame_parms->ofdm_symbol_size*2*sizeof(int16_t)); - ru->dmrs_corr = (uint64_t*)malloc16_clear(ru->frame_parms->samples_per_tti*10*sizeof(uint64_t)); - + ru->dmrssync = (int16_t *)malloc16_clear(ru->frame_parms->ofdm_symbol_size*2*sizeof(int16_t)); + ru->dmrs_corr = (uint64_t *)malloc16_clear(ru->frame_parms->samples_per_tti*10*sizeof(uint64_t)); generate_drs_pusch(NULL, NULL, ru->frame_parms, @@ -491,35 +239,39 @@ int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars 0); switch (ru->frame_parms->N_RB_DL) { - case 6: - idft(IDFT_128,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - case 25: - idft(IDFT_512,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - case 50: - idft(IDFT_1024,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - - case 75: - idft(IDFT_1536,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, - 1); /// complex output - break; - case 100: - idft(IDFT_2048,(int16_t*)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), - ru->dmrssync, /// complex output - 1); - break; - default: - AssertFatal(1==0,"Unsupported N_RB_DL %d\n",ru->frame_parms->N_RB_DL); - break; + case 6: + idft(IDFT_128,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + case 25: + idft(IDFT_512,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + case 50: + idft(IDFT_1024,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + case 75: + idft(IDFT_1536,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, + 1); /// complex output + break; + + case 100: + idft(IDFT_2048,(int16_t *)(&dmrsp[0][3*ru->frame_parms->ofdm_symbol_size]), + ru->dmrssync, /// complex output + 1); + break; + + default: + AssertFatal(1==0,"Unsupported N_RB_DL %d\n",ru->frame_parms->N_RB_DL); + break; } return(0); @@ -527,10 +279,11 @@ int ru_sync_time_init(RU_t *ru) // LTE_UE_COMMON *common_vars void ru_sync_time_free(RU_t *ru) { - AssertFatal(ru->dmrssync!=NULL,"ru->dmrssync is NULL\n"); free(ru->dmrssync); - if (ru->dmrs_corr) free(ru->dmrs_corr); + + if (ru->dmrs_corr) + free(ru->dmrs_corr); } //#define DEBUG_PHY @@ -539,10 +292,8 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain LTE_DL_FRAME_PARMS *frame_parms, uint32_t length, uint32_t *peak_val_out, - uint32_t *sync_corr_eNB) -{ + uint32_t *sync_corr_eNB) { // perform a time domain correlation using the oversampled sync sequence - unsigned int n, ar, peak_val, peak_pos; uint64_t mean_val; int result; @@ -556,21 +307,21 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain } switch (eNB_id) { - case 0: - primary_synch_time = (short*)primary_synch0_time; - break; + case 0: + primary_synch_time = (short *)primary_synch0_time; + break; - case 1: - primary_synch_time = (short*)primary_synch1_time; - break; + case 1: + primary_synch_time = (short *)primary_synch1_time; + break; - case 2: - primary_synch_time = (short*)primary_synch2_time; - break; + case 2: + primary_synch_time = (short *)primary_synch2_time; + break; - default: - LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n"); - return (-1); + default: + LOG_E(PHY,"[SYNC TIME] Illegal eNB_id!\n"); + return (-1); } peak_val = 0; @@ -578,21 +329,16 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain mean_val = 0; for (n=0; nofdm_symbol_size-frame_parms->nb_prefix_samples)) { - //calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; for (ar=0; arnb_antennas_rx; ar++) { - - result = dot_product((short*)primary_synch_time, (short*) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); + result = dot_product((short *)primary_synch_time, (short *) &(rxdata[ar][n]), frame_parms->ofdm_symbol_size, SHIFT); //((short*)sync_corr)[2*n] += ((short*) &result)[0]; //((short*)sync_corr)[2*n+1] += ((short*) &result)[1]; sync_corr_eNB[n] += abs32(result); - } - } /* @@ -610,7 +356,6 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain } mean_val/=length; - *peak_val_out = peak_val; if (peak_val <= (40*(uint32_t)mean_val)) { @@ -620,88 +365,91 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain LOG_I(PHY,"[SYNC TIME] Peak found at pos %u, val = %u, mean_val = %"PRIu64"\n",peak_pos,peak_val,mean_val); return(peak_pos); } - } -static inline int64_t abs64(int64_t x) -{ - return (((int64_t)((int32_t*)&x)[0])*((int64_t)((int32_t*)&x)[0]) + ((int64_t) -((int32_t*)&x)[1])*((int64_t)((int32_t*)&x)[1])); +static inline int64_t abs64(int64_t x) { + return (((int64_t)((int32_t *)&x)[0])*((int64_t)((int32_t *)&x)[0]) + ((int64_t) + ((int32_t *)&x)[1])*((int64_t)((int32_t *)&x)[1])); } int ru_sync_time(RU_t *ru, int64_t *lev, - int64_t *avg) -{ + int64_t *avg) { LTE_DL_FRAME_PARMS *frame_parms = ru->frame_parms; RU_CALIBRATION *calibration = &ru->calibration; - // perform a time domain correlation using the oversampled sync sequence - int length = LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*frame_parms->samples_per_tti; - // circular copy of beginning to end of rxdata buffer. Note: buffer should be big enough upon calling this function - for (int ar=0;arnb_rx;ar++) memcpy((void*)&ru->common.rxdata[ar][2*length], - (void*)&ru->common.rxdata[ar][0], - frame_parms->ofdm_symbol_size); - + for (int ar=0; arnb_rx; ar++) + memcpy((void *)&ru->common.rxdata[ar][2*length], + (void *)&ru->common.rxdata[ar][0], + frame_parms->ofdm_symbol_size); + int32_t maxlev0=0; int maxpos0=0; int64_t avg0=0; int64_t result; int64_t dmrs_corr; - int maxval=0; - for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) { + + for (int i=0; i<2*(frame_parms->ofdm_symbol_size); i++) { maxval = max(maxval,ru->dmrssync[i]); maxval = max(maxval,-ru->dmrssync[i]); } if (ru->state == RU_CHECK_SYNC) { - for (int i=0;i<2*(frame_parms->ofdm_symbol_size);i++) { - maxval = max(maxval,calibration->drs_ch_estimates_time[0][i]); - maxval = max(maxval,-calibration->drs_ch_estimates_time[0][i]); - } + for (int i=0; i<2*(frame_parms->ofdm_symbol_size); i++) { + maxval = max(maxval,calibration->drs_ch_estimates_time[0][i]); + maxval = max(maxval,-calibration->drs_ch_estimates_time[0][i]); + } } int shift = log2_approx(maxval); for (int n=0; nnb_rx; ar++) { - result = dot_product64(ru->dmrssync, - (int16_t*) &ru->common.rxdata[ar][n], - frame_parms->ofdm_symbol_size, - shift); - - if (ru->state == RU_CHECK_SYNC) { - result = dot_product64((int16_t*) &calibration->drs_ch_estimates_time[ar], - (int16_t*) &ru->common.rxdata[ar][n], + (int16_t *) &ru->common.rxdata[ar][n], frame_parms->ofdm_symbol_size, shift); + + if (ru->state == RU_CHECK_SYNC) { + result = dot_product64((int16_t *) &calibration->drs_ch_estimates_time[ar], + (int16_t *) &ru->common.rxdata[ar][n], + frame_parms->ofdm_symbol_size, + shift); } + dmrs_corr += abs64(result); } - if (ru->dmrs_corr != NULL) ru->dmrs_corr[n] = dmrs_corr; + + if (ru->dmrs_corr != NULL) + ru->dmrs_corr[n] = dmrs_corr; // tmpi holds ++...+ + if (dmrs_corr>maxlev0) { + maxlev0 = dmrs_corr; + maxpos0 = n; + } - if (dmrs_corr>maxlev0) { maxlev0 = dmrs_corr; maxpos0 = n; } avg0 += dmrs_corr; } - avg0/=(length/4); + avg0/=(length/4); int dmrsoffset = frame_parms->samples_per_tti + (3*frame_parms->ofdm_symbol_size)+(3*frame_parms->nb_prefix_samples) + frame_parms->nb_prefix_samples0; - - if ((int64_t)maxlev0 > (10*avg0)) {*lev = maxlev0; *avg=avg0; return((length+maxpos0-dmrsoffset)%length);} + + if ((int64_t)maxlev0 > (10*avg0)) { + *lev = maxlev0; + *avg=avg0; + return((length+maxpos0-dmrsoffset)%length); + } return(-1); } diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c index 1d1b16e036..eab9b3f321 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c @@ -20,7 +20,7 @@ */ #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" +//#include "PHY/phy_extern.h" #include "PHY/sse_intrin.h" //#define DEBUG_CH #include "common/utils/LOG/log.h" @@ -34,12 +34,18 @@ static int16_t ru_90c[2*128] = {32767, 0,32766, -402,32758, -804,32746, -1206,32 #define SCALE 0x3FFF +static const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; +static const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; + +extern unsigned short dftsizes[34]; +extern int16_t *ul_ref_sigs_rx[30][2][34]; + int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms, L1_rxtx_proc_t *proc, - LTE_eNB_ULSCH_t * ulsch, - int32_t **ul_ch_estimates, - int32_t **ul_ch_estimates_time, - int32_t **rxdataF_ext, + LTE_eNB_ULSCH_t * ulsch, + int32_t **ul_ch_estimates, + int32_t **ul_ch_estimates_time, + int32_t **rxdataF_ext, module_id_t UE_id, unsigned char l, unsigned char Ns) { diff --git a/openair1/PHY/LTE_REFSIG/lte_gold.c b/openair1/PHY/LTE_REFSIG/lte_gold.c index c5e48d8364..596760541b 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold.c @@ -56,7 +56,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14] (((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); // skip first 50 double words (1600 bits) @@ -103,7 +103,7 @@ void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_ //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 // printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); // skip first 50 double words (1600 bits) @@ -143,7 +143,7 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_ //x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit //n = 0 //printf("cinit (ns %d, l %d) => %d\n",ns,l,x2); - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); //skip first 50 double words (1600 bits) diff --git a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c index b057f6a403..78f0fd93fe 100644 --- a/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c +++ b/openair1/PHY/LTE_REFSIG/lte_gold_mbsfn.c @@ -59,7 +59,7 @@ void lte_gold_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_tabl //n = 0 // printf("cinit (sfn %d, l %d) => %d\n",sfn,l,x2); // Initializing the Sequence - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); // skip first 50 double words (1600 bits) // printf("n=0 : x1 %x, x2 %x\n",x1,x2); @@ -90,7 +90,7 @@ void lte_gold_mbsfn_khz_1dot25(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold for (sfn=0; sfn<10; sfn++) { x2 = (Nid_mbsfn) + (((1+(Nid_mbsfn<<1))*(1 + (7*(1+sfn))))<<9); //cinit - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); for (n=1; n<50; n++) { diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools.c b/openair1/PHY/LTE_TRANSPORT/dci_tools.c index 4b06f67bbe..f11a39e249 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools.c @@ -53,14 +53,12 @@ //#undef LOG_D //#define LOG_D(A,B...) printf(B) -int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { - uint16_t i; - int16_t first_free_index=-1; +int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { + int first_free_index=-1; AssertFatal(eNB!=NULL,"eNB is null\n"); - for (i=0; idlsch[i]!=NULL,"eNB->dlsch[%d] is null\n",i); - AssertFatal(eNB->dlsch[i]!=NULL,"eNB->dlsch[%d][0] is null\n",i); + for (int i=0; idlsch[i][0] == NULL) continue; LOG_D(PHY,"searching for rnti %x : UE index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,eNB->dlsch[i][0]->harq_mask,eNB->dlsch[i][0]->rnti,first_free_index); if ((eNB->dlsch[i][0]->harq_mask >0) && @@ -78,13 +76,12 @@ int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { } -int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { - uint16_t i; - int16_t first_free_index=-1; +int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type) { + int first_free_index=-1; AssertFatal(eNB!=NULL,"eNB is null\n"); - for (i=0; iulsch[i]!=NULL,"eNB->ulsch[%d] is null\n",i); + for (int i=0; iulsch[i]==NULL) continue; if ((eNB->ulsch[i]->harq_mask >0) && (eNB->ulsch[i]->rnti==rnti)) return i; @@ -301,7 +298,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB, UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE); - if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ) { + if( (UE_id<0) || (UE_id>=NUMBER_OF_DLSCH_MAX) ) { LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id); return; } @@ -476,7 +473,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB, ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->harq_pid = rel8->harq_process; ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->dai = rel8->downlink_assignment_index; ((DCI1A_20MHz_TDD_1_6_t *)dci_pdu)->padding = 0; - // printf("TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",mcs,rballoc,rv,NPRB); + //LOG_D(PHY,"TDD 1A: mcs %d, rballoc %x,rv %d, NPRB %d\n",rel8->mcs_1,rel8->resource_block_coding,rel8->redundancy_version_1,NPRB); } else { dci_alloc->dci_length = sizeof_DCI1A_20MHz_FDD_t; ((DCI1A_20MHz_FDD_t *)dci_pdu)->type = 1; @@ -535,7 +532,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB, dlsch0->harq_mask |= (1 << rel8->harq_process); - if (rel8->rnti_type == 1) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding, + if (rel8->rnti != SI_RNTI) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding, rel8->redundancy_version_1,rel8->rnti,rel8->harq_process); break; @@ -1550,7 +1547,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc dci_alloc->i0 = rel13->initial_transmission_sf_io; UE_id = find_dlsch (rel13->rnti, eNB, SEARCH_EXIST_OR_FREE); AssertFatal (UE_id != -1, "no free or exiting dlsch_context\n"); - AssertFatal (UE_id < NUMBER_OF_UE_MAX, "returned UE_id %d >= %d(NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX); + AssertFatal (UE_id < NUMBER_OF_DLSCH_MAX, "returned UE_id %d >= %d(NUMBER_OF_DLSCH_MAX)\n", UE_id, NUMBER_OF_DLSCH_MAX); dlsch0 = eNB->dlsch[UE_id][0]; dlsch0_harq = dlsch0->harq_processes[rel13->harq_process]; dci_alloc->ra_flag = 0; @@ -1955,7 +1952,7 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc, if(frame_parms->frame_type == TDD) { UE_id = find_ulsch(pdu->dci_pdu_rel8.rnti, eNB,SEARCH_EXIST_OR_FREE); - if(UE_id != -1) { + if(UE_id >=0 -1 || UE_id < NUMBER_OF_ULSCH_MAX) { eNB->ulsch[UE_id]->harq_processes[pdu->dci_pdu_rel8.harq_pid]->V_UL_DAI = dai +1; } } diff --git a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c index 583d12eedb..64e74ebfbf 100644 --- a/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c +++ b/openair1/PHY/LTE_TRANSPORT/dci_tools_common.c @@ -32,7 +32,6 @@ #include "PHY/defs_eNB.h" #include "PHY/phy_extern.h" -#include "SCHED/sched_eNB.h" #ifdef DEBUG_DCI_TOOLS #include "PHY/phy_vars.h" #endif @@ -43,7 +42,6 @@ //#define DEBUG_HARQ -#include "LAYER2/MAC/mac.h" //#define DEBUG_DCI @@ -100,7 +98,6 @@ uint16_t RIV2nb_rb_LUT100[6000]; uint16_t RIV2first_rb_LUT100[6000]; uint16_t RIV_max100=0; -extern RAN_CONTEXT_t RC; extern uint32_t current_dlsch_cqi; @@ -273,15 +270,6 @@ uint16_t get_nCCE(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uint -uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe) -{ - - // check for eNB only ! - return(get_nCCE(num_pdcch_symbols, - &RC.eNB[Mod_id][CC_id]->frame_parms, - get_mi(&RC.eNB[Mod_id][CC_id]->frame_parms,subframe))); -} - void conv_eMTC_rballoc (uint16_t resource_block_coding, uint32_t N_RB_DL, uint32_t * rb_alloc) { diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 3eb44d98fa..b5bcb0848d 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -96,6 +96,7 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) { } + LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo, unsigned char Mdlharq, uint32_t Nsoft, @@ -110,7 +111,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo, switch (N_RB_DL) { case 6: - bw_scaling =16; + bw_scaling = 4; break; case 25: @@ -160,7 +161,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo, for (i=0; iharq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t)); - LOG_T(PHY, "Required mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n", + LOG_I(PHY, "Required DLSCH mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n", MAX_DLSCH_PAYLOAD_BYTES/bw_scaling,bw_scaling, i,dlsch->harq_processes[i]); if (dlsch->harq_processes[i]) { @@ -169,9 +170,9 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo, dlsch->harq_processes[i]->b = (unsigned char *)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling); if (dlsch->harq_processes[i]->b) { - bzero(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling); + memset(dlsch->harq_processes[i]->b,0,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling); } else { - printf("Can't get b\n"); + AssertFatal(1==0,"Can't get b\n"); exit_flag=1; } @@ -181,15 +182,15 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo, dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(((r==0)?8:0) + 3+ 768); if (dlsch->harq_processes[i]->c[r]) { - bzero(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+ 768); + memset(dlsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+ 768); } else { - printf("Can't get c\n"); + AssertFatal(1==0,"Can't get c\n"); exit_flag=2; } } } } else { - printf("Can't get harq_p %d\n",i); + AssertFatal(1==0,"Can't get harq_p %d\n",i); exit_flag=3; } } @@ -203,7 +204,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo, } } - LOG_D(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n", + LOG_I(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n", exit_flag, sizeof(LTE_eNB_DLSCH_t)); free_eNB_dlsch(dlsch); return(NULL); @@ -360,6 +361,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, proc->nbEncode=0; + // if (hadlsch->Ndi == 1) { // this is a new packet if (hadlsch->round == 0) { // this is a new packet // Add 24-bit crc (polynomial A) to payload diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 347fbb026b..aba4a464f2 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -2375,16 +2375,14 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, for (l=num_pdcch_symbols; lmimo_mode, pmi2hex_2Ar2(dlsch0_harq->pmi_alloc), mod_order0, mod_order1, rb_alloc[0] ); -#endif } if (frame_parms->Ncp==0) { // normal prefix @@ -2980,7 +2978,7 @@ int allocate_REs_in_RB_MCH_khz_1dot25(int32_t **txdataF, case 2: //QPSK - LOG_D(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); + LOG_D(PHY,"%d : %d,%d => ",tti_offset,((int16_t*)&txdataF[0][tti_offset])[0],((int16_t*)&txdataF[0][tti_offset])[1]); ((int16_t*)&txdataF[0][tti_offset])[0] = (x0[*jj]==1) ? (-gain_lin_QPSK) : gain_lin_QPSK; //I //b_i *jj = *jj + 1; @@ -3082,7 +3080,7 @@ int mch_modulation_khz_1dot25(int32_t **txdataF, uint8_t skip_dc=0; uint8_t mod_order = dlsch->harq_processes[0]->Qm; int16_t qam16_table_a[4],qam64_table_a[8];//,qam16_table_b[4],qam64_table_b[8]; - int16_t *qam_table_s; + int16_t *qam_table_s=qam16_table_a; nsymb_pmch = 1; nsymb = (frame_parms->Ncp == NORMAL) ? 14 : 12; @@ -3125,12 +3123,8 @@ int mch_modulation_khz_1dot25(int32_t **txdataF, } - if (mod_order == 4) - qam_table_s = qam16_table_a; - else if (mod_order == 6) + if (mod_order == 6) qam_table_s = qam64_table_a; - else - qam_table_s = NULL; //LOG_I(PHY,"Allocated rb %d, subframe_offset %d,amp %d\n",rb,subframe_offset,amp); allocate_REs_in_RB_MCH_khz_1dot25(txdataF, diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c index d48164e07d..015a95a862 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c @@ -113,15 +113,12 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms, x2 = ((Ns>>1)<<9) + frame_parms->Nid_cell_mbsfn; //this is c_init in 36.211 Sec 6.3.1 for PMCH } -#ifdef DEBUG_SCRAMBLING - printf("scrambling: i0 %d rnti %x, q %d, Ns %d, Nid_cell %d, G %d x2 %x\n",dlsch->i0,dlsch->rnti,q,Ns,frame_parms->Nid_cell, G, x2); -#endif s = lte_gold_generic(&x1, &x2, 1); for (n=0; n<(1+(G>>5)); n++) { #ifdef DEBUG_SCRAMBLING - for (int k=0; k<32; k++) printf("scrambling %d : %d xor %d = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1)); + for (int k=0; k<32; k++) printf("scrambling %d : %x xor %x = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1)); #endif e[0] = (e[0]) ^ (s&1); diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c index 95ad420028..09c0b4ba0f 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c @@ -30,10 +30,13 @@ * \warning */ -#include "PHY/defs_eNB.h" +#include +//#include "PHY/defs_eNB.h" +#include "PHY/defs_RU.h" #include "PHY/TOOLS/alaw_lut.h" -#include "PHY/phy_extern.h" -#include "SCHED/sched_eNB.h" +//#include "PHY/phy_extern.h" +//#include "SCHED/sched_eNB.h" +lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe); //#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" diff --git a/openair1/PHY/LTE_TRANSPORT/if5_tools.c b/openair1/PHY/LTE_TRANSPORT/if5_tools.c index f39f3ef872..e2bec337aa 100644 --- a/openair1/PHY/LTE_TRANSPORT/if5_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if5_tools.c @@ -31,11 +31,11 @@ */ #include -#include "PHY/defs_eNB.h" +#include +#include "PHY/defs_RU.h" #include "PHY/TOOLS/alaw_lut.h" //#include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" -#include #include "common/utils/LOG/vcd_signal_dumper.h" //#define DEBUG_DL_MOBIPASS //#define DEBUG_UL_MOBIPASS @@ -1469,7 +1469,7 @@ void recv_IF5(RU_t *ru, openair0_timestamp *proc_timestamp, int subframe, uint16 // HYPOTHESIS: first packet per subframe has lowest timestamp of subframe // should detect out of order and act accordingly .... AssertFatal(aid==0 || aid==1,"aid %d != 0 or 1\n",aid); - //LOG_I(PHY,"rxp[%d] %p, dest %p, offset %d (%lld,%lld)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(timestamp[packet_id]-timestamp[0]),timestamp[packet_id],timestamp[0]); + LOG_D(PHY,"rxp[%d] %p, dest %p, offset %d (%llu,%llu)\n",aid,rxp[aid],rxp[aid]+(timestamp[packet_id]-timestamp[0]),(int)(timestamp[packet_id]-timestamp[0]),(long long unsigned int)timestamp[packet_id],(long long unsigned int)timestamp[0]); memcpy((void*)(rxp[aid]+(timestamp[packet_id]-timestamp[0])), (void*)temp_rx, spp_eth<<2); diff --git a/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c b/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c index b249052cbf..a23f8db4f2 100644 --- a/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c +++ b/openair1/PHY/LTE_TRANSPORT/lte_gold_generic.c @@ -41,7 +41,7 @@ extern inline uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t res { // Init value for x1: x1(0) = 1, x1(n) = 0, n=1,2,...,30 // x1(31) = [x1(3) + x1(0)]mod2 = 1 - *x1 = 1 + (1<<31); + *x1 = 1 + (1U<<31); // Init value for x2: cinit = sum_{i=0}^30 x2*2^i // x2(31) = [x2(3) + x2(2) + x2(1) + x2(0)]mod2 // = (*x2>>3) ^ (*x2>>2) + (*x2>>1) + *x2 diff --git a/openair1/PHY/LTE_TRANSPORT/pbch.c b/openair1/PHY/LTE_TRANSPORT/pbch.c index dfa990269e..8e9a968827 100644 --- a/openair1/PHY/LTE_TRANSPORT/pbch.c +++ b/openair1/PHY/LTE_TRANSPORT/pbch.c @@ -72,6 +72,7 @@ int allocate_pbch_REs_in_RB(LTE_DL_FRAME_PARMS *frame_parms, first_re=0; last_re=12; + for (re=first_re; re #include +#include "common/utils/lte/prach_utils.h" void rx_prach0(PHY_VARS_eNB *eNB, RU_t *ru, @@ -84,7 +85,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, uint8_t aa; int32_t lev; int16_t levdB; - int fft_size,log2_ifft_size; + int fft_size=0,log2_ifft_size; int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32))); int32_t *prach_ifft=(int32_t *)NULL; int32_t **prach_ifftp=(int32_t **)NULL; @@ -112,7 +113,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, prach_ConfigIndex = fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[ce_level]; Ncs_config = fp->prach_emtc_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig; restricted_set = fp->prach_emtc_config_common.prach_ConfigInfo.highSpeedFlag; - n_ra_prb = get_prach_prb_offset(fp,prach_ConfigIndex, + n_ra_prb = get_prach_prb_offset(fp->frame_type,fp->tdd_config,fp->N_RB_UL,fp->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[ce_level], fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level], tdd_mapindex,Nf); // update pointers to results for ce_level @@ -124,7 +125,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, prach_ConfigIndex = fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; Ncs_config = fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig; restricted_set = fp->prach_config_common.prach_ConfigInfo.highSpeedFlag; - n_ra_prb = get_prach_prb_offset(fp,prach_ConfigIndex, + n_ra_prb = get_prach_prb_offset(fp->frame_type,fp->tdd_config,fp->N_RB_UL,fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset, tdd_mapindex,Nf); } @@ -140,7 +141,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, rxsigF = eNB->prach_vars_br.rxsigF[ce_level]; if (LOG_DEBUGFLAG(PRACH)) { - if (((frame_prach)&1023) < 20) LOG_I(PHY, + if (((frame_prach)&1023) < 20) LOG_D(PHY, "PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n", br_flag,ce_level,frame_prach,subframe, fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level], @@ -153,24 +154,24 @@ void rx_prach0(PHY_VARS_eNB *eNB, prachF = eNB->prach_vars.prachF; rxsigF = eNB->prach_vars.rxsigF[0]; - if (LOG_DEBUGFLAG(PRACH)) { - if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe, + //if (LOG_DEBUGFLAG(PRACH)) { + if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe, fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex); - } + //} } } else { if (br_flag == 1) { rxsigF = ru->prach_rxsigF_br[ce_level]; if (LOG_DEBUGFLAG(PRACH)) { - if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n", + if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n", br_flag,ce_level,frame_prach,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex); } } else { rxsigF = ru->prach_rxsigF[0]; if (LOG_DEBUGFLAG(PRACH)) { - if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n", + if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex); } } @@ -299,11 +300,13 @@ void rx_prach0(PHY_VARS_eNB *eNB, case 6: if (prach_fmt == 4) { dft(DFT_256,prach2,rxsigF[aa],1); + fft_size=256; } else { dft(DFT_1536,prach2,rxsigF[aa],1); if (prach_fmt>1) dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1); + fft_size=1536; } break; @@ -311,13 +314,14 @@ void rx_prach0(PHY_VARS_eNB *eNB, case 15: if (prach_fmt == 4) { dft(DFT_256,prach2,rxsigF[aa],1); + fft_size=256; } else { dft(DFT_3072,prach2,rxsigF[aa],1); if (prach_fmt>1) dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1); } - + fft_size=3072; break; case 25: @@ -339,11 +343,13 @@ void rx_prach0(PHY_VARS_eNB *eNB, case 50: if (prach_fmt == 4) { dft(DFT_2048,prach2,rxsigF[aa],1); + fft_size=2048; } else { dft(DFT_12288,prach2,rxsigF[aa],1); if (prach_fmt>1) dft(DFT_12288,prach2+24576,rxsigF[aa]+24576,1); + fft_size=12288; } break; @@ -351,11 +357,13 @@ void rx_prach0(PHY_VARS_eNB *eNB, case 75: if (prach_fmt == 4) { dft(DFT_3072,prach2,rxsigF[aa],1); + fft_size=3072; } else { dft(DFT_18432,prach2,rxsigF[aa],1); if (prach_fmt>1) dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1); + fft_size=18432; } break; @@ -364,20 +372,24 @@ void rx_prach0(PHY_VARS_eNB *eNB, if (fp->threequarter_fs==0) { if (prach_fmt == 4) { dft(DFT_4096,prach2,rxsigF[aa],1); + fft_size=2048; } else { dft(DFT_24576,prach2,rxsigF[aa],1); if (prach_fmt>1) dft(DFT_24576,prach2+49152,rxsigF[aa]+49152,1); + fft_size=24576; } } else { if (prach_fmt == 4) { dft(DFT_3072,prach2,rxsigF[aa],1); + fft_size=3072; } else { dft(DFT_18432,prach2,rxsigF[aa],1); if (prach_fmt>1) dft(DFT_18432,prach2+36864,rxsigF[aa]+36864,1); + fft_size=18432; } } @@ -547,7 +559,6 @@ void rx_prach0(PHY_VARS_eNB *eNB, } log2_ifft_size = 10; - fft_size = 6144; if (new_dft == 1) { new_dft = 0; diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c index 393d4ca3f8..e366e8edbc 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_common.c +++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c @@ -34,7 +34,7 @@ #include "PHY/phy_extern.h" #include "PHY/phy_extern_ue.h" #include "common/utils/LOG/vcd_signal_dumper.h" - +#include "common/utils/lte/prach_utils.h" uint16_t NCS_unrestricted[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419}; uint16_t NCS_restricted[15] = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case @@ -44,6 +44,9 @@ int16_t ru[2*839]; // quantized roots of unity uint32_t ZC_inv[839]; // multiplicative inverse for roots u uint16_t du[838]; +extern PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7]; + +/* // This is table 5.7.1-4 from 36.211 PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = { // TDD Configuration Index 0 @@ -254,7 +257,7 @@ PRACH_TDD_PREAMBLE_MAP tdd_preamble_map[64][7] = { } }; - +*/ uint16_t prach_root_sequence_map0_3[838] = { 129, 710, 140, 699, 120, 719, 210, 629, 168, 671, 84, 755, 105, 734, 93, 746, 70, 769, 60, 779, 2, 837, 1, 838, @@ -378,192 +381,13 @@ uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index) { return(tdd_preamble_map[fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex][fp->tdd_config].map[tdd_map_index].f_ra); } -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type) { - if (frame_type == FDD) // FDD - return(prach_ConfigIndex>>4); - else { - if (prach_ConfigIndex < 20) - return (0); - - if (prach_ConfigIndex < 30) - return (1); - - if (prach_ConfigIndex < 40) - return (2); - - if (prach_ConfigIndex < 48) - return (3); - else - return (4); - } -} - -uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t prach_ConfigIndex, - uint8_t n_ra_prboffset, - uint8_t tdd_mapindex, uint16_t Nf) { - lte_frame_type_t frame_type = frame_parms->frame_type; - uint8_t tdd_config = frame_parms->tdd_config; - uint8_t n_ra_prb; - uint8_t f_ra,t1_ra; - uint8_t prach_fmt = get_prach_fmt(prach_ConfigIndex,frame_type); - uint8_t Nsp=2; - - if (frame_type == TDD) { // TDD - if (tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach==0) { - LOG_E(PHY, "Illegal prach_ConfigIndex %"PRIu8"", prach_ConfigIndex); - return(-1); - } - - // adjust n_ra_prboffset for frequency multiplexing (p.36 36.211) - f_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[tdd_mapindex].f_ra; - - if (prach_fmt < 4) { - if ((f_ra&1) == 0) { - n_ra_prb = n_ra_prboffset + 6*(f_ra>>1); - } else { - n_ra_prb = frame_parms->N_RB_UL - 6 - n_ra_prboffset + 6*(f_ra>>1); - } - } else { - if ((tdd_config >2) && (tdd_config<6)) - Nsp = 2; - - t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; - - if ((((Nf&1)*(2-Nsp)+t1_ra)&1) == 0) { - n_ra_prb = 6*f_ra; - } else { - n_ra_prb = frame_parms->N_RB_UL - 6*(f_ra+1); - } - } - } else { //FDD - n_ra_prb = n_ra_prboffset; - } - - return(n_ra_prb); -} - -int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe) { - // uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; - uint8_t tdd_config = frame_parms->tdd_config; - uint8_t t0_ra; - uint8_t t1_ra; - uint8_t t2_ra; - int prach_mask = 0; - - if (frame_parms->frame_type == FDD) { //FDD - //implement Table 5.7.1-2 from 36.211 (Rel-10, p.41) - if ((((frame&1) == 1) && (subframe < 9)) || - (((frame&1) == 0) && (subframe == 9))) // This is an odd frame, ignore even-only PRACH frames - if (((prach_ConfigIndex&0xf)<3) || // 0,1,2,16,17,18,32,33,34,48,49,50 - ((prach_ConfigIndex&0x1f)==18) || // 18,50 - ((prach_ConfigIndex&0xf)==15)) // 15,47 - return(0); - - switch (prach_ConfigIndex&0x1f) { - case 0: - case 3: - if (subframe==1) prach_mask = 1; - - break; - - case 1: - case 4: - if (subframe==4) prach_mask = 1; - - break; - - case 2: - case 5: - if (subframe==7) prach_mask = 1; - - break; - - case 6: - if ((subframe==1) || (subframe==6)) prach_mask=1; - - break; - - case 7: - if ((subframe==2) || (subframe==7)) prach_mask=1; - - break; - - case 8: - if ((subframe==3) || (subframe==8)) prach_mask=1; - - break; - - case 9: - if ((subframe==1) || (subframe==4) || (subframe==7)) prach_mask=1; - - break; - - case 10: - if ((subframe==2) || (subframe==5) || (subframe==8)) prach_mask=1; - - break; - - case 11: - if ((subframe==3) || (subframe==6) || (subframe==9)) prach_mask=1; - - break; - - case 12: - if ((subframe&1)==0) prach_mask=1; - - break; - - case 13: - if ((subframe&1)==1) prach_mask=1; - - break; - - case 14: - prach_mask=1; - break; - - case 15: - if (subframe==9) prach_mask=1; - - break; - } - } else { // TDD - AssertFatal(prach_ConfigIndex<64, - "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex); - AssertFatal(tdd_preamble_map[prach_ConfigIndex][tdd_config].num_prach>0, - "Illegal prach_ConfigIndex %d for ",prach_ConfigIndex); - t0_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t0_ra; - t1_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t1_ra; - t2_ra = tdd_preamble_map[prach_ConfigIndex][tdd_config].map[0].t2_ra; -#ifdef PRACH_DEBUG - LOG_I(PHY,"[PRACH] Checking for PRACH format (ConfigIndex %d) in TDD subframe %d (%d,%d,%d)\n", - prach_ConfigIndex, - subframe, - t0_ra,t1_ra,t2_ra); -#endif - - if ((((t0_ra == 1) && ((frame &1)==0))|| // frame is even and PRACH is in even frames - ((t0_ra == 2) && ((frame &1)==1))|| // frame is odd and PRACH is in odd frames - (t0_ra == 0)) && // PRACH is in all frames - (((subframe<5)&&(t1_ra==0)) || // PRACH is in 1st half-frame - (((subframe>4)&&(t1_ra==1))))) { // PRACH is in 2nd half-frame - if ((prach_ConfigIndex<48) && // PRACH only in normal UL subframe - (((subframe%5)-2)==t2_ra)) prach_mask=1; - else if ((prach_ConfigIndex>47) && (((subframe%5)-1)==t2_ra)) prach_mask=1; // PRACH can be in UpPTS - } - } - - return(prach_mask); -} - int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t subframe) { uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex; - int prach_mask = is_prach_subframe0(frame_parms, prach_ConfigIndex, frame, subframe); + int prach_mask = is_prach_subframe0(frame_parms->tdd_config,frame_parms->frame_type, prach_ConfigIndex, frame, subframe); for (int i=0; i<4; i++) { if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1) - prach_mask |= (is_prach_subframe0(frame_parms, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i], + prach_mask |= (is_prach_subframe0(frame_parms->tdd_config,frame_parms->frame_type, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i], frame, subframe) << (i+1)); } diff --git a/openair1/PHY/LTE_TRANSPORT/prach_extern.h b/openair1/PHY/LTE_TRANSPORT/prach_extern.h index 47fbd93ad7..3404646923 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach_extern.h +++ b/openair1/PHY/LTE_TRANSPORT/prach_extern.h @@ -35,7 +35,7 @@ #include "PHY/sse_intrin.h" #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" +//#include "PHY/phy_extern.h" //#define PRACH_DEBUG 1 //#define PRACH_WRITE_OUTPUT_DEBUG 1 @@ -74,17 +74,6 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id); uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index); -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); - - -uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t prach_ConfigIndex, - uint8_t n_ra_prboffset, - uint8_t tdd_mapindex, uint16_t Nf); - - -int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex,uint32_t frame, uint8_t subframe); - int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe); diff --git a/openair1/PHY/LTE_TRANSPORT/pucch.c b/openair1/PHY/LTE_TRANSPORT/pucch.c index c72fa1b480..585a9d92a5 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch.c @@ -65,10 +65,41 @@ int16_t cfo_pucch_ep[24*6] = {24278,-22005,29621,-14010,32412,-4808,32412,4807,2 +void dump_uci_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) { + + int strpos=0; + char output[16384]; + + for (int i=0;iuci_stats[i].rnti>0) { + eNB_UCI_STATS_t *uci_stats = &eNB->uci_stats[i]; + strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch1_trials %d, pucch1_n0 %d dB, pucch1_thres %d dB, current pucch1_stat_pos %d dB, current pucch1_stat_neg %d dB, positive SR count %d\n", + i,uci_stats->rnti,uci_stats->pucch1_trials,eNB->measurements.n0_pucch_dB/*max(eNB->measurements.n0_subband_power_tot_dB[0], eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1])*/,uci_stats->pucch1_thres,dB_fixed(uci_stats->current_pucch1_stat_pos),dB_fixed(uci_stats->current_pucch1_stat_neg),uci_stats->pucch1_positive_SR); + strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch1_low (%d,%d)dB pucch1_high (%d,%d)dB\n", + i,uci_stats->rnti, + dB_fixed(uci_stats->pucch1_low_stat[0]), + dB_fixed(uci_stats->pucch1_low_stat[1]), + dB_fixed(uci_stats->pucch1_high_stat[0]), + dB_fixed(uci_stats->pucch1_high_stat[1])); + + strpos+=sprintf(output+strpos,"UCI %d RNTI %x: pucch1a_trials %d, pucch1a_stat (%d,%d), pucch1b_trials %d, pucch1b_stat (%d,%d) pucch1ab_DTX %d\n", + i,uci_stats->rnti, + uci_stats->pucch1a_trials, + uci_stats->current_pucch1a_stat_re, + uci_stats->current_pucch1a_stat_im, + uci_stats->pucch1b_trials, + uci_stats->current_pucch1b_stat_re, + uci_stats->current_pucch1b_stat_im, + uci_stats->pucch1ab_DTX); + } + } + if (fd) fprintf(fd,"%s",output); + else printf("%s",output); +} /* PUCCH format3 >> */ /* SubCarrier Demap */ uint16_t pucchfmt3_subCarrierDeMapping( PHY_VARS_eNB *eNB, - int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2], + int16_t SubCarrierDeMapData[4][14][12][2], uint16_t n3_pucch ) { LTE_eNB_COMMON *eNB_common_vars = &eNB->common_vars; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; @@ -118,8 +149,8 @@ uint16_t pucchfmt3_subCarrierDeMapping( PHY_VARS_eNB *eNB, } /* cyclic shift hopping remove */ -uint16_t pucchfmt3_Baseseq_csh_remove( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2], - int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2], +uint16_t pucchfmt3_Baseseq_csh_remove( int16_t SubCarrierDeMapData[4][14][12][2], + int16_t CshData_fmt3[4][14][12][2], LTE_DL_FRAME_PARMS *frame_parms, uint8_t subframe, uint8_t ncs_cell[20][7] ) { @@ -169,9 +200,9 @@ const int16_t TBL_3_SF5_GEN_N_DASH_NS[MAXROW_TBL_SF5_OS_IDX] = {0,3,6,8,10}; const int16_t TBL_3_SF4_GEN_N_DASH_NS[MAXROW_TBL_SF4_OS_IDX] = {0,3,6,9}; /* Channel estimation */ -uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2], - double delta_theta[NB_ANTENNAS_RX][12], - int16_t ChestValue[NB_ANTENNAS_RX][2][12][2], +uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[4][14][12][2], + double delta_theta[4][12], + int16_t ChestValue[4][2][12][2], int16_t *Interpw, uint8_t subframe, uint8_t shortened_format, @@ -183,12 +214,12 @@ uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX int16_t np, np_n, ip_ind=-1; //int16_t npucch_sf; int16_t calctmp[2]; - int16_t BsCshData[NB_ANTENNAS_RX][D_NSYM1SF][D_NSC1RB][2]; - //int16_t delta_theta_calctmp[NB_ANTENNAS_RX][4][D_NSC1RB][2], delta_theta_comp[NB_ANTENNAS_RX][D_NSC1RB][2]; - int16_t delta_theta_comp[NB_ANTENNAS_RX][D_NSC1RB][2]; - int16_t CsData_allavg[NB_ANTENNAS_RX][14][2]; - int16_t CsData_temp[NB_ANTENNAS_RX][D_NSYM1SF][D_NSC1RB][2]; - int32_t IP_CsData_allsfavg[NB_ANTENNAS_RX][14][4][2]; + int16_t BsCshData[4][D_NSYM1SF][D_NSC1RB][2]; + //int16_t delta_theta_calctmp[4][4][D_NSC1RB][2], delta_theta_comp[4][D_NSC1RB][2]; + int16_t delta_theta_comp[4][D_NSC1RB][2]; + int16_t CsData_allavg[4][14][2]; + int16_t CsData_temp[4][D_NSYM1SF][D_NSC1RB][2]; + int32_t IP_CsData_allsfavg[4][14][4][2]; int32_t IP_allavg[D_NPUCCH_SF5]; //int16_t temp_ch[2]; int16_t m[NUMBER_OF_UE_MAX], m_self=0, same_m_number; @@ -432,9 +463,9 @@ uint16_t pucchfmt3_ChannelEstimation( int16_t SubCarrierDeMapData[NB_ANTENNAS_RX } /* Channel Equalization */ -uint16_t pucchfmt3_Equalization( int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2], - int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2], - int16_t ChestValue[NB_ANTENNAS_RX][2][12][2], +uint16_t pucchfmt3_Equalization( int16_t CshData_fmt3[4][14][12][2], + int16_t ChdetAfterValue_fmt3[4][14][12][2], + int16_t ChestValue[4][2][12][2], LTE_DL_FRAME_PARMS *frame_parms) { int16_t aa, sltNo, symNo, k; @@ -457,9 +488,9 @@ uint16_t pucchfmt3_Equalization( int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2] } /* Frequency deviation remove AFC */ -uint16_t pucchfmt3_FrqDevRemove( int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2], - double delta_theta[NB_ANTENNAS_RX][12], - int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2], +uint16_t pucchfmt3_FrqDevRemove( int16_t ChdetAfterValue_fmt3[4][14][12][2], + double delta_theta[4][12], + int16_t RemoveFrqDev_fmt3[4][2][5][12][2], LTE_DL_FRAME_PARMS *frame_parms ) { int16_t aa, sltNo, symNo1slt, k, n; double calctmp[2]; @@ -509,8 +540,8 @@ const int16_t TBL_3_SF4[MAXROW_TBL_SF4_fmt3][MAXCLM_TBL_SF4][2] = { }; /* orthogonal sequence remove */ -uint16_t pucchfmt3_OrthSeqRemove( int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2], - int16_t Fmt3xDataRmvOrth[NB_ANTENNAS_RX][2][5][12][2], +uint16_t pucchfmt3_OrthSeqRemove( int16_t RemoveFrqDev_fmt3[4][2][5][12][2], + int16_t Fmt3xDataRmvOrth[4][2][5][12][2], uint8_t shortened_format, uint16_t n3_pucch, LTE_DL_FRAME_PARMS *frame_parms ) { @@ -556,7 +587,7 @@ uint16_t pucchfmt3_OrthSeqRemove( int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5 } /* averaging antenna */ -uint16_t pucchfmt3_AvgAnt( int16_t Fmt3xDataRmvOrth[NB_ANTENNAS_RX][2][5][12][2], +uint16_t pucchfmt3_AvgAnt( int16_t Fmt3xDataRmvOrth[4][2][5][12][2], int16_t Fmt3xDataAvgAnt[2][5][12][2], uint8_t shortened_format, LTE_DL_FRAME_PARMS *frame_parms ) { @@ -856,7 +887,7 @@ uint32_t calc_pucch_1x_interference(PHY_VARS_eNB *eNB, uint32_t rx_pucch(PHY_VARS_eNB *eNB, PUCCH_FMT_t fmt, - uint8_t UE_id, + uint8_t UCI_id, uint16_t n1_pucch, uint16_t n2_pucch, uint8_t shortened_format, @@ -871,15 +902,15 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, static int first_call = 1; LTE_eNB_COMMON *common_vars = &eNB->common_vars; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; - int8_t sigma2_dB = eNB->measurements.n0_pucch_dB; + int8_t sigma2_dB = /*max(eNB->measurements.n0_subband_power_tot_dB[0], eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1]); */eNB->measurements.n0_pucch_dB; uint32_t u,v,n,aa; uint32_t z[12*14]; int16_t *zptr; - int16_t rxcomp[NB_ANTENNAS_RX][2*12*14]; + int16_t rxcomp[4][2*12*14]; uint8_t ns,N_UL_symb,nsymb,n_oc,n_oc0,n_oc1; uint8_t c = (frame_parms->Ncp==0) ? 3 : 2; - uint16_t nprime,nprime0,nprime1; + int16_t nprime,nprime0,nprime1; uint16_t i,j,re_offset,thres,h,off; uint8_t Nprime_div_deltaPUCCH_Shift,Nprime,d; uint8_t m,l,refs,phase,re,l2,phase_max=0; @@ -887,12 +918,12 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, int16_t tmp_re,tmp_im,W_re=0,W_im=0; int16_t *rxptr; uint32_t symbol_offset; - int16_t stat_ref_re,stat_ref_im,*cfo; - int16_t chest0_re[NB_ANTENNAS_RX][12],chest0_im[NB_ANTENNAS_RX][12]; - int16_t chest1_re[NB_ANTENNAS_RX][12],chest1_im[NB_ANTENNAS_RX][12]; + int16_t stat0_ref_re[4],stat0_ref_im[4],stat1_ref_re[4],stat1_ref_im[4],*cfo; + int16_t chest0_re[4][12],chest0_im[4][12]; + int16_t chest1_re[4][12],chest1_im[4][12]; int32_t chest_mag; - int32_t stat_re=0,stat_im=0; - uint32_t stat,stat_max=0; + int32_t stat0_re[4],stat1_re[4],stat0_im[4],stat1_im[4]; + uint32_t stat0[4],stat1[4],stat_max=0,stat0_max[4],stat1_max[4]; uint8_t log2_maxh; uint8_t deltaPUCCH_Shift = frame_parms->pucch_config_common.deltaPUCCH_Shift; uint8_t NRB2 = frame_parms->pucch_config_common.nRB_CQI; @@ -905,13 +936,13 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, int chL; /* PUCCH format3 >> */ uint16_t Ret = 0; - int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex] - int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex] - double delta_theta[NB_ANTENNAS_RX][12]; //[Antenna][Subcarrier][Complex] - int16_t ChestValue[NB_ANTENNAS_RX][2][12][2]; //[Antenna][Slot][Subcarrier][Complex] - int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex] - int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex] - int16_t Fmt3xDataRmvOrth[NB_ANTENNAS_RX][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex] + int16_t SubCarrierDeMapData[4][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex] + int16_t CshData_fmt3[4][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex] + double delta_theta[4][12]; //[Antenna][Subcarrier][Complex] + int16_t ChestValue[4][2][12][2]; //[Antenna][Slot][Subcarrier][Complex] + int16_t ChdetAfterValue_fmt3[4][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex] + int16_t RemoveFrqDev_fmt3[4][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex] + int16_t Fmt3xDataRmvOrth[4][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex] int16_t Fmt3xDataAvgAnt[2][5][12][2]; //[Slot][PUCCH_Symbol][Subcarrier][Complex] int16_t Fmt3xDataAvgSym[2][12][2]; //[Slot][Subcarrier][Complex] int16_t IFFTOutData_Fmt3[2][12][2]; //[Slot][Subcarrier][Complex] @@ -941,9 +972,20 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, first_call=0; } - + eNB_UCI_STATS_t *uci_stats = NULL; if(fmt!=pucch_format3) { /* PUCCH format3 */ + + eNB_UCI_STATS_t *first_uci_stats=NULL; + for (int i=0;iuci_stats[i].rnti == eNB->uci_vars[UCI_id].rnti) { + uci_stats = &eNB->uci_stats[i]; + break; + } else if (first_uci_stats == NULL && eNB->uci_stats[i].rnti == 0) first_uci_stats = &eNB->uci_stats[i]; + if (uci_stats == NULL) { uci_stats=first_uci_stats; uci_stats->rnti = eNB->uci_vars[UCI_id].rnti;} + + AssertFatal(uci_stats!=NULL,"No stat index found\n"); + uci_stats->frame = frame; // TODO // "SR+ACK/NACK" length is only 7 bits. // This restriction will be lifted in the future. @@ -1149,57 +1191,63 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, // Do cfo correction and MRC across symbols if (fmt == pucch_format1) { + uci_stats->pucch1_trials++; #ifdef DEBUG_PUCCH_RX printf("Doing PUCCH detection for format 1\n"); #endif stat_max = 0; for (phase=0; phase<7; phase++) { - stat=0; - + int stat=0; for (aa=0; aanb_antennas_rx; aa++) { + stat0[aa]=0;stat1[aa]=0; for (re=0; re<12; re++) { - stat_re=0; - stat_im=0; + stat0_re[aa]=0; + stat0_im[aa]=0; + stat1_re[aa]=0; + stat1_im[aa]=0; off=re<<1; cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase] : &cfo_pucch_ep[12*phase]; for (l=0; l<(nsymb>>1); l++) { - stat_re += (((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15))/nsymb; - stat_im += (((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15))/nsymb; + stat0_re[aa] += (((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15))/nsymb; + stat0_im[aa] += (((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15))/nsymb; off+=2; #ifdef DEBUG_PUCCH_RX printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) , stat %d\n",subframe,phase,l,re, rxcomp[aa][off],rxcomp[aa][1+off], cfo[l<<1],cfo[1+(l<<1)], - stat_re,stat_im,stat); + stat0_re[aa],stat0_im[aa],stat); #endif } for (l2=0,l=(nsymb>>1); l < nsymb; l++,l2++) { - stat_re += (((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15))/nsymb; - stat_im += (((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15))/nsymb; + stat1_re[aa] += (((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15))/nsymb; + stat1_im[aa] += (((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15))/nsymb; off+=2; #ifdef DEBUG_PUCCH_RX printf("[eNB] PUCCH subframe %d (%d,%d,%d) => (%d,%d) x (%d,%d) : (%d,%d), stat %d\n",subframe,phase,l2,re, rxcomp[aa][off],rxcomp[aa][1+off], cfo[l2<<1],cfo[1+(l2<<1)], - stat_re,stat_im,stat); + stat1_re[aa],stat1_im[aa],stat); #endif } - - stat += ((stat_re*stat_re) + (stat_im*stat_im)); + + stat0[aa] += ((stat0_re[aa]*stat0_re[aa]) + (stat0_im[aa]*stat0_im[aa])); + stat1[aa] += ((stat1_re[aa]*stat1_re[aa]) + (stat1_im[aa]*stat1_im[aa])); } //re + stat+=(stat0[aa]+stat1[aa]); } // aa - if (stat>stat_max) { stat_max = stat; phase_max = phase; + for (aa=0;aanb_antennas_rx;aa++) { + stat0_max[aa] = stat0[aa]; + stat1_max[aa] = stat1[aa]; + } } } //phase - // stat_max *= nsymb; // normalize to energy per symbol - // stat_max /= (frame_parms->N_RB_UL*12); // stat_max /= 12; #ifdef DEBUG_PUCCH_RX printf("[eNB] PUCCH: stat %d, stat_max %d, phase_max %d\n", stat,stat_max,phase_max); @@ -1207,12 +1255,14 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, #ifdef DEBUG_PUCCH_RX LOG_I(PHY,"[eNB] PUCCH fmt1: stat_max : %d, sigma2_dB %d (%d, %d), phase_max : %d\n",dB_fixed(stat_max),sigma2_dB,eNB->measurements.n0_subband_power_tot_dBm[6],pucch1_thres,phase_max); #endif - eNB->pucch1_stats[UE_id][(subframe<<10)+eNB->pucch1_stats_cnt[UE_id][subframe]] = stat_max; - eNB->pucch1_stats_thres[UE_id][(subframe<<10)+eNB->pucch1_stats_cnt[UE_id][subframe]] = sigma2_dB+pucch1_thres; - eNB->pucch1_stats_cnt[UE_id][subframe] = (eNB->pucch1_stats_cnt[UE_id][subframe]+1)&1023; - T(T_ENB_PHY_PUCCH_1_ENERGY, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UE_id].rnti), T_INT(frame), T_INT(subframe), + eNB->pucch1_stats[UCI_id][(subframe<<10)+eNB->pucch1_stats_cnt[UCI_id][subframe]] = stat_max; + eNB->pucch1_stats_thres[UCI_id][(subframe<<10)+eNB->pucch1_stats_cnt[UCI_id][subframe]] = sigma2_dB+pucch1_thres; + eNB->pucch1_stats_cnt[UCI_id][subframe] = (eNB->pucch1_stats_cnt[UCI_id][subframe]+1)&1023; + uci_stats->pucch1_thres = sigma2_dB+pucch1_thres; + T(T_ENB_PHY_PUCCH_1_ENERGY, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UCI_id].rnti), T_INT(frame), T_INT(subframe), T_INT(stat_max), T_INT(sigma2_dB+pucch1_thres)); + /* if (eNB->pucch1_stats_cnt[UE_id][subframe] == 0) { LOG_M("pucch_debug.m","pucch_energy", @@ -1226,11 +1276,18 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, // This is a moving average of the PUCCH1 statistics conditioned on being above or below the threshold if (sigma2_dB<(dB_fixed(stat_max)-pucch1_thres)) { *payload = 1; + uci_stats->current_pucch1_stat_pos = stat_max; + for (int aa=0;aanb_antennas_rx;aa++) { + uci_stats->pucch1_low_stat[aa]=stat0_max[aa]; + uci_stats->pucch1_high_stat[aa]=stat1_max[aa]; + uci_stats->pucch1_positive_SR++; + } } else { + uci_stats->current_pucch1_stat_neg = stat_max; *payload = 0; } - if (UE_id==0) { + if (UCI_id==0) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_ENERGY,dB_fixed(stat_max)); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_SR_THRES,sigma2_dB+pucch1_thres); } @@ -1239,29 +1296,30 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, #ifdef DEBUG_PUCCH_RX LOG_D(PHY,"Doing PUCCH detection for format 1a/1b\n"); #endif - + int stat_re=0,stat_im=0; for (phase=0; phase<7; phase++) { - stat=0; - + int stat=0; for (aa=0; aanb_antennas_rx; aa++) { + stat0[aa]=0; + stat1[aa]=0; for (re=0; re<12; re++) { // compute received energy first slot, seperately for data and reference // by coherent combining across symbols but not resource elements // Note: assumption is that channel is stationary over symbols in slot after CFO - stat_re=0; - stat_im=0; - stat_ref_re=0; - stat_ref_im=0; + stat0_re[aa]=0; + stat0_im[aa]=0; + stat0_ref_re[aa]=0; + stat0_ref_im[aa]=0; off=re<<1; cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase] : &cfo_pucch_ep[12*phase]; for (l=0; l<(nsymb>>1); l++) { if ((l<2)||(l>(nsymb>>1) - 3)) { //data symbols - stat_re += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15); - stat_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15); + stat0_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15); + stat0_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15); } else { //reference symbols - stat_ref_re += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15); - stat_ref_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15); + stat0_ref_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15); + stat0_ref_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15); } off+=2; @@ -1274,26 +1332,21 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, } // this is total energy received, summed over data and reference - if (fmt==pucch_format1a){ - stat += ((((stat_re*stat_re)) + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); - }else{ - stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) + - ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); - } - + stat0[aa] += ((((stat0_re[aa]*stat0_re[aa])) + ((stat0_im[aa]*stat0_im[aa])) + + ((stat0_ref_re[aa]*stat0_ref_re[aa])) + ((stat0_ref_im[aa]*stat0_ref_im[aa])))/nsymb); // now second slot - stat_re=0; - stat_im=0; - stat_ref_re=0; - stat_ref_im=0; + stat1_re[aa]=0; + stat1_im[aa]=0; + stat1_ref_re[aa]=0; + stat1_ref_im[aa]=0; for (l2=0,l=(nsymb>>1); l< nsymb; l++,l2++) { if ((l2<2) || ((l2>(nsymb>>1) - 3)) ) { // data symbols - stat_re += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15); - stat_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15); + stat1_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15); + stat1_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15); } else { //reference_symbols - stat_ref_re += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15); - stat_ref_im += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15); + stat1_ref_re[aa] += ((rxcomp[aa][off]*(int32_t)cfo[l2<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l2<<1)])>>15); + stat1_ref_im[aa] += ((rxcomp[aa][off]*(int32_t)cfo[1+(l2<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l2<<1)])>>15); } off+=2; @@ -1308,20 +1361,16 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, #ifdef DEBUG_PUCCH_RX printf("aa%d re %d : phase %d : stat %d\n",aa,re,phase,stat); #endif - if (fmt==pucch_format1a){ - stat += ((((stat_re*stat_re)) + ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); - }else{ - stat += ((((stat_re*stat_re)) + ((stat_im*stat_im)) + - ((stat_ref_re*stat_ref_re)) + ((stat_ref_im*stat_ref_im)))/nsymb); - } - + stat1[aa] += ((((stat1_re[aa]*stat1_re[aa])) + ((stat1_im[aa]*stat1_im[aa])) + + ((stat1_ref_re[aa]*stat1_ref_re[aa])) + ((stat1_ref_im[aa]*stat1_ref_im[aa])))/nsymb); } //re + stat+=(stat0[aa]+stat1[aa]); } // aa #ifdef DEBUG_PUCCH_RX LOG_D(PHY,"Format 1A: phase %d : stat %d\n",phase,stat); #endif - + if (stat>stat_max) { stat_max = stat; phase_max = phase; @@ -1332,8 +1381,6 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, #ifdef DEBUG_PUCCH_RX LOG_I(PHY,"[eNB] PUCCH fmt1a/b: stat_max : %d (%d : sigma2 %d), phase_max : %d\n",stat_max,dB_fixed(stat_max),sigma2_dB,phase_max); #endif - stat_re=0; - stat_im=0; // Do detection now @@ -1341,13 +1388,12 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, // For instance i assume to skip pucch1_thres from the test below. // Not 100% sure - if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {// + if (sigma2_dB<(dB_fixed(stat_max) - (IS_SOFTMODEM_IQPLAYER?0:pucch1_thres)) ) {// chL = (nsymb>>1)-4; chest_mag=0; cfo = (frame_parms->Ncp==0) ? &cfo_pucch_np[14*phase_max] : &cfo_pucch_ep[12*phase_max]; for (aa=0; aanb_antennas_rx; aa++) { - // channel estimates first for (re=0; re<12; re++) { // channel estimate for first slot chest0_re[aa][re]=0; @@ -1381,6 +1427,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, // now do channel matched filter for (aa=0; aanb_antennas_rx; aa++) { + stat0_re[aa]=0; + stat0_im[aa]=0; + stat1_re[aa]=0; + stat1_im[aa]=0; + for (re=0; re<12; re++) { #ifdef DEBUG_PUCCH_RX printf("[eNB] PUCCH subframe %d chest0[%d][%d] => (%d,%d)\n",subframe,aa,re, @@ -1392,8 +1443,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, off=(re<<1) + (24*l); tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15); tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15); - stat_re += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh)); - stat_im += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh)); + stat0_re[aa] += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh)); + stat0_im[aa] += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh)); off+=2; #ifdef DEBUG_PUCCH_RX printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re, @@ -1409,8 +1460,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, off=(re<<1) + (24*l); tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15); tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15); - stat_re += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh)); - stat_im += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh)); + stat0_re[aa] += (((tmp_re*chest0_re[aa][re])>>log2_maxh) + ((tmp_im*chest0_im[aa][re])>>log2_maxh)); + stat0_im[aa] += (((tmp_re*chest0_im[aa][re])>>log2_maxh) - ((tmp_im*chest0_re[aa][re])>>log2_maxh)); off+=2; #ifdef DEBUG_PUCCH_RX printf("[eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re, @@ -1431,8 +1482,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, off=(re<<1) + (24*l) + (nsymb>>1)*24; tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15); tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15); - stat_re += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh)); - stat_im += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh)); + stat1_re[aa] += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh)); + stat1_im[aa] += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh)); off+=2; #ifdef DEBUG_PUCCH_RX printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re, @@ -1448,8 +1499,8 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, off=(re<<1) + (24*l) + (nsymb>>1)*24; tmp_re = ((rxcomp[aa][off]*(int32_t)cfo[l<<1])>>15) - ((rxcomp[aa][1+off]*(int32_t)cfo[1+(l<<1)])>>15); tmp_im = ((rxcomp[aa][off]*(int32_t)cfo[1+(l<<1)])>>15) + ((rxcomp[aa][1+off]*(int32_t)cfo[(l<<1)])>>15); - stat_re += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh)); - stat_im += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh)); + stat1_re[aa] += (((tmp_re*chest1_re[aa][re])>>log2_maxh) + ((tmp_im*chest1_im[aa][re])>>log2_maxh)); + stat1_im[aa] += (((tmp_re*chest1_im[aa][re])>>log2_maxh) - ((tmp_im*chest1_re[aa][re])>>log2_maxh)); off+=2; #ifdef DEBUG_PUCCH_RX printf("[PHY][eNB] PUCCH subframe %d (%d,%d) => (%d,%d) x (%d,%d) : (%d,%d) => (%d,%d)\n",subframe,l,re, @@ -1464,29 +1515,42 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB, printf("aa%d re %d : stat %d,%d\n",aa,re,stat_re,stat_im); #endif } //re + stat_re+=stat0_re[aa]+stat1_re[aa]; + stat_im+=stat0_im[aa]+stat1_im[aa]; } // aa LOG_D(PHY,"PUCCH 1a/b: subframe %d : stat %d,%d (pos %d)\n",subframe,stat_re,stat_im, - (subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])); + (subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe])); LOG_D(PHY,"In pucch.c PUCCH 1a/b: ACK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres); - eNB->pucch1ab_stats[UE_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_re); - eNB->pucch1ab_stats[UE_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_im); - eNB->pucch1ab_stats_cnt[UE_id][subframe] = (eNB->pucch1ab_stats_cnt[UE_id][subframe]+1)&1023; + eNB->pucch1ab_stats[UCI_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UCI_id][subframe])] = (stat_re); + eNB->pucch1ab_stats[UCI_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UCI_id][subframe])] = (stat_im); + eNB->pucch1ab_stats_cnt[UCI_id][subframe] = (eNB->pucch1ab_stats_cnt[UCI_id][subframe]+1)&1023; /* frame not available here - set to -1 for the moment */ - T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UE_id].rnti), T_INT(-1), T_INT(subframe), T_INT(stat_re), T_INT(stat_im)); + T(T_ENB_PHY_PUCCH_1AB_IQ, T_INT(eNB->Mod_id), T_INT(eNB->uci_vars[UCI_id].rnti), T_INT(-1), T_INT(subframe), T_INT(stat_re), T_INT(stat_im)); *payload = (stat_re<0) ? 1 : 2; // 1 == ACK, 2 == NAK - if (fmt==pucch_format1b) + if (fmt==pucch_format1b) { + uci_stats->pucch1b_trials++; *(1+payload) = (stat_im<0) ? 1 : 2; + uci_stats->current_pucch1b_stat_re = stat_re; + uci_stats->current_pucch1b_stat_im = stat_im; + } + else { + uci_stats->pucch1a_trials++; + uci_stats->current_pucch1a_stat_re = stat_re; + uci_stats->current_pucch1a_stat_im = stat_im; + } + } else { // insufficient energy on PUCCH so NAK LOG_D(PHY,"In pucch.c PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres); *payload = 4; // DTX - ((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re); - ((int16_t *)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im); - eNB->pucch1ab_stats_cnt[UE_id][subframe] = (eNB->pucch1ab_stats_cnt[UE_id][subframe]+1)&1023; + ((int16_t *)&eNB->pucch1ab_stats[UCI_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe])])[0] = (int16_t)(stat_re); + ((int16_t *)&eNB->pucch1ab_stats[UCI_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UCI_id][subframe])])[1] = (int16_t)(stat_im); + eNB->pucch1ab_stats_cnt[UCI_id][subframe] = (eNB->pucch1ab_stats_cnt[UCI_id][subframe]+1)&1023; if (fmt==pucch_format1b) *(1+payload) = 4; + uci_stats->pucch1ab_DTX++; } } else { LOG_E(PHY,"[eNB] PUCCH fmt2/2a/2b not supported\n"); diff --git a/openair1/PHY/LTE_TRANSPORT/pucch_common.c b/openair1/PHY/LTE_TRANSPORT/pucch_common.c index 5b939b08d2..d7a500d5f7 100644 --- a/openair1/PHY/LTE_TRANSPORT/pucch_common.c +++ b/openair1/PHY/LTE_TRANSPORT/pucch_common.c @@ -31,7 +31,6 @@ */ #include "PHY/defs_eNB.h" #include "PHY/phy_extern.h" -#include "LAYER2/MAC/mac.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/log.h" diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common.h b/openair1/PHY/LTE_TRANSPORT/transport_common.h index ab2921c2b9..7c1065736d 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_common.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_common.h @@ -35,9 +35,9 @@ #include "dci.h" #include "mdci.h" //#include "uci.h" -#ifndef STANDALONE_COMPILE - #include "UTIL/LISTS/list.h" -#endif +//#ifndef STANDALONE_COMPILE +// #include "UTIL/LISTS/list.h" +//#endif #define MOD_TABLE_QPSK_OFFSET 1 #define MOD_TABLE_16QAM_OFFSET 5 @@ -57,7 +57,7 @@ // maximum of 3 segments before each coding block if data length exceeds 6144 bits. -#define MAX_NUM_DLSCH_SEGMENTS 16 +#define MAX_NUM_DLSCH_SEGMENTS 13 #define MAX_NUM_ULSCH_SEGMENTS MAX_NUM_DLSCH_SEGMENTS #define MAX_DLSCH_PAYLOAD_BYTES (MAX_NUM_DLSCH_SEGMENTS*768) #define MAX_ULSCH_PAYLOAD_BYTES (MAX_NUM_ULSCH_SEGMENTS*768) diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h index 1944f06fab..622f37b3bc 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h @@ -223,7 +223,9 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id); @param frame_type 0-FDD, 1-TDD @returns 0-1 accordingly */ +/* uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); +*/ /*! \brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index @@ -306,12 +308,12 @@ void init_scrambling_lut(void); void init_unscrambling_lut(void); - +/* uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, uint8_t prach_ConfigIndex, uint8_t n_ra_prboffset, uint8_t tdd_mapindex, uint16_t Nf); - +*/ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame,uint8_t subframe); uint8_t ul_subframe2pdcch_alloc_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t n); @@ -319,6 +321,6 @@ uint32_t conv_1C_RIV(int32_t rballoc,uint32_t N_RB_DL); void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t *rb_alloc2); -int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs); +int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs); #endif diff --git a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h index 5e446db5fd..b3985e973a 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_eNB.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_eNB.h @@ -36,9 +36,9 @@ #include "dci.h" #include "mdci.h" #include "uci_common.h" -#ifndef STANDALONE_COMPILE - #include "UTIL/LISTS/list.h" -#endif +//#ifndef STANDALONE_COMPILE +// #include "UTIL/LISTS/list.h" +//#endif // structures below implement 36-211 and 36-212 diff --git a/openair1/PHY/LTE_TRANSPORT/transport_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_proto.h index 9e37821b05..19af50056c 100644 --- a/openair1/PHY/LTE_TRANSPORT/transport_proto.h +++ b/openair1/PHY/LTE_TRANSPORT/transport_proto.h @@ -520,6 +520,9 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB, void dump_ulsch(PHY_VARS_eNB *phy_vars_eNB,int frame, int subframe, uint8_t UE_id,int round); +void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame); +void dump_uci_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame); + @@ -691,13 +694,11 @@ void conv_eMTC_rballoc(uint16_t resource_block_coding, uint32_t N_RB_DL, uint32_t *rb_alloc); -int16_t find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); +int find_dlsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); -int16_t find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); +int find_ulsch(uint16_t rnti, PHY_VARS_eNB *eNB,find_type_t type); -int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type); - -uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type); +int find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type); uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset); diff --git a/openair1/PHY/LTE_TRANSPORT/uci_tools.c b/openair1/PHY/LTE_TRANSPORT/uci_tools.c index f8ade9afc8..ae039bec2a 100644 --- a/openair1/PHY/LTE_TRANSPORT/uci_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/uci_tools.c @@ -37,12 +37,11 @@ //#define DEBUG_UCI 1 -int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) { - uint16_t i; - int16_t first_free_index=-1; +int find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_type_t type) { + int first_free_index=-1; AssertFatal(eNB!=NULL,"eNB is null\n"); - for (i=0; iuci_vars[i].active >0) && (eNB->uci_vars[i].rnti==rnti) && (eNB->uci_vars[i].frame==frame) && diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c index 92fe777201..ae8c666d18 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_decoding.c @@ -374,7 +374,7 @@ static inline unsigned int lte_gold_unscram(unsigned int *x1, unsigned int *x2, int n; if (reset) { - *x1 = 1+ (1<<31); + *x1 = 1+ (1U<<31); *x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31); // skip first 50 double words (1600 bits) @@ -468,6 +468,35 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, ulsch_harq->Nsymb_pusch, nb_rb); //#endif + + eNB_SCH_STATS_t *stats=NULL; + int first_free=-1; + for (int i=0;iulsch_stats[i].rnti == 0 && first_free == -1) { + first_free = i; + stats=&eNB->ulsch_stats[i]; + } + if (eNB->ulsch_stats[i].rnti == ulsch->rnti) { + stats=&eNB->ulsch_stats[i]; + break; + } + } + if (stats) { + stats->rnti = ulsch->rnti; + stats->round_trials[ulsch_harq->round]++; + stats->frame=proc->frame_rx; + } + if (ulsch_harq->round == 0) { + if (stats) { + stats->current_Qm = Q_m; + stats->current_RI = 1; + stats->total_bytes_tx += ulsch_harq->TBS; + stats->current_TBS = ulsch_harq->TBS; + stats->current_G = ulsch_harq->G; + } + } + + //if (ulsch_harq->round == 0) { // delete for RB shortage pattern // This is a new packet, so compute quantities regarding segmentation ulsch_harq->B = A+24; @@ -1086,3 +1115,44 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB, ret = ulsch_decoding_data_all(eNB,proc, UE_id,harq_pid,llr8_flag); return(ret); } + +#define STATSTRLEN 16384 +void dump_ulsch_stats(FILE *fd,PHY_VARS_eNB *eNB,int frame) { + + char output[16384]; + int stroff=0; + for (int i=0;iulsch_stats[i].rnti>0 && eNB->ulsch_stats[i].round_trials[0]>100) { + for (int aa=0;aaframe_parms.nb_antennas_rx;aa++) + stroff+=sprintf(output+stroff,"ULSCH RNTI %x: ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n", + eNB->ulsch_stats[i].rnti, aa,eNB->ulsch_stats[i].ulsch_power[aa],aa,eNB->ulsch_stats[i].ulsch_noise_power[aa]); + AssertFatal(stroff<(STATSTRLEN-1000),"Increase STATSTRLEN\n"); + stroff+=sprintf(output+stroff,"ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d\n", + eNB->ulsch_stats[i].rnti, + eNB->ulsch_stats[i].round_trials[0], + (double)eNB->ulsch_stats[i].round_trials[1]/eNB->ulsch_stats[i].round_trials[0], + eNB->ulsch_stats[i].round_trials[1], + (double)eNB->ulsch_stats[i].round_trials[2]/eNB->ulsch_stats[i].round_trials[0], + eNB->ulsch_stats[i].round_trials[2], + (double)eNB->ulsch_stats[i].round_trials[3]/eNB->ulsch_stats[i].round_trials[0], + eNB->ulsch_stats[i].round_trials[3]); + stroff+=sprintf(output+stroff,"ULSCH RNTI %x: current_Qm %d, current_G %d, current_TBS %d, current_rate %f,current_RI %d, timing_offset %d, total_bytes RX/SCHED %d/%d\n", + eNB->ulsch_stats[i].rnti, + eNB->ulsch_stats[i].current_Qm, + eNB->ulsch_stats[i].current_G, + eNB->ulsch_stats[i].current_TBS, + (double)eNB->ulsch_stats[i].current_G/eNB->ulsch_stats[i].current_TBS, + eNB->ulsch_stats[i].current_RI, + eNB->ulsch_stats[i].timing_offset, + eNB->ulsch_stats[i].total_bytes_rx, + eNB->ulsch_stats[i].total_bytes_tx); + } + fprintf(fd,"%s",output); +} + +void clear_ulsch_stats(PHY_VARS_eNB *eNB) { + + for (int i=0;iulsch_stats[i],0,sizeof(eNB->ulsch_stats[i])); +} + diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c index eeab616097..3529df8e44 100644 --- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c @@ -31,12 +31,12 @@ */ #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" +//#include "PHY/phy_extern.h" #include "transport_eNB.h" #include "PHY/sse_intrin.h" #include "transport_common_proto.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" -#include "PHY/MODULATION/modulation_eNB.h" +//#include "PHY/MODULATION/modulation_eNB.h" #include "T.h" @@ -45,8 +45,11 @@ //extern int **ulchmag_eren; //eren -static short jitter[8] __attribute__ ((aligned(16))) = {1,0,0,1,0,1,1,0}; -static short jitterc[8] __attribute__ ((aligned(16))) = {0,1,1,0,1,0,0,1}; +static const short jitter[8] __attribute__ ((aligned(16))) = {1,0,0,1,0,1,1,0}; +static const short jitterc[8] __attribute__ ((aligned(16))) = {0,1,1,0,1,0,0,1}; +static const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1}; +static const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1}; + void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH) { #if defined(__x86_64__) || defined(__i386__) @@ -511,7 +514,6 @@ void ulsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, for (i=0; i<(nb_rb*3); i++) { #if defined(__x86_64__) || defined(__i386__) mmtmpU0 = _mm_abs_epi16(rxF[i]); - // print_shorts("tmp0",&tmp0); mmtmpU0 = _mm_subs_epi16(ch_mag[i],mmtmpU0); (*llrp128)[0] = _mm_unpacklo_epi32(rxF[i],mmtmpU0); (*llrp128)[1] = _mm_unpackhi_epi32(rxF[i],mmtmpU0); @@ -627,11 +629,15 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, uint8_t symbol, uint16_t nb_rb) { #if defined(__x86_64__) || defined(__i386__) - __m128i *rxdataF_comp128_0,*ul_ch_mag128_0,*ul_ch_mag128_0b; - __m128i *rxdataF_comp128_1,*ul_ch_mag128_1,*ul_ch_mag128_1b; + __m128i *rxdataF_comp128_0=NULL,*ul_ch_mag128_0=NULL,*ul_ch_mag128_0b=NULL; + __m128i *rxdataF_comp128_1=NULL,*ul_ch_mag128_1=NULL,*ul_ch_mag128_1b=NULL; + __m128i *rxdataF_comp128_2=NULL,*ul_ch_mag128_2=NULL,*ul_ch_mag128_2b=NULL; + __m128i *rxdataF_comp128_3=NULL,*ul_ch_mag128_3=NULL,*ul_ch_mag128_3b=NULL; #elif defined(__arm__) int16x8_t *rxdataF_comp128_0,*ul_ch_mag128_0,*ul_ch_mag128_0b; int16x8_t *rxdataF_comp128_1,*ul_ch_mag128_1,*ul_ch_mag128_1b; + int16x8_t *rxdataF_comp128_2,*ul_ch_mag128_2,*ul_ch_mag128_2b; + int16x8_t *rxdataF_comp128_3,*ul_ch_mag128_3,*ul_ch_mag128_3b; #endif int32_t i; @@ -643,15 +649,39 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, ul_ch_mag128_1 = (__m128i *)&ul_ch_mag[1][symbol*frame_parms->N_RB_DL*12]; ul_ch_mag128_0b = (__m128i *)&ul_ch_magb[0][symbol*frame_parms->N_RB_DL*12]; ul_ch_mag128_1b = (__m128i *)&ul_ch_magb[1][symbol*frame_parms->N_RB_DL*12]; - - // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation) - for (i=0; inb_antennas_rx>2) { + rxdataF_comp128_2 = (__m128i *)&rxdataF_comp[2][symbol*frame_parms->N_RB_DL*12]; + ul_ch_mag128_2 = (__m128i *)&ul_ch_mag[2][symbol*frame_parms->N_RB_DL*12]; + ul_ch_mag128_2b = (__m128i *)&ul_ch_magb[2][symbol*frame_parms->N_RB_DL*12]; + } + if (frame_parms->nb_antennas_rx>3) { + rxdataF_comp128_3 = (__m128i *)&rxdataF_comp[3][symbol*frame_parms->N_RB_DL*12]; + ul_ch_mag128_3 = (__m128i *)&ul_ch_mag[3][symbol*frame_parms->N_RB_DL*12]; + ul_ch_mag128_3b = (__m128i *)&ul_ch_magb[3][symbol*frame_parms->N_RB_DL*12]; } + // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation) + if (frame_parms->nb_antennas_rx==2) + for (i=0; inb_antennas_rx==3) + for (i=0; inb_antennas_rx==4) + for (i=0; iN_RB_DL*12]; rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12]; @@ -795,7 +825,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, mmtmpU0 = _mm_srai_epi32(mmtmpU0,output_shift); mmtmpU1 = _mm_packs_epi32(mmtmpU0,mmtmpU0); ul_ch_mag128[2] = _mm_unpacklo_epi16(mmtmpU1,mmtmpU1); - LOG_D(PHY,"comp: symbol %d rb %d => %d,%d,%d (output_shift %d)\n",symbol,rb,*((int16_t *)&ul_ch_mag128[0]),*((int16_t *)&ul_ch_mag128[1]),*((int16_t *)&ul_ch_mag128[2]),output_shift); + //LOG_I(PHY,"comp: ant %d symbol %d rb %d => %d,%d,%d (output_shift %d)\n",aarx,symbol,rb,*((int16_t *)&ul_ch_mag128[0]),*((int16_t *)&ul_ch_mag128[1]),*((int16_t *)&ul_ch_mag128[2]),output_shift); #elif defined(__arm__) mmtmpU0 = vmull_s16(ul_ch128[0], ul_ch128[0]); mmtmpU0 = vqshlq_s32(vqaddq_s32(mmtmpU0,vrev64q_s32(mmtmpU0)),-output_shift128); @@ -834,6 +864,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, // print_ints("c1",&mmtmpU3); rxdataF_comp128[0] = _mm_packs_epi32(mmtmpU2,mmtmpU3); /* + LOG_I(PHY,"Antenna %d:",aarx); print_shorts("rx:",&rxdataF128[0]); print_shorts("ch:",&ul_ch128[0]); print_shorts("pack:",&rxdataF_comp128[0]); @@ -851,9 +882,12 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1); mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1); rxdataF_comp128[1] = _mm_packs_epi32(mmtmpU2,mmtmpU3); - // print_shorts("rx:",rxdataF128[1]); - // print_shorts("ch:",ul_ch128[1]); - // print_shorts("pack:",rxdataF_comp128[1]); + /* + LOG_I(PHY,"Antenna %d:",aarx); + print_shorts("rx:",&rxdataF128[1]); + print_shorts("ch:",&ul_ch128[1]); + print_shorts("pack:",&rxdataF_comp128[1]); + */ // multiply by conjugated channel mmtmpU0 = _mm_madd_epi16(ul_ch128[2],rxdataF128[2]); // mmtmpU0 contains real part of 4 consecutive outputs (32-bit) @@ -867,9 +901,12 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, mmtmpU2 = _mm_unpacklo_epi32(mmtmpU0,mmtmpU1); mmtmpU3 = _mm_unpackhi_epi32(mmtmpU0,mmtmpU1); rxdataF_comp128[2] = _mm_packs_epi32(mmtmpU2,mmtmpU3); - // print_shorts("rx:",rxdataF128[2]); - // print_shorts("ch:",ul_ch128[2]); - // print_shorts("pack:",rxdataF_comp128[2]); + /* + LOG_I(PHY,"Antenna %d:",aarx); + print_shorts("rx:",&rxdataF128[2]); + print_shorts("ch:",&ul_ch128[2]); + print_shorts("pack:",&rxdataF_comp128[2]); + */ // Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT rxdataF_comp128[0] = _mm_add_epi16(rxdataF_comp128[0],(*(__m128i *)&jitter[0])); rxdataF_comp128[1] = _mm_add_epi16(rxdataF_comp128[1],(*(__m128i *)&jitter[0])); @@ -1078,6 +1115,15 @@ void rx_ulsch(PHY_VARS_eNB *eNB, } for (i=0; inb_antennas_rx; i++) { + pusch_vars->ulsch_power[i] = signal_energy_nodc(pusch_vars->drs_ch_estimates[i], + ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12)/correction_factor; + LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, + ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_x10(pusch_vars->ulsch_power[i])); + pusch_vars->ulsch_noise_power[i]=0; + for (int rb=0;rbharq_processes[harq_pid]->nb_rb;rb++) + pusch_vars->ulsch_noise_power[i]+=eNB->measurements.n0_subband_power[i][rb]/ulsch[UE_id]->harq_processes[harq_pid]->nb_rb; + LOG_D(PHY,"noise power[%d] %d\n",i,dB_fixed_x10(pusch_vars->ulsch_noise_power[i])); +/* Check this modification w.r.t to new PUSCH modifications //symbol 3 int symbol_offset = frame_parms->N_RB_UL*12*(3 - frame_parms->Ncp); pusch_vars->ulsch_interference_power[i] = interference_power(&pusch_vars->drs_ch_estimates[i][symbol_offset],ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12); @@ -1100,7 +1146,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB, } LOG_D(PHY,"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10\n", proc->frame_rx, proc->subframe_rx, harq_pid, ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, ulsch[UE_id]->harq_processes[harq_pid]->TBS,MPR_times_100Ks,correction_factor,dB_fixed_x10(pusch_vars->ulsch_power[i])); - + */ } ulsch_channel_level(pusch_vars->drs_ch_estimates, @@ -1113,8 +1159,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB, for (aarx=0; aarxnb_antennas_rx; aarx++) avgs = cmax(avgs,avgU[aarx]); - // log2_maxh = 4+(log2_approx(avgs)/2); - log2_maxh = (log2_approx(avgs)/2)+ log2_approx(frame_parms->nb_antennas_rx-1)+4; + log2_maxh = 4+(log2_approx(avgs)/2); LOG_D(PHY,"[ULSCH] log2_maxh = %d (%d,%d)\n",log2_maxh,avgU[0],avgs); for (l=0; l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active); l++) { @@ -1221,67 +1266,56 @@ void dump_ulsch(PHY_VARS_eNB *eNB,int frame,int subframe,uint8_t UE_id,int round uint8_t harq_pid; char fname[100],vname[100]; harq_pid = subframe2harq_pid(&eNB->frame_parms,frame,subframe); - LOG_UI(PHY,"Dumping ULSCH in subframe %d with harq_pid %d, round %d for NB_rb %d, TBS %d, Qm %d, N_symb %d\n", + LOG_UI(PHY,"Dumping ULSCH in subframe %d with harq_pid %d, round %d for NB_rb %d, first_rb %d, TBS %d, Qm %d, N_symb %d\n", subframe,harq_pid,round,eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb, + eNB->ulsch[UE_id]->harq_processes[harq_pid]->first_rb, eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS,eNB->ulsch[UE_id]->harq_processes[harq_pid]->Qm, eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_pusch); + for (int aa=0;aaframe_parms.nb_antennas_rx;aa++) + LOG_UI(PHY,"ulsch_power[%d] %d, ulsch_noise_power[%d] %d\n",aa,dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_power[aa]),aa,dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_noise_power[aa])); sprintf(fname,"/tmp/ulsch_r%d_d",round); sprintf(vname,"/tmp/ulsch_r%d_dseq",round); LOG_UM(fname,vname,&eNB->ulsch[UE_id]->harq_processes[harq_pid]->d[0][96], eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus*3,1,0); if (eNB->common_vars.rxdata) { - sprintf(fname,"/tmp/rxsig0_r%d.m",round); - sprintf(vname,"rxs0_r%d",round); - LOG_UM(fname,vname, &eNB->common_vars.rxdata[0][0],eNB->frame_parms.samples_per_tti*10,1,1); + for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) { + sprintf(fname,"/tmp/rxsig%d_r%d.m",aarx,round); + sprintf(vname,"rxs%d_r%d",aarx,round); + LOG_UM(fname,vname, &eNB->common_vars.rxdata[aarx][0],eNB->frame_parms.samples_per_tti*10,1,1); - if (eNB->frame_parms.nb_antennas_rx>1) - if (eNB->common_vars.rxdata) { - sprintf(fname,"/tmp/rxsig1_r%d.m",round); - sprintf(vname,"rxs1_r%d",round); - LOG_UM(fname,vname, &eNB->common_vars.rxdata[1][0],eNB->frame_parms.samples_per_tti*10,1,1); - } + } } - - sprintf(fname,"/tmp/rxsigF0_r%d.m",round); - sprintf(vname,"rxsF0_r%d",round); - LOG_UM(fname,vname, (void *)&eNB->common_vars.rxdataF[0][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1); - - if (eNB->frame_parms.nb_antennas_rx>1) { - sprintf(fname,"/tmp/rxsigF1_r%d.m",round); - sprintf(vname,"rxsF1_r%d",round); - LOG_UM(vname,fname, &eNB->common_vars.rxdataF[1][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1); + if (eNB->common_vars.rxdataF) { + for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) { + sprintf(fname,"/tmp/rxsigF%d_r%d.m",aarx,round); + sprintf(vname,"rxsF%d_r%d",aarx,round); + LOG_UM(fname,vname, (void *)&eNB->common_vars.rxdataF[aarx][0],eNB->frame_parms.ofdm_symbol_size*nsymb,1,1); + } } - - sprintf(fname,"/tmp/rxsigF0_ext_r%d.m",round); - sprintf(vname,"rxsF0_ext_r%d",round); - LOG_UM(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1); - - if (eNB->frame_parms.nb_antennas_rx>1) { - sprintf(fname,"/tmp/rxsigF1_ext_r%d.m",round); - sprintf(vname,"rxsF1_ext_r%d",round); - LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_ext[1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1); + if (eNB->pusch_vars[UE_id]->rxdataF_ext) { + for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) { + sprintf(fname,"/tmp/rxsigF%d_ext_r%d.m",aarx,round); + sprintf(vname,"rxsF%d_ext_r%d",aarx,round); + LOG_UM(fname,vname, &eNB->pusch_vars[UE_id]->rxdataF_ext[aarx][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1); + } } - /* if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est0.m","srsest0",eNB->srs_vars[UE_id].srs_ch_estimates[0],eNB->frame_parms.ofdm_symbol_size,1,1); if (eNB->frame_parms.nb_antennas_rx>1) if (eNB->srs_vars[UE_id].srs_ch_estimates) LOG_UM("/tmp/srs_est1.m","srsest1",eNB->srs_vars[UE_id].srs_ch_estimates[1],eNB->frame_parms.ofdm_symbol_size,1,1); */ - sprintf(fname,"/tmp/drs_est0_r%d.m",round); - sprintf(vname,"drsest0_r%d",round); - LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1); + for (int aarx=0;aarxframe_parms.nb_antennas_rx;aarx++) { + sprintf(fname,"/tmp/drs_est%d_r%d.m",aarx,round); + sprintf(vname,"drsest%d_r%d",aarx,round); + LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[aarx],eNB->frame_parms.N_RB_UL*12*nsymb,1,1); - if (eNB->frame_parms.nb_antennas_rx>1) { - sprintf(fname,"/tmp/drs_est1_r%d.m",round); - sprintf(vname,"drsest1_r%d",round); - LOG_UM(fname,vname,eNB->pusch_vars[UE_id]->drs_ch_estimates[1],eNB->frame_parms.N_RB_UL*12*nsymb,1,1); + sprintf(fname,"/tmp/ulsch%d_rxF_comp0_r%d.m",aarx,round); + sprintf(vname,"ulsch_rxF%d_comp0_r%d",aarx,round); + LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[aarx][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1); } - sprintf(fname,"/tmp/ulsch0_rxF_comp0_r%d.m",round); - sprintf(vname,"ulsch0_rxF_comp0_r%d",round); - LOG_UM(fname,vname,&eNB->pusch_vars[UE_id]->rxdataF_comp[0][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1); // LOG_M("ulsch_rxF_comp1.m","ulsch0_rxF_comp1",&eNB->pusch_vars[UE_id]->rxdataF_comp[0][1][0],eNB->frame_parms.N_RB_UL*12*nsymb,1,1); sprintf(fname,"/tmp/ulsch_rxF_llr_r%d.m",round); sprintf(vname,"ulsch_llr_r%d",round); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c index 7442a0ae7e..39900113b7 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c @@ -78,7 +78,7 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_ switch (N_RB_DL) { case 6: - bw_scaling =16; + bw_scaling =4; break; case 25: @@ -276,7 +276,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, switch (frame_parms->N_RB_DL) { case 6: - bw_scaling =16; + bw_scaling =4; break; case 25: diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c index ab7c2b9091..929f63e9fc 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c @@ -41,6 +41,7 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "../LTE_TRANSPORT/prach_extern.h" +#include "common/utils/lte/prach_utils.h" //#define PRACH_DEBUG 1 @@ -115,7 +116,9 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1 NCS = NCS_restricted[Ncs_config]; } - n_ra_prb = get_prach_prb_offset(&(ue->frame_parms), + n_ra_prb = get_prach_prb_offset(ue->frame_parms.frame_type, + ue->frame_parms.tdd_config, + ue->frame_parms.N_RB_UL, ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex, ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset, tdd_mapindex, Nf); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c index e6960273c7..9c0edb467c 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c @@ -170,6 +170,7 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms, Msc_RS = msrsb * 6; k0 = ( ( (int16_t)(frame_parms->N_RB_UL>>1) - (int16_t)(msrs0>>1) ) * 12 ) + kTC; + AssertFatal(msrsb,"divide by 0"); nb = (4*n_RRC/msrsb)%Nb; for (b=0; b<=Bsrs; b++) { diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index 3299401443..7ab795cae9 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -1740,10 +1740,5 @@ double computeRhoB_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated, LTE_UE_DLSCH_t *dlsch_ue); */ -uint8_t get_prach_prb_offset(LTE_DL_FRAME_PARMS *frame_parms, - uint8_t prach_ConfigIndex, - uint8_t n_ra_prboffset, - uint8_t tdd_mapindex, uint16_t Nf); - /**@}*/ #endif diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h index 4c433a5683..6b84a5f969 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_ue.h @@ -36,9 +36,11 @@ #include "../LTE_TRANSPORT/mdci.h" #include "../LTE_TRANSPORT/uci_common.h" #include "../LTE_TRANSPORT/transport_common.h" +/* #ifndef STANDALONE_COMPILE #include "UTIL/LISTS/list.h" #endif +*/ #include "../LTE_TRANSPORT/transport_common.h" diff --git a/openair1/PHY/MODULATION/beamforming.c b/openair1/PHY/MODULATION/beamforming.c index b1f419b172..d592aa466e 100644 --- a/openair1/PHY/MODULATION/beamforming.c +++ b/openair1/PHY/MODULATION/beamforming.c @@ -44,7 +44,6 @@ #include "PHY/defs_common.h" #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" #include "PHY/CODING/coding_defs.h" #include "PHY/CODING/coding_extern.h" #include "PHY/CODING/lte_interleaver_inline.h" @@ -145,7 +144,8 @@ int nr_beam_precoding(int32_t **txdataF, int slot, int symbol, int aa, - int nb_antenna_ports) + int nb_antenna_ports, + int offset) { @@ -155,14 +155,14 @@ int nr_beam_precoding(int32_t **txdataF, memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],0,sizeof(int32_t)*(frame_parms->ofdm_symbol_size)); for (p=0; pL_ssb >> (63-p)) & 0x01) { - multadd_cpx_vector((int16_t*)&txdataF[p][symbol*frame_parms->ofdm_symbol_size], + //if ((frame_parms->L_ssb >> (63-p)) & 0x01) { + multadd_cpx_vector((int16_t*)&txdataF[p][(symbol*frame_parms->ofdm_symbol_size)+offset], (int16_t*)beam_weights[p][aa], (int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 0, frame_parms->ofdm_symbol_size, 15); - } + //} } return 0; } diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index f12dcfc01b..e32f6bf575 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -22,6 +22,101 @@ #include "nr_modulation.h" #include "PHY/NR_REFSIG/nr_mod_table.h" +//Table 6.3.1.5-1 Precoding Matrix W 1 layer 2 antenna ports 'n' = -1 and 'o' = -j +char nr_W_1l_2p[6][2][1] = { + {{'1'}, {'0'}},//pmi 0 + {{'0'}, {'1'}}, + {{'1'}, {'1'}}, + {{'1'}, {'n'}}, + {{'1'}, {'j'}}, + {{'1'}, {'o'}}//pmi 5 +}; + +//Table 6.3.1.5-3 Precoding Matrix W 1 layer 4 antenna ports 'n' = -1 and 'o' = -j +char nr_W_1l_4p[28][4][1] = { + {{'1'}, {'0'}, {'0'}, {'0'}},//pmi 0 + {{'0'}, {'1'}, {'0'}, {'0'}}, + {{'0'}, {'0'}, {'1'}, {'0'}}, + {{'0'}, {'0'}, {'0'}, {'1'}}, + {{'1'}, {'0'}, {'1'}, {'0'}}, + {{'1'}, {'0'}, {'n'}, {'0'}}, + {{'1'}, {'0'}, {'j'}, {'0'}}, + {{'1'}, {'0'}, {'o'}, {'0'}},//pmi 7 + {{'0'}, {'1'}, {'0'}, {'1'}},//pmi 8 + {{'0'}, {'1'}, {'0'}, {'n'}}, + {{'0'}, {'1'}, {'0'}, {'j'}}, + {{'0'}, {'1'}, {'0'}, {'o'}}, + {{'1'}, {'1'}, {'1'}, {'1'}}, + {{'1'}, {'1'}, {'j'}, {'j'}}, + {{'1'}, {'1'}, {'n'}, {'n'}}, + {{'1'}, {'1'}, {'o'}, {'o'}}, + {{'1'}, {'j'}, {'1'}, {'j'}},//pmi 16 + {{'1'}, {'j'}, {'j'}, {'n'}}, + {{'1'}, {'j'}, {'n'}, {'o'}}, + {{'1'}, {'j'}, {'o'}, {'1'}}, + {{'1'}, {'n'}, {'1'}, {'n'}}, + {{'1'}, {'n'}, {'j'}, {'o'}}, + {{'1'}, {'n'}, {'n'}, {'1'}}, + {{'1'}, {'n'}, {'o'}, {'j'}},//pmi 23 + {{'1'}, {'o'}, {'1'}, {'o'}},//pmi 24 + {{'1'}, {'o'}, {'j'}, {'1'}}, + {{'1'}, {'o'}, {'n'}, {'j'}}, + {{'1'}, {'o'}, {'o'}, {'n'}}//pmi 27 +}; + +//Table 6.3.1.5-4 Precoding Matrix W 2 antenna ports layers 2 'n' = -1 and 'o' = -j +char nr_W_2l_2p[3][2][2] = { + {{'1', '0'}, {'0', '1'}},//pmi 0 + {{'1', '1'}, {'1', 'n'}}, + {{'1', '1'}, {'j', 'o'}} //pmi 2 +}; + +//Table 6.3.1.5-5 Precoding Matrix W 2 layers 4 antenna ports 'n' = -1 and 'o' = -j +char nr_W_2l_4p[22][4][2] = { + {{'1', '0'}, {'0', '1'}, {'0', '0'}, {'0', '0'}},//pmi 0 + {{'1', '0'}, {'0', '0'}, {'0', '1'}, {'0', '0'}}, + {{'1', '0'}, {'0', '0'}, {'0', '0'}, {'0', '1'}}, + {{'0', '0'}, {'1', '0'}, {'0', '1'}, {'0', '0'}},//pmi 3 + {{'0', '0'}, {'1', '0'}, {'0', '0'}, {'0', '1'}},//pmi 4 + {{'0', '0'}, {'0', '0'}, {'1', '0'}, {'0', '1'}}, + {{'1', '0'}, {'0', '1'}, {'1', '0'}, {'0', 'o'}}, + {{'1', '0'}, {'0', '1'}, {'1', '0'}, {'0', 'j'}}, + {{'1', '0'}, {'0', '1'}, {'o', '0'}, {'0', '1'}},//pmi 8 + {{'1', '0'}, {'0', '1'}, {'o', '0'}, {'0', 'n'}}, + {{'1', '0'}, {'0', '1'}, {'n', '0'}, {'0', 'o'}}, + {{'1', '0'}, {'0', '1'}, {'n', '0'}, {'0', 'j'}},//pmi 11 + {{'1', '0'}, {'0', '1'}, {'j', '0'}, {'0', '1'}},//pmi 12 + {{'1', '0'}, {'0', '1'}, {'j', '0'}, {'0', 'n'}}, + {{'1', '1'}, {'1', '1'}, {'1', 'n'}, {'1', 'n'}}, + {{'1', '1'}, {'1', '1'}, {'j', 'o'}, {'j', 'o'}},//pmi 15 + {{'1', '1'}, {'j', 'j'}, {'1', 'n'}, {'j', 'o'}},//pmi 16 + {{'1', '1'}, {'j', 'j'}, {'j', 'o'}, {'n', '1'}}, + {{'1', '1'}, {'n', 'n'}, {'1', 'n'}, {'n', '1'}}, + {{'1', '1'}, {'n', 'n'}, {'j', 'o'}, {'o', 'j'}},//pmi 19 + {{'1', '1'}, {'o', 'o'}, {'1', 'n'}, {'o', 'j'}}, + {{'1', '1'}, {'o', 'o'}, {'j', 'o'}, {'1', 'n'}}//pmi 21 +}; + +//Table 6.3.1.5-6 Precoding Matrix W 3 layers 4 antenna ports 'n' = -1 and 'o' = -j +char nr_W_3l_4p[7][4][3] = { + {{'1', '0', '0'}, {'0', '1', '0'}, {'0', '0', '1'},{'0', '0', '0'}},//pmi 0 + {{'1', '0', '0'}, {'0', '1', '0'}, {'1', '0', '0'},{'0', '0', '1'}}, + {{'1', '0', '0'}, {'0', '1', '0'}, {'n', '0', '0'},{'0', '0', '1'}}, + {{'1', '1', '1'}, {'1', 'n', '1'}, {'1', '1', 'n'},{'1', 'n', 'n'}},//pmi 3 + {{'1', '1', '1'}, {'1', 'n', '1'}, {'j', 'j', 'o'},{'j', 'o', 'o'}},//pmi 4 + {{'1', '1', '1'}, {'n', '1', 'n'}, {'1', '1', 'n'},{'n', '1', '1'}}, + {{'1', '1', '1'}, {'n', '1', 'n'}, {'j', 'j', 'o'},{'o', 'j', 'j'}} +}; + +//Table 6.3.1.5-7 Precoding Matrix W 4 layers 4 antenna ports 'n' = -1 and 'o' = -j +char nr_W_4l_4p[5][4][4] = { + {{'1', '0', '0', '0'}, {'0', '1', '0', '0'}, {'0', '0', '1', '0'}, {'0', '0', '0', '1'}},//pmi 0 + {{'1', '1', '0', '0'}, {'0', '0', '1', '1'}, {'1', 'n', '0', '0'}, {'0', '0', '1', 'n'}}, + {{'1', '1', '0', '0'}, {'0', '0', '1', '1'}, {'j', 'o', '0', '0'}, {'0', '0', 'j', 'o'}}, + {{'1', '1', '1', '1'}, {'1', 'n', '1', 'n'}, {'1', '1', 'n', 'n'}, {'1', 'n', 'n', '1'}},//pmi 3 + {{'1', '1', '1', '1'}, {'1', 'n', '1', 'n'}, {'j', 'j', 'o', 'o'}, {'j', 'o', 'o', 'j'}}//pmi 4 +}; + void nr_modulation(uint32_t *in, uint32_t length, uint16_t mod_order, @@ -37,7 +132,7 @@ void nr_modulation(uint32_t *in, uint32_t i,j; uint32_t bit_cnt; uint64_t x,x1,x2; - + #if defined(__SSE2__) __m128i *nr_mod_table128; __m128i *out128; @@ -56,7 +151,7 @@ void nr_modulation(uint32_t *in, // the bits that are left out i = i*8/2; nr_mod_table32 = (int32_t*) nr_qpsk_mod_table; - while (i>((i*2)&0x7)) & mask); out32[i] = nr_mod_table32[idx]; i++; @@ -78,7 +173,7 @@ void nr_modulation(uint32_t *in, out64[i] = nr_16qam_byte_mod_table[in_bytes[i]]; // the bits that are left out i = i*8/4; - while (i>((i*4)&0x7)) & mask); out32[i] = nr_16qam_mod_table[idx]; i++; @@ -88,7 +183,7 @@ void nr_modulation(uint32_t *in, case 6: j = 0; for (i=0; i>12)&4095; @@ -140,7 +235,7 @@ void nr_modulation(uint32_t *in, bit_cnt += 24; } return; - + case 8: nr_mod_table32 = (int32_t*) nr_256qam_mod_table; for (i=0; i>1; i++) @@ -186,8 +281,8 @@ void nr_layer_mapping(int16_t **mod_symbs, for (int l=2; l<5; l++) { tx_layers[l][i<<1] = mod_symbs[1][(3*i+l)<<1]; tx_layers[l][(i<<1)+1] = mod_symbs[1][((3*i+l)<<1)+1]; - } - break; + } + break; case 6: for (int q=0; q<2; q++) @@ -196,7 +291,7 @@ void nr_layer_mapping(int16_t **mod_symbs, tx_layers[l][i<<1] = mod_symbs[q][(3*i+l)<<1]; tx_layers[l][(i<<1)+1] = mod_symbs[q][((3*i+l)<<1)+1]; } - break; + break; case 7: for (int i=0; id_mod; - for (int i=0; i>15; tx_layers[0][(i<<1)+1] = (mod_symbs[(i<<1)+1]*AMP)>>15; } - break; + break; case 2: case 3: case 4: mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; - for (int i=0; i>15; tx_layers[l][(i<<1)+1] = (mod_symbs[((n_layers*i+l)<<1)+1]*AMP)>>15; } } - break; + break; case 5: mod_symbs = (int16_t *)ulsch_ue[0]->d_mod; @@ -271,11 +366,10 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15; tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15; } - break; + break; case 6: - for (int q=0; q<2; q++){ - + for (int q=0; q<2; q++) { mod_symbs = (int16_t *)ulsch_ue[q]->d_mod; for (int i=0; i>15; } } - break; + break; case 7: mod_symbs = (int16_t *)ulsch_ue[1]->d_mod; @@ -302,11 +396,10 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15; tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15; } - break; + break; case 8: - for (int q=0; q<2; q++){ - + for (int q=0; q<2; q++) { mod_symbs = (int16_t *)ulsch_ue[q]->d_mod; for (int i=0; i>2; i++) @@ -315,10 +408,10 @@ void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue, tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15; } } - break; + break; - default: - AssertFatal(0, "Invalid number of layers %d\n", n_layers); + default: + AssertFatal(0, "Invalid number of layers %d\n", n_layers); } } @@ -651,3 +744,43 @@ void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) { } } } + +int nr_layer_precoder(int16_t **datatx_F_precoding, char *prec_matrix, uint8_t n_layers, int32_t re_offset) +{ + int32_t precodatatx_F = 0; + + for (int al = 0; al>15); + ((int16_t *)precodatatx_F)[1] = (int16_t)((((int16_t *)precodatatx_F)[1]*ONE_OVER_SQRT2_Q15)>>15);*/ +} diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index 841073a1af..547d20952f 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -28,7 +28,13 @@ #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #define DMRS_MOD_ORDER 2 - +/*Precoding matices: W[pmi][antenna_port][layer]*/ +extern char nr_W_1l_2p[6][2][1]; +extern char nr_W_2l_2p[3][2][2]; +extern char nr_W_1l_4p[28][4][1]; +extern char nr_W_2l_4p[22][4][2]; +extern char nr_W_3l_4p[7][4][3]; +extern char nr_W_4l_4p[5][4][4]; /*! \brief Perform NR modulation. TS 38.211 V15.4.0 subclause 5.1 @param[in] in, Pointer to input bits @param[in] length, size of input bits @@ -98,7 +104,8 @@ int nr_beam_precoding(int32_t **txdataF, int slot, int symbol, int aa, - int nb_antenna_ports + int nb_antenna_ports, + int offset ); void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, @@ -116,4 +123,14 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, int first_symbol, int nsymb, int length); + +/*! \brief Perform NR precoding. TS 38.211 V15.4.0 subclause 6.3.1.5 + @param[in] datatx_F_precoding, Pointer to n_layers*re data array + @param[in] prec_matrix, Pointer to precoding matrix + @param[in] n_layers, number of DLSCH layers +*/ +int nr_layer_precoder(int16_t **datatx_F_precoding, + char *prec_matrix, + uint8_t n_layers, + int32_t re_offset); #endif diff --git a/openair1/PHY/MODULATION/slot_fep_ul.c b/openair1/PHY/MODULATION/slot_fep_ul.c index 746f8dbc0e..ccb7ee5f3e 100644 --- a/openair1/PHY/MODULATION/slot_fep_ul.c +++ b/openair1/PHY/MODULATION/slot_fep_ul.c @@ -20,8 +20,8 @@ */ #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" -#include "modulation_eNB.h" +//#include "PHY/phy_extern.h" +//#include "modulation_eNB.h" //#define DEBUG_FEP diff --git a/openair1/PHY/MODULATION/ul_7_5_kHz.c b/openair1/PHY/MODULATION/ul_7_5_kHz.c index a5b428a813..384b9d621c 100644 --- a/openair1/PHY/MODULATION/ul_7_5_kHz.c +++ b/openair1/PHY/MODULATION/ul_7_5_kHz.c @@ -20,7 +20,6 @@ */ #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" #include #include "PHY/sse_intrin.h" #include "modulation_extern.h" diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index a54aec7bc2..d3e33a91a8 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -20,12 +20,12 @@ */ /*! \file PHY/NR_ESTIMATION/nr_measurements_gNB.c -* \brief TA estimation for TA updates -* \author Ahmed Hussein +* \brief gNB measurement routines +* \author Ahmed Hussein, G. Casati, K. Saaifan * \date 2019 * \version 0.1 * \company Fraunhofer IIS -* \email: ahmed.hussein@iis.fraunhofer.de +* \email: ahmed.hussein@iis.fraunhofer.de, guido.casati@iis.fraunhofer.de, khodr.saaifan@iis.fraunhofer.de * \note * \warning */ @@ -35,6 +35,8 @@ #include "PHY/phy_extern.h" #include "nr_ul_estimation.h" +extern openair0_config_t openair0_cfg[MAX_CARDS]; + int nr_est_timing_advance_pusch(PHY_VARS_gNB* gNB, int UE_id) { int i, aa, max_pos = 0, max_val = 0; @@ -73,14 +75,17 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB) { NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_gNB_COMMON *common_vars = &gNB->common_vars; PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements; + NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; + double rx_gain = openair0_cfg[0].rx_gain[0]; + double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; uint32_t *rb_mask = gNB->rb_mask_ul; int symbol = gNB->ulmask_symb; int rb, offset, nb_rb; - uint32_t n0_power_tot, n0_subband_power_temp=0; + uint32_t n0_subband_power_temp = 0; int32_t *ul_ch; if (symbol>-1) { - n0_power_tot = 0; + measurements->n0_power_tot = 0; for (int aarx=0; aarxnb_antennas_rx; aarx++) { nb_rb = 0; for (rb=0; rbN_RB_UL; rb++) { @@ -93,11 +98,76 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB) { n0_subband_power_temp += signal_energy_nodc(ul_ch,12); } } - measurements->n0_power[aarx] = n0_subband_power_temp/nb_rb; - measurements->n0_power_dB[aarx] = dB_fixed(measurements->n0_power[aarx]); - n0_power_tot += measurements->n0_power[aarx]; + + if (nb_rb != 0) { + measurements->n0_power[aarx] = n0_subband_power_temp/nb_rb; + measurements->n0_power_dB[aarx] = dB_fixed(measurements->n0_power[aarx]); + measurements->n0_power_tot += measurements->n0_power[aarx]; + } + } - measurements->n0_power_tot_dB = dB_fixed(n0_power_tot); + + measurements->n0_power_tot_dB = dB_fixed(measurements->n0_power_tot); + measurements->n0_power_tot_dBm = measurements->n0_power_tot_dB + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size); + + LOG_D(PHY, "In %s: tot n0 power %d dBm for %d RBs (tot N0 power = %d)\n", __FUNCTION__, measurements->n0_power_tot_dBm, nb_rb, measurements->n0_power_tot); + } } +// Scope: This function computes the UL SNR from the UL channel estimates +// +// Todo: +// - averaging IIR filter for RX power and noise +void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol){ + + int rx_power_tot[NUMBER_OF_NR_ULSCH_MAX]; + int rx_power[NUMBER_OF_NR_ULSCH_MAX][NB_ANTENNAS_RX]; + unsigned short rx_power_avg_dB[NUMBER_OF_NR_ULSCH_MAX]; + unsigned short rx_power_tot_dB[NUMBER_OF_NR_ULSCH_MAX]; + + double rx_gain = openair0_cfg[0].rx_gain[0]; + double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; + PHY_MEASUREMENTS_gNB *meas = &gNB->measurements; + NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; + int ch_offset = fp->ofdm_symbol_size * symbol; + int N_RB_UL = gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu.rb_size; + + rx_power_tot[ulsch_id] = 0; + + for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){ + + rx_power[ulsch_id][aarx] = 0; + + for (int aatx = 0; aatx < fp->nb_antennas_tx; aatx++){ + + meas->rx_spatial_power[ulsch_id][aatx][aarx] = (signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][ch_offset], N_RB_UL * NR_NB_SC_PER_RB)); + + if (meas->rx_spatial_power[ulsch_id][aatx][aarx] < 0) { + meas->rx_spatial_power[ulsch_id][aatx][aarx] = 0; + } + + meas->rx_spatial_power_dB[ulsch_id][aatx][aarx] = (unsigned short) dB_fixed(meas->rx_spatial_power[ulsch_id][aatx][aarx]); + rx_power[ulsch_id][aarx] += meas->rx_spatial_power[ulsch_id][aatx][aarx]; + + } + + rx_power_tot[ulsch_id] += rx_power[ulsch_id][aarx]; + + } + + rx_power_tot_dB[ulsch_id] = (unsigned short) dB_fixed(rx_power_tot[ulsch_id]); + rx_power_avg_dB[ulsch_id] = rx_power_tot_dB[ulsch_id]; + + meas->wideband_cqi_tot[ulsch_id] = dB_fixed2(rx_power_tot[ulsch_id], meas->n0_power_tot); + meas->rx_rssi_dBm[ulsch_id] = rx_power_avg_dB[ulsch_id] + 30 - 10 * log10(pow(2, 30)) - (rx_gain - rx_gain_offset) - dB_fixed(fp->ofdm_symbol_size); + + LOG_D(PHY, "[ULSCH %d] RSSI %d dBm/RE, RSSI (digital) %d dB (N_RB_UL %d), WBand CQI tot %d dB, N0 Power tot %d\n", + ulsch_id, + meas->rx_rssi_dBm[ulsch_id], + rx_power_avg_dB[ulsch_id], + N_RB_UL, + meas->wideband_cqi_tot[ulsch_id], + meas->n0_power_tot); + +} diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 10ac23bef0..f901bfdded 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -73,7 +73,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, symbol_offset = gNB->frame_parms.ofdm_symbol_size*symbol; k = bwp_start_subcarrier; - int re_offset = k; + int re_offset; uint16_t nb_rb_pusch = pusch_pdu->rb_size; @@ -128,7 +128,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, //------------------generate DMRS------------------// if (pusch_pdu->transform_precoding == transform_precoder_disabled) { - nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, pusch_pdu->rb_start*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type); + nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, (pusch_pdu->bwp_start + pusch_pdu->rb_start)*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type); } else { // if transform precoding or SC-FDMA is enabled in Uplink @@ -170,6 +170,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, pil = (int16_t *)&pilot[0]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+nushift)]; ul_ch = (int16_t *)&ul_ch_estimates[aarx][ch_offset]; + re_offset = k; memset(ul_ch,0,4*(gNB->frame_parms.ofdm_symbol_size)); diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h index a463e21839..7bd004a4d4 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h @@ -49,8 +49,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, void gNB_I0_measurements(PHY_VARS_gNB *gNB); -int nr_est_timing_advance_pusch(PHY_VARS_gNB* phy_vars_gNB, int UE_id); +void nr_gnb_measurements(PHY_VARS_gNB *gNB, uint8_t ulsch_id, unsigned char harq_pid, unsigned char symbol); +int nr_est_timing_advance_pusch(PHY_VARS_gNB* phy_vars_gNB, int UE_id); void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, NR_DL_FRAME_PARMS *frame_parms, diff --git a/openair1/PHY/NR_REFSIG/dmrs_nr.c b/openair1/PHY/NR_REFSIG/dmrs_nr.c index 03a37e2b27..2e270318f8 100644 --- a/openair1/PHY/NR_REFSIG/dmrs_nr.c +++ b/openair1/PHY/NR_REFSIG/dmrs_nr.c @@ -150,7 +150,7 @@ void pseudo_random_sequence_optimised(unsigned int size, uint32_t *c, uint32_t c unsigned int n,x1,x2; /* init of m-sequences */ - x1 = 1+ (1<<31); + x1 = 1+ (1U<<31); x2 = cinit; x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31); diff --git a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c index b0f9e6d03c..9ed2bd949f 100644 --- a/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c +++ b/openair1/PHY/NR_REFSIG/nr_gen_mod_table.c @@ -21,6 +21,18 @@ #include "nr_refsig.h" #include "nr_mod_table.h" +short nr_qpsk_mod_table[8]; + +int32_t nr_16qam_mod_table[16]; +#if defined(__SSE2__) +__m128i nr_qpsk_byte_mod_table[2048]; +#endif + +int64_t nr_16qam_byte_mod_table[1024]; + +int64_t nr_64qam_mod_table[4096]; + +int32_t nr_256qam_mod_table[512]; void nr_generate_modulation_table() { float sqrt2 = 0.70711; diff --git a/openair1/PHY/NR_REFSIG/nr_gold_ue.c b/openair1/PHY/NR_REFSIG/nr_gold_ue.c index eefa6270ab..623b86edfb 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold_ue.c +++ b/openair1/PHY/NR_REFSIG/nr_gold_ue.c @@ -52,22 +52,15 @@ void nr_gold_pbch(PHY_VARS_NR_UE* ue) } void nr_gold_pdcch(PHY_VARS_NR_UE* ue, - unsigned short n_idDMRS, - unsigned short length_dmrs) + unsigned short nid) { unsigned char ns,l; unsigned int n,x1,x2,x2tmp0; - unsigned int nid; uint8_t reset; - if (n_idDMRS) - nid = n_idDMRS; - else - nid = ue->frame_parms.Nid_cell; - for (ns=0; nsframe_parms.slots_per_frame; ns++) { - for (l=0; lframe_parms.symbols_per_slot; l++) { reset = 1; x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; @@ -82,11 +75,10 @@ void nr_gold_pdcch(PHY_VARS_NR_UE* ue, } void nr_gold_pdsch(PHY_VARS_NR_UE* ue, - unsigned char ns, unsigned short *n_idDMRS) { unsigned char l; - unsigned int n,x1,x2,x2tmp0; + unsigned int n,x1,x2,x2tmp0,ns; int nscid; unsigned int nid; uint8_t reset; @@ -95,23 +87,21 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, //unsigned short lbar = 0; for (nscid=0; nscid<2; nscid++) { - if (n_idDMRS) + for (ns=0; nsframe_parms.slots_per_frame; ns++) { + nid = n_idDMRS[nscid]; - else - nid = ue->frame_parms.Nid_cell; - //printf("gold pdsch nid %d lbar %d\n",nid,lbar); + for (l=0; lframe_parms.symbols_per_slot; l++) { - for (l=0; lframe_parms.symbols_per_slot; l++) { + reset = 1; + x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; + x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit + LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); - reset = 1; - x2tmp0 = ((ue->frame_parms.symbols_per_slot*ns+l+1)*((nid<<1)+1))<<17; - x2 = (x2tmp0+(nid<<1)+nscid)%(1<<31); //cinit - LOG_D(PHY,"UE DMRS slot %d, symb %d, x2 %x, nscid %d\n",ns,l,x2,nscid); - - for (n=0; nnr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset); - reset = 0; + for (n=0; nnr_gold_pdsch[0][ns][l][nscid][n] = lte_gold_generic(&x1, &x2, reset); + reset = 0; + } } } } diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index aa8b99f584..2c6964fe96 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -29,16 +29,16 @@ #define NR_MOD_TABLE_QAM64_OFFSET 23 #define NR_MOD_TABLE_QAM256_OFFSET 87 -short nr_qpsk_mod_table[8]; +extern short nr_qpsk_mod_table[8]; -int32_t nr_16qam_mod_table[16]; +extern int32_t nr_16qam_mod_table[16]; #if defined(__SSE2__) -__m128i nr_qpsk_byte_mod_table[2048]; +extern __m128i nr_qpsk_byte_mod_table[2048]; #endif -int64_t nr_16qam_byte_mod_table[1024]; +extern int64_t nr_16qam_byte_mod_table[1024]; -int64_t nr_64qam_mod_table[4096]; +extern int64_t nr_64qam_mod_table[4096]; -int32_t nr_256qam_mod_table[512]; +extern int32_t nr_256qam_mod_table[512]; #endif diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h index 19b9736bcb..b32d48a2e9 100644 --- a/openair1/PHY/NR_REFSIG/pss_nr.h +++ b/openair1/PHY/NR_REFSIG/pss_nr.h @@ -120,8 +120,7 @@ EXTERN int64_t *pss_corr_ue[NUMBER_PSS_SEQUENCE] ; /* profiling structure */ -EXTERN double cpuf; -time_stats_t generic_time[TIME_LAST]; +EXTERN time_stats_t generic_time[TIME_LAST]; #ifndef DEFINE_HEADER_ONLY diff --git a/openair1/PHY/NR_REFSIG/refsig_defs_ue.h b/openair1/PHY/NR_REFSIG/refsig_defs_ue.h index 83b43c54a0..54279a8ad5 100644 --- a/openair1/PHY/NR_REFSIG/refsig_defs_ue.h +++ b/openair1/PHY/NR_REFSIG/refsig_defs_ue.h @@ -57,11 +57,9 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, void nr_gold_pbch(PHY_VARS_NR_UE* ue); void nr_gold_pdcch(PHY_VARS_NR_UE* ue, - unsigned short n_idDMRS, - unsigned short length_dmrs); + unsigned short n_idDMRS); void nr_gold_pdsch(PHY_VARS_NR_UE* ue, - unsigned char ns, unsigned short *n_idDMRS); void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, diff --git a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h index 44d30da8f3..43ec0c03dc 100644 --- a/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h +++ b/openair1/PHY/NR_REFSIG/ul_ref_seq_nr.h @@ -58,7 +58,7 @@ #define INDEX_SB_LESS_32 (4) /* index of dftsizes array for which subcarrier number is less than 36 */ -const uint16_t ul_allocated_re[SRS_SB_CONF] /* number of uplink allocated resource elements */ +EXTERN const uint16_t ul_allocated_re[SRS_SB_CONF] /* number of uplink allocated resource elements */ /* this table is derivated from TS 38.211 Table 6.4.1.4.3-1: SRS bandwidth configuration which gives m_SRS_b then all possible values of sequence length is */ /* M_sc_b_SRS = m_SRS_b * N_SC_RB/K_TC with K_TC = 2 or K_TC = 4 as specified in TS 38.211 6.4.1.4.3 */ #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H @@ -82,7 +82,7 @@ m_SRS_b 224 116, 240 256 264 272 144 152 160 168 176 184 ; /* table of largest prime number lower than uplink allocated resource elements "ul_allocated_re" */ -const uint16_t ref_ul_primes[SRS_SB_CONF] +EXTERN const uint16_t ref_ul_primes[SRS_SB_CONF] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 6, 12, 18, 24, 30, 36, 48, 60, 72, 84, 96, 108, 120, 132, 144, 156, 168, 180, 192, 204, 216, 228, 240, */ @@ -101,10 +101,10 @@ const uint16_t ref_ul_primes[SRS_SB_CONF] ; /* Low-PAPR base sequence; see TS 38.211 clause 5.2.2 */ -int16_t *rv_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][SRS_SB_CONF]; +EXTERN int16_t *rv_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][SRS_SB_CONF]; /* 38.211 table Table 5.2.2.2-1: Definition of phi(n) for M_ZC = 6 */ -const char phi_M_ZC_6[6*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_6[6*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 */ @@ -142,7 +142,7 @@ const char phi_M_ZC_6[6*U_GROUP_NUMBER] #endif ; /* Table 5.2.2.2-2: Definition of phi ( n ) for M ZC = 12 */ -const char phi_M_ZC_12[12*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_12[12*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 */ @@ -181,7 +181,7 @@ const char phi_M_ZC_12[12*U_GROUP_NUMBER] ; /* Table 5.2.2.2-3: Definition of phi (n ) for M_ZC = 18 */ -const char phi_M_ZC_18[18*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_18[18*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 */ @@ -220,7 +220,7 @@ const char phi_M_ZC_18[18*U_GROUP_NUMBER] ; /* Table 5.2.2.2-4: Definition of phi (n ) for M_ZC = 24 */ -const char phi_M_ZC_24[24*U_GROUP_NUMBER] +EXTERN const char phi_M_ZC_24[24*U_GROUP_NUMBER] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 */ @@ -260,10 +260,10 @@ const char phi_M_ZC_24[24*U_GROUP_NUMBER] /************** FUNCTION ******************************************/ -int16_t *base_sequence_36_or_larger(unsigned int M_ZC, unsigned int u, unsigned int v, unsigned int scaling, unsigned int if_dmrs_seq); +EXTERN int16_t *base_sequence_36_or_larger(unsigned int M_ZC, unsigned int u, unsigned int v, unsigned int scaling, unsigned int if_dmrs_seq); -int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling); +EXTERN int16_t *base_sequence_less_than_36(unsigned int M_ZC, unsigned int u, unsigned int scaling); /*! \brief This function generate the sounding reference symbol (SRS) for the uplink. @param tables of srs @@ -278,7 +278,7 @@ void free_ul_reference_signal_sequences(void); #define MAX_INDEX_DMRS_UL_ALLOCATED_REs 53 -const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] +EXTERN const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] /* Number of possible DMRS REs based on PRBs allocated for PUSCH. Array has values until 273 RBs (100Mhz BW) Number of PUSCH RBs allocated should be able to be expressed as 2topowerofn*3topowerofn*5tothepowerofn According to 3GPP spec 38.211 section 6.3.1.4 @@ -307,7 +307,7 @@ const uint16_t dmrs_ul_allocated_res[MAX_INDEX_DMRS_UL_ALLOCATED_REs] /* Table of largest prime number N_ZC < possible DMRS REs M_ZC, this array has values until 100Mhz According to 3GPP spec 38.211 section 5.2.2.1 Table used in calculating DMRS low papr type1 sequence for transform precoding */ -const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] +EXTERN const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] #ifdef INIT_VARIABLES_LOWPAPR_SEQUENCES_NR_H = { /*DMRS REs 6, 12, 18, 24, 30, 36, 48, 54, 60, 72, 90, 96, */ @@ -331,8 +331,8 @@ const uint16_t dmrs_ref_ul_primes[MAX_INDEX_DMRS_UL_ALLOCATED_REs] ; /// PUSCH DMRS for transform precoding -int16_t *gNB_dmrs_lowpaprtype1_sequence[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; -int16_t *dmrs_lowpaprtype1_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; +EXTERN int16_t *gNB_dmrs_lowpaprtype1_sequence[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; +EXTERN int16_t *dmrs_lowpaprtype1_ul_ref_sig[U_GROUP_NUMBER][V_BASE_SEQUENCE_NUMBER][MAX_INDEX_DMRS_UL_ALLOCATED_REs]; int16_t get_index_for_dmrs_lowpapr_seq(int16_t num_dmrs_res); void generate_lowpapr_typ1_refsig_sequences(unsigned int scaling); void free_gnb_lowpapr_sequences(void); diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index 469415908f..d208167855 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -30,7 +30,7 @@ * \warning */ -#include + #include "nr_dci.h" #include "nr_dlsch.h" #include "nr_sch_dmrs.h" @@ -85,10 +85,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, // compute rb_offset and n_prb based on frequency allocation nr_fill_cce_list(gNB,0,pdcch_pdu_rel15); get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); - cset_start_sc = frame_parms.first_carrier_offset + rb_offset*NR_NB_SC_PER_RB; - if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_MIB_SIB1) { - cset_start_sc = cset_start_sc + RC.nrmac[gNB->Mod_id]->type0_PDCCH_CSS_config.cset_start_rb*NR_NB_SC_PER_RB; - } + cset_start_sc = frame_parms.first_carrier_offset + (pdcch_pdu_rel15->BWPStart + rb_offset) * NR_NB_SC_PER_RB; for (int d=0;dnumDlDci;d++) { /*The coreset is initialised @@ -100,7 +97,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex; cset_nsymb = pdcch_pdu_rel15->DurationSymbols; dci_idx = 0; - LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d\n",rb_offset,n_rb); + LOG_D(PHY, "Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart); LOG_D(PHY, "Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); // DMRS length is per OFDM symbol uint32_t dmrs_length = n_rb*6; //2(QPSK)*3(per RB)*6(REG per CCE) @@ -184,61 +181,64 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, } /*Mapping the encoded DCI along with the DMRS */ - for (int cce_count = 0; cce_count < dci_pdu->AggregationLevel; cce_count ++) { + for(int symbol_idx = 0; symbol_idx < pdcch_pdu_rel15->DurationSymbols; symbol_idx++) { + for (int cce_count = 0; cce_count < dci_pdu->AggregationLevel; cce_count+=pdcch_pdu_rel15->DurationSymbols) { - int8_t cce_idx = reg_list_order[cce_count]; + int8_t cce_idx = reg_list_order[cce_count]; - for (int reg_in_cce_idx = 0; reg_in_cce_idx < NR_NB_REG_PER_CCE; reg_in_cce_idx++) { + for (int reg_in_cce_idx = 0; reg_in_cce_idx < NR_NB_REG_PER_CCE; reg_in_cce_idx++) { - k = cset_start_sc + gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].start_sc_idx; - - if (k >= frame_parms.ofdm_symbol_size) - k -= frame_parms.ofdm_symbol_size; - - l = cset_start_symb + gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].symb_idx; - - // dmrs index depends on reference point for k according to 38.211 7.4.1.3.2 - if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG) - dmrs_idx =gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx * 3; - else - dmrs_idx = (gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx + rb_offset) * 3; - - k_prime = 0; - - for (int m = 0; m < NR_NB_SC_PER_RB; m++) { - if (m == (k_prime << 2) + 1) { // DMRS if not already mapped - ((int16_t *) txdataF)[(l * frame_parms.ofdm_symbol_size + k) << 1] = - (amp * mod_dmrs[l][dmrs_idx << 1]) >> 15; - ((int16_t *) txdataF)[((l * frame_parms.ofdm_symbol_size + k) << 1) + 1] = - (amp * mod_dmrs[l][(dmrs_idx << 1) + 1]) >> 15; - -#ifdef DEBUG_PDCCH_DMRS - printf("PDCCH DMRS: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1], - ((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]); -#endif - - dmrs_idx++; - k_prime++; - - } else { // DCI payload - ((int16_t *) txdataF)[(l * frame_parms.ofdm_symbol_size + k) << 1] = (amp * mod_dci[dci_idx << 1]) >> 15; - ((int16_t *) txdataF)[((l * frame_parms.ofdm_symbol_size + k) << 1) + 1] = - (amp * mod_dci[(dci_idx << 1) + 1]) >> 15; -#ifdef DEBUG_DCI - printf("PDCCH: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1], - ((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]); -#endif - dci_idx++; - } - - k++; + k = cset_start_sc + gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].start_sc_idx; if (k >= frame_parms.ofdm_symbol_size) k -= frame_parms.ofdm_symbol_size; - } // m - } // reg_in_cce_idx - } // cce_count + l = cset_start_symb + symbol_idx; + + // dmrs index depends on reference point for k according to 38.211 7.4.1.3.2 + if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG) + dmrs_idx = (gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx) * 3; + else + dmrs_idx = (gNB->cce_list[d][cce_idx].reg_list[reg_in_cce_idx].reg_idx + rb_offset) * 3; + + k_prime = 0; + + for (int m = 0; m < NR_NB_SC_PER_RB; m++) { + if (m == (k_prime << 2) + 1) { // DMRS if not already mapped + ((int16_t *) txdataF)[(l * frame_parms.ofdm_symbol_size + k) << 1] = + (amp * mod_dmrs[l][dmrs_idx << 1]) >> 15; + ((int16_t *) txdataF)[((l * frame_parms.ofdm_symbol_size + k) << 1) + 1] = + (amp * mod_dmrs[l][(dmrs_idx << 1) + 1]) >> 15; + +#ifdef DEBUG_PDCCH_DMRS + printf("PDCCH DMRS: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1], + ((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]); +#endif + + dmrs_idx++; + k_prime++; + + } else { // DCI payload + ((int16_t *) txdataF)[(l * frame_parms.ofdm_symbol_size + k) << 1] = (amp * mod_dci[dci_idx << 1]) >> 15; + ((int16_t *) txdataF)[((l * frame_parms.ofdm_symbol_size + k) << 1) + 1] = + (amp * mod_dci[(dci_idx << 1) + 1]) >> 15; +#ifdef DEBUG_DCI + printf("PDCCH: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms.ofdm_symbol_size + k)<<1], + ((int16_t *)txdataF)[((l*frame_parms.ofdm_symbol_size + k)<<1)+1]); +#endif + + dci_idx++; + } + + k++; + + if (k >= frame_parms.ofdm_symbol_size) + k -= frame_parms.ofdm_symbol_size; + + } // m + } // reg_in_cce_idx + } // cce_count + } // symbol_idx LOG_D(PHY, "DCI: payloadSize = %d | payload = %llx\n", diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c index 3814c78295..0884c11a9b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c @@ -136,7 +136,7 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset); - int N_reg = n_rb * pdcch_pdu_rel15->DurationSymbols; + int N_reg = n_rb; int C=-1; AssertFatal(N_reg > 0,"N_reg cannot be 0\n"); @@ -174,8 +174,8 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r for (uint8_t reg_idx=0; reg_idxreg_list[reg_idx]; reg->reg_idx = bsize*idx + reg_idx; - reg->start_sc_idx = (reg->reg_idx/pdcch_pdu_rel15->DurationSymbols) * NR_NB_SC_PER_RB; - reg->symb_idx = reg->reg_idx % pdcch_pdu_rel15->DurationSymbols; + reg->start_sc_idx = reg->reg_idx * NR_NB_SC_PER_RB; + reg->symb_idx = 0; LOG_D(PHY, "reg %d symbol %d start subcarrier %d\n", reg->reg_idx, reg->symb_idx, reg->start_sc_idx); } } @@ -185,8 +185,8 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r for (uint8_t reg_idx=0; reg_idxreg_list[reg_idx]; reg->reg_idx = cce->cce_idx*NR_NB_REG_PER_CCE + reg_idx; - reg->start_sc_idx = (reg->reg_idx/pdcch_pdu_rel15->DurationSymbols) * NR_NB_SC_PER_RB; - reg->symb_idx = reg->reg_idx % pdcch_pdu_rel15->DurationSymbols; + reg->start_sc_idx = reg->reg_idx * NR_NB_SC_PER_RB; + reg->symb_idx = 0; LOG_D(PHY, "reg %d symbol %d start subcarrier %d\n", reg->reg_idx, reg->symb_idx, reg->start_sc_idx); } @@ -239,7 +239,7 @@ void nr_fill_dci(PHY_VARS_gNB *gNB, //uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu[i].Payload; int dlsch_id = find_nr_dlsch(pdcch_pdu_rel15->dci_pdu[i].RNTI,gNB,SEARCH_EXIST_OR_FREE); - if( (dlsch_id<0) || (dlsch_id>=NUMBER_OF_NR_DLSCH_MAX) ){ + if( (dlsch_id<0) || (dlsch_id>=gNB->number_of_nr_dlsch_max) ){ LOG_E(PHY,"illegal dlsch_id found!!! rnti %04x dlsch_id %d\n",(unsigned int)pdcch_pdu_rel15->dci_pdu[i].RNTI,dlsch_id); return; } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 66fc987f6d..96918792a0 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -132,7 +132,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, time_stats_t *dlsch_interleaving_stats=&gNB->dlsch_interleaving_stats; time_stats_t *dlsch_segmentation_stats=&gNB->dlsch_segmentation_stats; - for (int dlsch_id=0;dlsch_idnumber_of_nr_dlsch_max;dlsch_id++) { dlsch = gNB->dlsch[dlsch_id][0]; if (dlsch->slot_tx[slot] == 0) continue; @@ -141,6 +141,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; int16_t **mod_symbs = (int16_t**)dlsch->mod_symbs; int16_t **tx_layers = (int16_t**)dlsch->txdataF; + int16_t **txdataF_precoding = (int16_t**)dlsch->txdataF_precoding; int8_t Wf[2], Wt[2], l0, l_prime, l_overline, delta; uint8_t dmrs_Type = rel15->dmrsConfigType; int nb_re_dmrs; @@ -151,14 +152,14 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, else { nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData; } - n_dmrs = (rel15->rbSize+rel15->rbStart)*nb_re_dmrs; + n_dmrs = (rel15->BWPStart+rel15->rbStart+rel15->rbSize)*nb_re_dmrs; uint16_t dmrs_symbol_map = rel15->dlDmrsSymbPos;//single DMRS: 010000100 Double DMRS 110001100 uint8_t dmrs_len = get_num_dmrs(rel15->dlDmrsSymbPos); uint16_t nb_re = ((12*rel15->NrOfSymbols)-nb_re_dmrs*dmrs_len-xOverhead)*rel15->rbSize*rel15->nrOfLayers; uint8_t Qm = rel15->qamModOrder[0]; uint32_t encoded_length = nb_re*Qm; - int16_t mod_dmrs[14][n_dmrs<<1] __attribute__ ((aligned(16))); + int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16))); /* PTRS */ uint16_t beta_ptrs = 1; @@ -263,26 +264,6 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, printf("\n"); } #endif - - /// Antenna port mapping - //to be moved to init phase potentially, for now tx_layers 1-8 are mapped on antenna ports 1000-1007 - - /// DMRS QPSK modulation - for (int l=rel15->StartSymbolIndex; lStartSymbolIndex+rel15->NrOfSymbols; l++) { - if (rel15->dlDmrsSymbPos & (1 << l)) { - nr_modulation(pdsch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs[l]); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated - -#ifdef DEBUG_DLSCH - printf("DMRS modulation (symbol %d, %d symbols, type %d):\n", l, n_dmrs, dmrs_Type); - for (int i=0; i>4; i++) { - for (int j=0; j<8; j++) { - printf("%d %d\t", mod_dmrs[l][((i<<3)+j)<<1], mod_dmrs[l][(((i<<3)+j)<<1)+1]); - } - printf("\n"); - } -#endif - } - } /// Resource mapping @@ -290,7 +271,9 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, uint16_t start_sc = frame_parms->first_carrier_offset + (rel15->rbStart+rel15->BWPStart)*NR_NB_SC_PER_RB; if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; - + + int txdataF_offset = (slot%2)*frame_parms->samples_per_slot_wCP; + #ifdef DEBUG_DLSCH_MAPPING printf("PDSCH resource mapping started (start SC %d\tstart symbol %d\tN_PRB %d\tnb_re %d,nb_layers %d)\n", start_sc, rel15->StartSymbolIndex, rel15->rbSize, nb_re,rel15->nrOfLayers); @@ -311,20 +294,31 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, 1+dmrs_Type,ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol); #endif - uint16_t m=0, dmrs_idx=0, k=0; - - int txdataF_offset = (slot%2)*frame_parms->samples_per_slot_wCP; + uint16_t m=0, dmrs_idx=0; // Loop Over OFDM symbols: for (int l=rel15->StartSymbolIndex; lStartSymbolIndex+rel15->NrOfSymbols; l++) { /// DMRS QPSK modulation uint8_t k_prime=0; uint16_t n=0; - if ((dmrs_symbol_map & (1 << l))){ //DMRS time occasion - if (dmrs_Type == NFAPI_NR_DMRS_TYPE1) // another if condition to be included to check pdsch config type (reference of k) - dmrs_idx = rel15->rbStart*6; - else - dmrs_idx = rel15->rbStart*4; + + if ((dmrs_symbol_map & (1 << l))){ // DMRS time occasion + // The reference point for is subcarrier 0 of the lowest-numbered resource block in CORESET 0 if the corresponding + // PDCCH is associated with CORESET 0 and Type0-PDCCH common search space and is addressed to SI-RNTI + // 3GPP TS 38.211 V15.8.0 Section 7.4.1.1.2 Mapping to physical resources + if (rel15->rnti==SI_RNTI) { + if (dmrs_Type==NFAPI_NR_DMRS_TYPE1) { + dmrs_idx = rel15->rbStart*6; + } else { + dmrs_idx = rel15->rbStart*4; + } + } else { + if (dmrs_Type == NFAPI_NR_DMRS_TYPE1) { + dmrs_idx = (rel15->rbStart+rel15->BWPStart)*6; + } else { + dmrs_idx = (rel15->rbStart+rel15->BWPStart)*4; + } + } } // Update l_prime in the case of double DMRS config @@ -337,6 +331,21 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, } } + /// DMRS QPSK modulation + if (rel15->dlDmrsSymbPos & (1 << l)) { + nr_modulation(pdsch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated + +#ifdef DEBUG_DLSCH + printf("DMRS modulation (symbol %d, %d symbols, type %d):\n", l, n_dmrs, dmrs_Type); + for (int i=0; i>4; i++) { + for (int j=0; j<8; j++) { + printf("%d %d\t", mod_dmrs[((i<<3)+j)<<1], mod_dmrs[(((i<<3)+j)<<1)+1]); + } + printf("\n"); + } +#endif + } + /* calculate if current symbol is PTRS symbols */ ptrs_idx = 0; @@ -347,7 +356,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, nr_modulation(pdsch_dmrs[l][0], (n_ptrs<<1), DMRS_MOD_ORDER, mod_ptrs); } } - k = start_sc; + uint16_t k = start_sc; // Loop Over SCs: for (int i=0; irbSize*NR_NB_SC_PER_RB; i++) { /* check if cuurent RE is PTRS RE*/ @@ -367,12 +376,12 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, /* Map DMRS Symbol */ if ( ( dmrs_symbol_map & (1 << l) ) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_Type))%(frame_parms->ofdm_symbol_size)))) { - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][dmrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[l][(dmrs_idx<<1) + 1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", - dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); + dmrs_idx, l, k, k_prime, n, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); #endif dmrs_idx++; k_prime++; @@ -381,8 +390,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, } /* Map PTRS Symbol */ else if(is_ptrs_re){ - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15; - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; #ifdef DEBUG_DLSCH_MAPPING printf("ptrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", ptrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], @@ -391,17 +400,20 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ptrs_idx++; } /* Map DATA Symbol */ - else { - if( (!(dmrs_symbol_map & (1 << l))) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,frame_parms->ofdm_symbol_size,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) { - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15; - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; + else if( (!(dmrs_symbol_map & (1 << l))) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,frame_parms->ofdm_symbol_size,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) { + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; #ifdef DEBUG_DLSCH_MAPPING - printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", - m, l, k, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], - ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); + printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", + m, l, k, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)], + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]); #endif - m++; - } + m++; + } + /* mute RE */ + else { + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = 0; + txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = 0; } if (++k >= frame_parms->ofdm_symbol_size) k -= frame_parms->ofdm_symbol_size; @@ -409,9 +421,108 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, } // symbol loop }// layer loop + ///Layer Precoding and Antenna port mapping + // tx_layers 1-8 are mapped on antenna ports 1000-1007 + // The precoding info is supported by nfapi such as num_prgs, prg_size, prgs_list and pm_idx + // The same precoding matrix is applied on prg_size RBs, Thus + // pmi = prgs_list[rbidx/prg_size].pm_idx, rbidx =0,...,rbSize-1 + // The Precoding matrix: + // The Codebook Type I and Type II are not supported yet. + // We adopt the precoding matrices of PUSCH for 4 layers. + for (int ap=0; apnb_antennas_tx; ap++) { + + for (int l=rel15->StartSymbolIndex; lStartSymbolIndex+rel15->NrOfSymbols; l++) { + uint16_t k = start_sc; + + for (int rb=0; rbrbSize; rb++) { + //get pmi info + uint8_t pmi; + if (rel15->precodingAndBeamforming.prg_size > 0) + pmi = rel15->precodingAndBeamforming.prgs_list[(int)rb/rel15->precodingAndBeamforming.prg_size].pm_idx; + else + pmi = 0;//no precoding + + if (pmi == 0) {//unitary Precoding + if(apnrOfLayers) + memcpy((void*)&txdataF[ap][l*frame_parms->ofdm_symbol_size + txdataF_offset + k], + (void*)&txdataF_precoding[ap][2*(l*frame_parms->ofdm_symbol_size + txdataF_offset+ k)], + NR_NB_SC_PER_RB*sizeof(int32_t)); + else + memset((void*)&txdataF[ap][rel15->StartSymbolIndex*frame_parms->ofdm_symbol_size + txdataF_offset +k], + 0, + NR_NB_SC_PER_RB*sizeof(int32_t)); + k += NR_NB_SC_PER_RB; + if (k >= frame_parms->ofdm_symbol_size) { + k -= frame_parms->ofdm_symbol_size; + } + } + else { + //get the precoding matrix weights: + char *W_prec; + switch (frame_parms->nb_antennas_tx) { + case 1://1 antenna port + W_prec = nr_W_1l_2p[pmi][ap]; + break; + case 2://2 antenna ports + if (rel15->nrOfLayers == 1)//1 layer + W_prec = nr_W_1l_2p[pmi][ap]; + else//2 layers + W_prec = nr_W_2l_2p[pmi][ap]; + break; + case 4://4 antenna ports + if (rel15->nrOfLayers == 1)//1 layer + W_prec = nr_W_1l_4p[pmi][ap]; + else if (rel15->nrOfLayers == 2)//2 layers + W_prec = nr_W_2l_4p[pmi][ap]; + else if (rel15->nrOfLayers == 3)//3 layers + W_prec = nr_W_3l_4p[pmi][ap]; + else//4 layers + W_prec = nr_W_4l_4p[pmi][ap]; + break; + default: + LOG_D(PHY,"Precoding 1,2, or 4 antenna ports are currently supported\n"); + W_prec = nr_W_1l_2p[pmi][ap]; + break; + } + for (int i=0; iofdm_symbol_size + k; + int32_t precodatatx_F = nr_layer_precoder(txdataF_precoding, W_prec, rel15->nrOfLayers, re_offset+txdataF_offset); + ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[0]; + ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)] = ((int16_t *) &precodatatx_F)[1]; +#ifdef DEBUG_DLSCH_MAPPING + printf("antenna %d\t l %d \t k %d \t txdataF: %d %d\n", + ap, l, k, ((int16_t*)txdataF[ap])[(re_offset<<1) + (2*txdataF_offset)], + ((int16_t*)txdataF[ap])[(re_offset<<1) + 1 + (2*txdataF_offset)]); +#endif + if (++k >= frame_parms->ofdm_symbol_size) { + k -= frame_parms->ofdm_symbol_size; + } + } + } + } //RB loop + } // symbol loop + }// port loop dlsch->slot_tx[slot]=0; + + // TODO: handle precoding + // this maps the layers onto antenna ports + + // handle beamforming ID + // each antenna port is assigned a beam_index + // since PHY can only handle BF on slot basis we set the whole slot + + // first check if this slot has not already been allocated to another beam + if (gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot]==255) { + for (int j=0;jsymbols_per_slot;j++) + gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot+j] = rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx; + } + else { + LOG_D(PHY,"beam index for PDSCH allocation already taken\n"); + } }// dlsch loop + + return 0; } @@ -429,6 +540,6 @@ void dump_pdsch_stats(PHY_VARS_gNB *gNB) { void clear_pdsch_stats(PHY_VARS_gNB *gNB) { - for (int i=0;inumber_of_nr_dlsch_max;i++) memset((void*)&gNB->dlsch_stats[i],0,sizeof(gNB->dlsch_stats[i])); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index e6544bbe0c..b441635246 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -61,10 +61,8 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) if (N_RB != 273) { a_segments = a_segments*N_RB; a_segments = a_segments/273 +1; - } - - - + } + #ifdef DEBUG_DLSCH_FREE LOG_D(PHY,"Freeing dlsch %p\n",dlsch); #endif @@ -110,8 +108,6 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) harq->d[r] = NULL; } } - free16(harq, sizeof(NR_DL_gNB_HARQ_t)); - harq = NULL; } } @@ -133,7 +129,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, if (N_RB != 273) { a_segments = a_segments*N_RB; a_segments = a_segments/273 +1; - } + } uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment @@ -145,31 +141,30 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, dlsch->Mdlharq = Mdlharq; dlsch->Mlimit = 4; dlsch->Nsoft = Nsoft; - - for (layer=0; layerue_spec_bf_weights[layer] = (int32_t **)malloc16(64 * sizeof(int32_t *)); - for (aa = 0; aa < 64; aa++) { - dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES * sizeof(int32_t)); - for (re = 0; re < OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) { + for (layer=0; layerue_spec_bf_weights[layer] = (int32_t**)malloc16(64*sizeof(int32_t*)); + + for (aa=0; aa<64; aa++) { + dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); + for (re=0;reue_spec_bf_weights[layer][aa][re] = 0x00007fff; } } - dlsch->txdataF[layer] = - (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH / NR_MAX_NB_LAYERS) - * sizeof(int32_t)); // NR_MAX_NB_LAYERS is already included in NR_MAX_PDSCH_ENCODED_LENGTH + dlsch->txdataF[layer] = (int32_t *)malloc16((NR_MAX_PDSCH_ENCODED_LENGTH/NR_MAX_NB_LAYERS)*sizeof(int32_t)); // NR_MAX_NB_LAYERS is already included in NR_MAX_PDSCH_ENCODED_LENGTH + dlsch->txdataF_precoding[layer] = (int32_t *)malloc16(2*14*frame_parms->ofdm_symbol_size*sizeof(int32_t)); } - for (int q = 0; q < NR_MAX_NB_CODEWORDS; q++) - dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH * sizeof(int32_t)); + for (int q=0; qmod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH*sizeof(int32_t)); - dlsch->calib_dl_ch_estimates = (int32_t **)malloc16(64 * sizeof(int32_t *)); - for (aa = 0; aa < 64; aa++) { - dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES * sizeof(int32_t)); + dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(64*sizeof(int32_t*)); + for (aa=0; aa<64; aa++) { + dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t)); } - for (i = 0; i < 20; i++) { + for (i=0; i<20; i++) { dlsch->harq_ids[0][i] = 0; dlsch->harq_ids[1][i] = 0; } @@ -268,7 +263,6 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, float Coderate = 0.0; uint8_t Nl = 4; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN); A = rel15->TBSize[0]<<3; @@ -304,7 +298,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, a[2+(A>>3)] = ((uint8_t*)&crc)[0]; //printf("CRC %x (A %d)\n",crc,A); //printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]); - + harq->B = A+24; // harq->b = a; @@ -323,7 +317,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, a[1+(A>>3)] = ((uint8_t*)&crc)[0]; //printf("CRC %x (A %d)\n",crc,A); //printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]); - + harq->B = A+16; // harq->b = a; @@ -339,17 +333,17 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, Coderate = (float) R /(float) 1024; else // to scale for mcs 20 and 26 in table 5.1.3.1-2 which are decimal and input 2* in nr_tbs_tools Coderate = (float) R /(float) 2048; - + if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25) harq->BG = 2; else harq->BG = 1; - + start_meas(dlsch_segmentation_stats); Kb = nr_segmentation(harq->b, harq->c, harq->B, &harq->C, &harq->K, Zc, &harq->F, harq->BG); stop_meas(dlsch_segmentation_stats); F = harq->F; - + Kr = harq->K; #ifdef DEBUG_DLSCH_CODING uint16_t Kr_bytes; @@ -357,7 +351,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, #endif //printf("segment Z %d k %d Kr %d BG %d C %d\n", *Zc,harq->K,Kr,BG,harq->C); - + for (r=0; rC; r++) { //d_tmp[r] = &harq->d[r][0]; //channel_input[r] = &harq->d[r][0]; @@ -369,7 +363,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, LOG_D(PHY,"%d ", harq->c[r][cnt]); } LOG_D(PHY,"\n"); - + #endif //ldpc_encoder_orig((unsigned char*)harq->c[r],harq->d[r],*Zc,Kb,Kr,BG,0); //ldpc_encoder_optim((unsigned char*)harq->c[r],(unsigned char*)&harq->d[r][0],*Zc,Kb,Kr,BG,NULL,NULL,NULL,NULL); @@ -380,23 +374,22 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, impp.tinput = tinput; impp.tparity = tparity; impp.toutput = toutput; - + for(int j=0;j<(harq->C/8+1);j++) { impp.macro_num=j; nrLDPC_encoder(harq->c,harq->d,*Zc,Kb,Kr,harq->BG,&impp); } - #ifdef DEBUG_DLSCH_CODING write_output("enc_input0.m","enc_in0",&harq->c[0][0],Kr_bytes,1,4); write_output("enc_output0.m","enc0",&harq->d[0][0],(3*8*Kr_bytes)+12,1,4); #endif - + F = harq->F; - + Kr = harq->K; for (r=0; rC; r++) { - + if (F>0) { for (int k=(Kr-F-2*(*Zc)); kd[r][k]); } } - - - + #ifdef DEBUG_DLSCH_CODING LOG_D(PHY,"rvidx in encoding = %d\n", rel15->rvIndex[0]); #endif - + E = nr_get_E(G, harq->C, mod_order, rel15->nrOfLayers, r); - + //#ifdef DEBUG_DLSCH_CODING LOG_D(PHY,"Rate Matching, Code segment %d/%d (coded bits (G) %u, E %d, Filler bits %d, Filler offset %d mod_order %d, nb_rb %d)...\n", r, @@ -423,13 +414,13 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, F, Kr-F-2*(*Zc), mod_order,nb_rb); - + // for tbslbrm calculation according to 5.4.2.1 of 38.212 if (rel15->nrOfLayers < Nl) Nl = rel15->nrOfLayers; - + Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl); - + start_meas(dlsch_rate_matching_stats); nr_rate_matching_ldpc(Ilbrm, Tbslbrm, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c index 384ab5c9b5..3707669769 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_tools.c @@ -261,7 +261,7 @@ int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) { int16_t first_free_index=-1; AssertFatal(gNB!=NULL,"gNB is null\n"); - for (i=0; inumber_of_nr_dlsch_max; i++) { AssertFatal(gNB->dlsch[i]!=NULL,"gNB->dlsch[%d] is null\n",i); AssertFatal(gNB->dlsch[i][0]!=NULL,"gNB->dlsch[%d][0] is null\n",i); //LOG_D(PHY,"searching for rnti %x : dlsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i, @@ -298,7 +298,7 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB, gNB->dlsch[0][0]->rnti = 4660; } int dlsch_id = find_nr_dlsch(rel15->rnti,gNB,SEARCH_EXIST); - AssertFatal( (dlsch_id>=0) && (dlsch_id=0) && (dlsch_idnumber_of_nr_dlsch_max), "illegal or no dlsch_id found!!! rnti %04x dlsch_id %d\n",rel15->rnti,dlsch_id); NR_gNB_DLSCH_t *dlsch = gNB->dlsch[dlsch_id][0]; NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process; diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index bd1278b2eb..0bc04e3047 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -241,7 +241,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ///Payload generation memset((void *)pbch, 0, sizeof(NR_gNB_PBCH)); pbch->pbch_a=0; - uint8_t ssb_index = frame_parms->ssb_index; + uint8_t ssb_index = ssb_pdu->ssb_pdu_rel15.SsbBlockIndex; uint8_t *pbch_pdu = (uint8_t*)&ssb_pdu->ssb_pdu_rel15.bchPayload; uint8_t Lmax = frame_parms->Lmax; for (int i=0; inumber_of_nr_ulsch_max; i++) { AssertFatal(gNB->ulsch[i]!=NULL,"gNB->ulsch[%d] is null\n",i); AssertFatal(gNB->ulsch[i][0]!=NULL,"gNB->ulsch[%d][0] is null\n",i); LOG_D(PHY,"searching for rnti %x : ulsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,gNB->ulsch[i][0]->harq_mask,gNB->ulsch[i][0]->rnti,first_free_index); @@ -62,7 +62,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, int ulsch_id = find_nr_ulsch(ulsch_pdu->rnti,gNB,SEARCH_EXIST_OR_FREE); - AssertFatal( (ulsch_id>=0) && (ulsch_id=0) && (ulsch_idnumber_of_nr_ulsch_max), "illegal or no ulsch_id found!!! rnti %04x ulsch_id %d\n",ulsch_pdu->rnti,ulsch_id); NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ulsch_id][0]; @@ -139,7 +139,7 @@ void nr_ulsch_unscrambling_optim(int16_t* llr, void dump_pusch_stats(PHY_VARS_gNB *gNB) { - for (int i=0;inumber_of_nr_ulsch_max;i++) if (gNB->ulsch_stats[i].rnti>0) LOG_I(PHY,"ULSCH RNTI %x: round_trials %d(%1.1e):%d(%1.1e):%d(%1.1e):%d, current_Qm %d, current_RI %d, total_bytes RX/SCHED %d/%d\n", gNB->ulsch_stats[i].rnti, @@ -159,6 +159,6 @@ void dump_pusch_stats(PHY_VARS_gNB *gNB) { void clear_pusch_stats(PHY_VARS_gNB *gNB) { - for (int i=0;inumber_of_nr_ulsch_max;i++) memset((void*)&gNB->ulsch_stats[i],0,sizeof(gNB->ulsch_stats[i])); } diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 91f72922e2..3fee7e5dff 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -320,7 +320,7 @@ void nr_processULSegment(void* arg) { Kr_bytes = Kr>>3; K_bits_F = Kr-ulsch_harq->F; - t_nrLDPC_time_stats procTime; + t_nrLDPC_time_stats procTime = {0}; t_nrLDPC_time_stats* p_procTime = &procTime ; //start_meas(&phy_vars_gNB->ulsch_deinterleaving_stats); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c index dd8627f0e0..72db5488c4 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c @@ -12,6 +12,8 @@ //#define DEBUG_RB_EXT //#define DEBUG_CH_MAG +#define INVALID_VALUE 255 + void nr_idft(int32_t *z, uint32_t Msc_PUSCH) { @@ -326,7 +328,7 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, #endif uint8_t is_dmrs_re; - start_re = (frame_parms->first_carrier_offset + (pusch_pdu->rb_start * NR_NB_SC_PER_RB))%frame_parms->ofdm_symbol_size; + start_re = (frame_parms->first_carrier_offset + (pusch_pdu->rb_start + pusch_pdu->bwp_start) * NR_NB_SC_PER_RB)%frame_parms->ofdm_symbol_size; nb_re_pusch = NR_NB_SC_PER_RB * pusch_pdu->rb_size; #ifdef __AVX2__ int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7); @@ -345,7 +347,9 @@ void nr_ulsch_extract_rbs_single(int32_t **rxdataF, n = 0; k_prime = 0; - rxF_ext_index = ul_ch0_ext_index = ul_ch0_index = 0; /* In RX Antenna(aarx) loop, Reset the index */ + rxF_ext_index = 0; + ul_ch0_ext_index = 0; + ul_ch0_index = 0; if (is_dmrs_symbol == 0) { // @@ -407,7 +411,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, #if defined(__x86_64__)||defined(__i386__) short rb, ch_amp; - unsigned char aatx,aarx; + unsigned char aarx; __m128i *ul_ch128, ch_amp128; // Determine scaling amplitude based the symbol @@ -425,8 +429,7 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, int off = 0; #endif - for (aatx=0; aatx < frame_parms->nb_antenna_ports_gNB; aatx++) { - for (aarx=0; aarx < frame_parms->nb_antennas_rx; aarx++) { + for (aarx=0; aarx < frame_parms->nb_antennas_rx; aarx++) { ul_ch128 = (__m128i *)&ul_ch_estimates_ext[aarx][symbol*(off+(nb_rb*NR_NB_SC_PER_RB))]; @@ -455,7 +458,6 @@ void nr_ulsch_scale_channel(int **ul_ch_estimates_ext, } } } - } #endif } @@ -472,6 +474,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext, short rb; unsigned char aatx, aarx; + char nb_antennas_ue_tx = 1; __m128i *ul_ch128, avg128U; int16_t x = factor2(len); @@ -483,7 +486,7 @@ void nr_ulsch_channel_level(int **ul_ch_estimates_ext, int off = 0; #endif - for (aatx = 0; aatx < frame_parms->nb_antennas_tx; aatx++) + for (aatx = 0; aatx < nb_antennas_ue_tx; aatx++) for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { //clear average level avg128U = _mm_setzero_si128(); @@ -624,11 +627,12 @@ void nr_ulsch_channel_compensation(int **rxdataF_ext, unsigned short rb; unsigned char aatx,aarx; + char nb_antennas_ue_tx = 1; __m128i *ul_ch128,*ul_ch128_2,*ul_ch_mag128,*ul_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; QAM_amp128b = _mm_setzero_si128(); - for (aatx=0; aatxnb_antennas_tx; aatx++) { + for (aatx=0; aatxframe_parms; nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu; - dmrs_symbol_flag = 0; + gNB->pusch_vars[ulsch_id]->dmrs_symbol = INVALID_VALUE; + gNB->pusch_vars[ulsch_id]->cl_done = 0; - if(symbol == rel15_ul->start_symbol_index){ - gNB->pusch_vars[ulsch_id]->dmrs_symbol = 0; - gNB->pusch_vars[ulsch_id]->cl_done = 0; - } - - - bwp_start_subcarrier = (rel15_ul->rb_start*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size; - - dmrs_symbol_flag = ((rel15_ul->ul_dmrs_symb_pos)>>symbol)&0x01; - - LOG_D(PHY,"symbol %d bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n",symbol,bwp_start_subcarrier,rel15_ul->rb_start,frame_parms->first_carrier_offset); + bwp_start_subcarrier = ((rel15_ul->rb_start + rel15_ul->bwp_start)*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size; + LOG_D(PHY,"bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n", bwp_start_subcarrier, rel15_ul->rb_start, frame_parms->first_carrier_offset); LOG_D(PHY,"ul_dmrs_symb_pos %x\n",rel15_ul->ul_dmrs_symb_pos); - if (dmrs_symbol_flag == 1){ - if (((rel15_ul->ul_dmrs_symb_pos)>>((symbol+1)%frame_parms->symbols_per_slot))&0x01) - AssertFatal(1==0,"Double DMRS configuration is not yet supported\n"); - - if (rel15_ul->dmrs_config_type == 0) { - // if no data in dmrs cdm group is 1 only even REs have no data - // if no data in dmrs cdm group is 2 both odd and even REs have no data - nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*6)); - } - else { - nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*4)); - } - LOG_D(PHY,"dmrs_symbol: nb_re_pusch %d\n",nb_re_pusch); - gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol; - - } else { - nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB; - } - //---------------------------------------------------------- //--------------------- Channel estimation --------------------- //---------------------------------------------------------- start_meas(&gNB->ulsch_channel_estimation_stats); - if (dmrs_symbol_flag == 1) { - nr_pusch_channel_estimation(gNB, - nr_tti_rx, - 0, // p - symbol, - ulsch_id, - bwp_start_subcarrier, - rel15_ul); + for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++) { + uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01; + LOG_D(PHY,"symbol %d, dmrs_symbol_flag :%d\n", symbol, dmrs_symbol_flag); + if (dmrs_symbol_flag == 1) { + if (gNB->pusch_vars[ulsch_id]->dmrs_symbol == INVALID_VALUE) + gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol; - for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { - gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size], - rel15_ul->rb_size*12); - if (gNB->pusch_vars[ulsch_id]->ulsch_power[aarx]==1) return (1); + nr_pusch_channel_estimation(gNB, + slot, + 0, // p + symbol, + ulsch_id, + bwp_start_subcarrier, + rel15_ul); + + nr_gnb_measurements(gNB, ulsch_id, harq_pid, symbol); + + for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) { + gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size], + rel15_ul->rb_size*12); + if (gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] == 1) + return 1; + } } - } stop_meas(&gNB->ulsch_channel_estimation_stats); - //---------------------------------------------------------- - //--------------------- RBs extraction --------------------- - //---------------------------------------------------------- - gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] = nb_re_pusch; +#ifdef __AVX2__ + int off = ((rel15_ul->rb_size&1) == 1)? 4:0; +#else + int off = 0; +#endif + uint32_t rxdataF_ext_offset = 0; - if (nb_re_pusch > 0) { + for(uint8_t symbol = rel15_ul->start_symbol_index; symbol < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); symbol++) { + uint8_t dmrs_symbol_flag = (rel15_ul->ul_dmrs_symb_pos >> symbol) & 0x01; + if (dmrs_symbol_flag == 1) { + if ((rel15_ul->ul_dmrs_symb_pos >> ((symbol + 1) % frame_parms->symbols_per_slot)) & 0x01) + AssertFatal(1==0,"Double DMRS configuration is not yet supported\n"); - start_meas(&gNB->ulsch_rbs_extraction_stats); - nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF, - gNB->pusch_vars[ulsch_id], - symbol, - dmrs_symbol_flag, - rel15_ul, - frame_parms); - stop_meas(&gNB->ulsch_rbs_extraction_stats); + gNB->pusch_vars[ulsch_id]->dmrs_symbol = symbol; - //---------------------------------------------------------- - //--------------------- Channel Scaling -------------------- - //---------------------------------------------------------- - - nr_ulsch_scale_channel(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, - frame_parms, - gNB->ulsch[ulsch_id], - symbol, - dmrs_symbol_flag, - rel15_ul->rb_size, - rel15_ul->dmrs_config_type); - - - if (gNB->pusch_vars[ulsch_id]->cl_done==0) { - - nr_ulsch_channel_level(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, - frame_parms, - avg, - symbol, - nb_re_pusch, - rel15_ul->rb_size); - - avgs = 0; - - for (aatx=0;aatxnb_antennas_tx;aatx++) - for (aarx=0;aarxnb_antennas_rx;aarx++) - avgs = cmax(avgs,avg[(aatx<<1)+aarx]); - - gNB->pusch_vars[ulsch_id]->log2_maxh = (log2_approx(avgs)/2)+3; - gNB->pusch_vars[ulsch_id]->cl_done = 1; + if (rel15_ul->dmrs_config_type == 0) { + // if no data in dmrs cdm group is 1 only even REs have no data + // if no data in dmrs cdm group is 2 both odd and even REs have no data + nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*6)); + } + else { + nb_re_pusch = rel15_ul->rb_size *(12 - (rel15_ul->num_dmrs_cdm_grps_no_data*4)); + } + } else { + nb_re_pusch = rel15_ul->rb_size * NR_NB_SC_PER_RB; } - //---------------------------------------------------------- - //--------------------- Channel Compensation --------------- - //---------------------------------------------------------- + gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] = nb_re_pusch; + LOG_D(PHY,"symbol %d: nb_re_pusch %d, DMRS symbl used for Chest :%d \n", symbol, nb_re_pusch, gNB->pusch_vars[ulsch_id]->dmrs_symbol); - start_meas(&gNB->ulsch_channel_compensation_stats); - nr_ulsch_channel_compensation(gNB->pusch_vars[ulsch_id]->rxdataF_ext, - gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, - gNB->pusch_vars[ulsch_id]->ul_ch_mag0, - gNB->pusch_vars[ulsch_id]->ul_ch_magb0, - gNB->pusch_vars[ulsch_id]->rxdataF_comp, - (frame_parms->nb_antennas_tx>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL, - frame_parms, + //---------------------------------------------------------- + //--------------------- RBs extraction --------------------- + //---------------------------------------------------------- + if (nb_re_pusch > 0) { + + start_meas(&gNB->ulsch_rbs_extraction_stats); + nr_ulsch_extract_rbs_single(gNB->common_vars.rxdataF, + gNB->pusch_vars[ulsch_id], symbol, dmrs_symbol_flag, - rel15_ul->qam_mod_order, - rel15_ul->rb_size, - gNB->pusch_vars[ulsch_id]->log2_maxh); - stop_meas(&gNB->ulsch_channel_compensation_stats); + rel15_ul, + frame_parms); + stop_meas(&gNB->ulsch_rbs_extraction_stats); - start_meas(&gNB->ulsch_mrc_stats); - nr_ulsch_detection_mrc(frame_parms, - gNB->pusch_vars[ulsch_id]->rxdataF_comp, - gNB->pusch_vars[ulsch_id]->ul_ch_mag, - gNB->pusch_vars[ulsch_id]->ul_ch_magb, - symbol, - rel15_ul->rb_size); - stop_meas(&gNB->ulsch_mrc_stats); + //---------------------------------------------------------- + //--------------------- Channel Scaling -------------------- + //---------------------------------------------------------- + nr_ulsch_scale_channel(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, + frame_parms, + gNB->ulsch[ulsch_id], + symbol, + dmrs_symbol_flag, + rel15_ul->rb_size, + rel15_ul->dmrs_config_type); + if (gNB->pusch_vars[ulsch_id]->cl_done==0) { + nr_ulsch_channel_level(gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, + frame_parms, + avg, + symbol, + nb_re_pusch, + rel15_ul->rb_size); + + avgs = 0; + + for (aatx=0;aatxnb_antennas_rx;aarx++) + avgs = cmax(avgs,avg[(aatx<<1)+aarx]); + + gNB->pusch_vars[ulsch_id]->log2_maxh = (log2_approx(avgs)/2)+3; + gNB->pusch_vars[ulsch_id]->cl_done = 1; + } + + //---------------------------------------------------------- + //--------------------- Channel Compensation --------------- + //---------------------------------------------------------- + start_meas(&gNB->ulsch_channel_compensation_stats); + nr_ulsch_channel_compensation(gNB->pusch_vars[ulsch_id]->rxdataF_ext, + gNB->pusch_vars[ulsch_id]->ul_ch_estimates_ext, + gNB->pusch_vars[ulsch_id]->ul_ch_mag0, + gNB->pusch_vars[ulsch_id]->ul_ch_magb0, + gNB->pusch_vars[ulsch_id]->rxdataF_comp, + (nb_antennas_ue_tx>1) ? gNB->pusch_vars[ulsch_id]->rho : NULL, + frame_parms, + symbol, + dmrs_symbol_flag, + rel15_ul->qam_mod_order, + rel15_ul->rb_size, + gNB->pusch_vars[ulsch_id]->log2_maxh); + stop_meas(&gNB->ulsch_channel_compensation_stats); + + start_meas(&gNB->ulsch_mrc_stats); + nr_ulsch_detection_mrc(frame_parms, + gNB->pusch_vars[ulsch_id]->rxdataF_comp, + gNB->pusch_vars[ulsch_id]->ul_ch_mag, + gNB->pusch_vars[ulsch_id]->ul_ch_magb, + symbol, + rel15_ul->rb_size); + stop_meas(&gNB->ulsch_mrc_stats); + + if (rel15_ul->transform_precoding == transform_precoder_enabled) { - if (rel15_ul->transform_precoding == transform_precoder_enabled) { - #ifdef __AVX2__ // For odd number of resource blocks need byte alignment to multiple of 8 int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7); #else int nb_re_pusch2 = nb_re_pusch; - #endif - - // perform IDFT operation on the compensated rxdata if transform precoding is enabled - nr_idft(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * nb_re_pusch2], nb_re_pusch); - LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d\n", symbol, nb_re_pusch); - } + #endif + // perform IDFT operation on the compensated rxdata if transform precoding is enabled + nr_idft(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * nb_re_pusch2], nb_re_pusch); + LOG_D(PHY,"Transform precoding being done on data- symbol: %d, nb_re_pusch: %d\n", symbol, nb_re_pusch); + } - //---------------------------------------------------------- - //--------------------- PTRS Processing -------------------- - //---------------------------------------------------------- + //---------------------------------------------------------- + //--------------------- PTRS Processing -------------------- + //---------------------------------------------------------- + /* In case PTRS is enabled then LLR will be calculated after PTRS symbols are processed * + * otherwise LLR are calculated for each symbol based upon DMRS channel estimates only. */ + if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { + start_meas(&gNB->ulsch_ptrs_processing_stats); + nr_pusch_ptrs_processing(gNB, + frame_parms, + rel15_ul, + ulsch_id, + slot, + symbol, + nb_re_pusch); + stop_meas(&gNB->ulsch_ptrs_processing_stats); - /* In case PTRS is enabled then LLR will be calculated after PTRS symbols are processed * - * otherwise LLR are calculated for each symbol based upon DMRS channel estimates only. */ - if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) - { - start_meas(&gNB->ulsch_ptrs_processing_stats); - nr_pusch_ptrs_processing(gNB, - frame_parms, - rel15_ul, - ulsch_id, - nr_tti_rx, - symbol, - nb_re_pusch); - stop_meas(&gNB->ulsch_ptrs_processing_stats); + /* Subtract total PTRS RE's in the symbol from PUSCH RE's */ + gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] -= gNB->pusch_vars[ulsch_id]->ptrs_re_per_slot; + } - /* Subtract total PTRS RE's in the symbol from PUSCH RE's */ - gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol] -= gNB->pusch_vars[ulsch_id]->ptrs_re_per_slot; - } - } - - /*---------------------------------------------------------------------------------------------------- */ - /*-------------------- LLRs computation -------------------------------------------------------------*/ - /*-----------------------------------------------------------------------------------------------------*/ - if(symbol == (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols -1)) { - -#ifdef __AVX2__ - int off = ((rel15_ul->rb_size&1) == 1)? 4:0; -#else - int off = 0; -#endif - uint32_t rxdataF_ext_offset = 0; - for(uint8_t i =rel15_ul->start_symbol_index; i< (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols);i++) { + /*---------------------------------------------------------------------------------------------------- */ + /*-------------------- LLRs computation -------------------------------------------------------------*/ + /*-----------------------------------------------------------------------------------------------------*/ start_meas(&gNB->ulsch_llr_stats); - nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][i * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)], - gNB->pusch_vars[ulsch_id]->ul_ch_mag0, - gNB->pusch_vars[ulsch_id]->ul_ch_magb0, - &gNB->pusch_vars[ulsch_id]->llr[rxdataF_ext_offset * rel15_ul->qam_mod_order], - rel15_ul->rb_size, - gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[i], - i, - rel15_ul->qam_mod_order); + nr_ulsch_compute_llr(&gNB->pusch_vars[ulsch_id]->rxdataF_comp[0][symbol * (off + rel15_ul->rb_size * NR_NB_SC_PER_RB)], + gNB->pusch_vars[ulsch_id]->ul_ch_mag0, + gNB->pusch_vars[ulsch_id]->ul_ch_magb0, + &gNB->pusch_vars[ulsch_id]->llr[rxdataF_ext_offset * rel15_ul->qam_mod_order], + rel15_ul->rb_size, + gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol], + symbol, + rel15_ul->qam_mod_order); stop_meas(&gNB->ulsch_llr_stats); - rxdataF_ext_offset += gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[i]; - }// symbol loop - }// last symbol check - - return (0); + rxdataF_ext_offset += gNB->pusch_vars[ulsch_id]->ul_valid_re_per_slot[symbol]; + } + } // symbol loop + + return 0; } diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index 239ae1d6d7..3b5fd2e04a 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -397,6 +397,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if ((xrtmag_dB<(11+dB_fixed(no_corr))) || (dB_fixed(av_corr)<(13+gNB->measurements.n0_power_tot_dB))) //TODO these are temporary threshold based on measurments with the phone no_conf=true; } + gNB->bad_pucch += no_conf; // first bit of bitmap for sr presence and second bit for acknack presence uci_pdu->pduBitmap = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1); uci_pdu->pucch_format = 0; // format 0 @@ -1627,7 +1628,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, if (pucch_pdu->bit_len_harq>0) { int harq_bytes=pucch_pdu->bit_len_harq>>3; if ((pucch_pdu->bit_len_harq&7) > 0) harq_bytes++; - uci_pdu->pduBitmap|=1; + uci_pdu->pduBitmap|=2; uci_pdu->harq.harq_payload = (uint8_t*)malloc(harq_bytes); uci_pdu->harq.harq_crc = decoderState; int i=0; @@ -1641,7 +1642,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, } if (pucch_pdu->sr_flag == 1) { - uci_pdu->pduBitmap|=2; + uci_pdu->pduBitmap|=1; uci_pdu->sr.sr_bit_len = 1; uci_pdu->sr.sr_payload = malloc(1); uci_pdu->sr.sr_payload[0] = decodedPayload[0]&1; diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c index 6cb0a612e9..909d0b8954 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c @@ -77,9 +77,9 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, // generate pilot nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]); - int re_offset = ssb_offset; for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) { + int re_offset = ssb_offset; pil = (int16_t *)&pilot[0]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)]; @@ -277,9 +277,9 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, // generate pilot nr_pbch_dmrs_rx(dmrss,ue->nr_gold_pbch[n_hf][ssb_index], &pilot[0]); - int re_offset = ssb_offset; for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) { + int re_offset = ssb_offset; pil = (int16_t *)&pilot[0]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)]; dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; @@ -456,12 +456,12 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, // do ifft of channel estimate for (aarx=0; aarxframe_parms.nb_antennas_rx; aarx++) for (p=0; pframe_parms.nb_antenna_ports_gNB; p++) { - if (ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p<<1)+aarx]) + if (ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx]) { LOG_D(PHY,"Channel Impulse Computation Slot %d ThreadId %d Symbol %d ch_offset %d\n", Ns, proc->thread_id, symbol, ch_offset); idft(idftsizeidx, - (int16_t*) &ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p<<1)+aarx][ch_offset], - (int16_t*) ue->pbch_vars[eNB_offset]->dl_ch_estimates_time[(p<<1)+aarx],1); + (int16_t*) &ue->pbch_vars[eNB_offset]->dl_ch_estimates[(p*ue->frame_parms.nb_antennas_rx)+aarx][ch_offset], + (int16_t*) ue->pbch_vars[eNB_offset]->dl_ch_estimates_time[(p*ue->frame_parms.nb_antennas_rx)+aarx],1); } } } @@ -512,6 +512,13 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, fr = filt16a_r1; + // checking if re-initialization of scrambling IDs is needed (should be done here but scrambling ID for PDCCH is not taken from RRC) +/* if (( != ue->scramblingID_pdcch){ + ue->scramblingID_pdcch=; + nr_gold_pdsch(ue,ue->scramblingID_pdcch); + }*/ + + // generate pilot int pilot[nb_rb_coreset * 3] __attribute__((aligned(16))); nr_pdcch_dmrs_rx(ue,eNB_offset,Ns,ue->nr_gold_pdcch[eNB_offset][Ns][symbol], &pilot[0],2000,nb_rb_coreset); @@ -650,6 +657,7 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_offset, + bool is_SI, unsigned char Ns, unsigned short p, unsigned char symbol, @@ -672,7 +680,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; if (ue->high_speed_flag == 0) - ch_offset = ue->frame_parms.ofdm_symbol_size ; + ch_offset = ue->frame_parms.ofdm_symbol_size; else ch_offset = ue->frame_parms.ofdm_symbol_size*symbol; @@ -687,14 +695,25 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, #endif // generate pilot for gNB port number 1000+p - uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12 - BWPStart; + uint16_t rb_offset = (bwp_start_subcarrier - ue->frame_parms.first_carrier_offset) / 12; + if (is_SI) { + rb_offset -= BWPStart; + } uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type; int8_t delta = get_delta(p, config_type); - nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][symbol][0], &pilot[0],1000,0,nb_rb_pdsch+rb_offset); + + // checking if re-initialization of scrambling IDs is needed + if ((ue->dmrs_DownlinkConfig.scramblingID0 != ue->scramblingID[0]) || (ue->dmrs_DownlinkConfig.scramblingID1 != ue->scramblingID[1])){ + ue->scramblingID[0]=ue->dmrs_DownlinkConfig.scramblingID0; + ue->scramblingID[1]=ue->dmrs_DownlinkConfig.scramblingID1; + nr_gold_pdsch(ue,ue->scramblingID); + } + + nr_pdsch_dmrs_rx(ue,Ns,ue->nr_gold_pdsch[eNB_offset][Ns][symbol][0], &pilot[0],1000+p,0,nb_rb_pdsch+rb_offset); if (config_type == pdsch_dmrs_type1){ nushift = (p>>1)&1; - ue->frame_parms.nushift = nushift; + if (p<4) ue->frame_parms.nushift = nushift; switch (delta) { case 0://port 0,1 @@ -734,7 +753,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, } } else {//pdsch_dmrs_type2 nushift = delta; - ue->frame_parms.nushift = nushift; + if (p<6) ue->frame_parms.nushift = nushift; switch (delta) { case 0://port 0,1 fl = filt8_l2;//left interpolation Filter should be fml diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h index 6c461ef448..1466fabe5d 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h @@ -70,6 +70,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_offset, + bool is_SI, unsigned char Ns, unsigned short p, unsigned char symbol, diff --git a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c index 61fc40ad3f..3f52b29281 100644 --- a/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c +++ b/openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c @@ -21,16 +21,17 @@ /*! \file nr_ue_measurements.c * \brief UE measurements routines - * \author R. Knopp, G. Casati + * \author R. Knopp, G. Casati, K. Saaifan * \date 2020 * \version 0.1 * \company Eurecom, Fraunhofer IIS - * \email: knopp@eurecom.fr, guido.casati@iis.fraunhofer.de + * \email: knopp@eurecom.fr, guido.casati@iis.fraunhofer.de, khodr.saaifan@iis.fraunhofer.de * \note * \warning */ #include "executables/softmodem-common.h" +#include "executables/nr-softmodem-common.h" #include "PHY/defs_nr_UE.h" #include "PHY/phy_extern_nr_ue.h" #include "common/utils/LOG/log.h" @@ -45,7 +46,7 @@ //#define DEBUG_MEAS_UE //#define DEBUG_RANK_EST -// Returns the pathloss in dBm for the active UL BWP on the selected carrier based on the DL RS associated with the PRACH transmission +// Returns the pathloss in dB for the active UL BWP on the selected carrier based on the DL RS associated with the PRACH transmission // computation according to clause 7.4 (Physical random access channel) of 3GPP TS 38.213 version 16.3.0 Release 16 // Assumptions: // - PRACH transmission from a UE is not in response to a detection of a PDCCH order by the UE @@ -59,18 +60,17 @@ int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){ if (get_softmodem_params()->do_ra){ long referenceSignalPower = ue->nrUE_config.ssb_config.ss_pbch_power; - double rsrp_dBm = 10*log10(ue->measurements.rsrp[gNB_index]) + 30 - ue->rx_total_gain_dB; - pathloss = (int16_t)(10*log10(pow(10, (double)(referenceSignalPower)/10) - pow(10, (double)(rsrp_dBm)/10))); + pathloss = (int16_t)(referenceSignalPower - ue->measurements.rsrp_dBm[gNB_index]); - LOG_D(MAC, "In %s: pathloss %d dBm, UE RX total gain %d dB, referenceSignalPower %ld dBm (%f mW), RSRP %f dBm (%f mW)\n", + LOG_D(MAC, "In %s: pathloss %d dB, UE RX total gain %d dB, referenceSignalPower %ld dBm/RE (%f mW), RSRP %d dBm (%f mW)\n", __FUNCTION__, pathloss, ue->rx_total_gain_dB, referenceSignalPower, pow(10, referenceSignalPower/10), - rsrp_dBm, - pow(10, rsrp_dBm/10)); + ue->measurements.rsrp_dBm[gNB_index], + pow(10, ue->measurements.rsrp_dBm[gNB_index]/10)); } else { @@ -178,9 +178,9 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue, ue->measurements.rx_power_avg_dB[gNB_id] = dB_fixed( ue->measurements.rx_power_avg[gNB_id]); ue->measurements.wideband_cqi_tot[gNB_id] = dB_fixed2(ue->measurements.rx_power_tot[gNB_id], ue->measurements.n0_power_tot); ue->measurements.wideband_cqi_avg[gNB_id] = dB_fixed2(ue->measurements.rx_power_avg[gNB_id], ue->measurements.n0_power_avg); - ue->measurements.rx_rssi_dBm[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] - ue->rx_total_gain_dB; + ue->measurements.rx_rssi_dBm[gNB_id] = ue->measurements.rx_power_avg_dB[gNB_id] + 30 - 10*log10(pow(2, 30)) - ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - dB_fixed(ue->frame_parms.ofdm_symbol_size); - LOG_D(PHY, "[gNB %d] Slot %d, RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n", + LOG_I(PHY, "[gNB %d] Slot %d, RSSI %d dBm/RE, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d \n", gNB_id, slot, ue->measurements.rx_rssi_dBm[gNB_id], @@ -258,15 +258,20 @@ void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue, ue->measurements.rsrp_filtered[gNB_id] = ue->measurements.rsrp[gNB_id]; - LOG_D(PHY, "In %s: [UE %d] slot %d SS-RSRP: %3.1f dBm/RE (%d W)\n", + ue->measurements.rsrp_dBm[gNB_id] = 10*log10(ue->measurements.rsrp[gNB_id]) + 30 - 10*log10(pow(2,30)) - ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - dB_fixed(ue->frame_parms.ofdm_symbol_size); + + LOG_D(PHY, "In %s: [UE %d] slot %d SS-RSRP: %d dBm/RE (%d)\n", __FUNCTION__, ue->Mod_id, slot, - 10*log10(ue->measurements.rsrp[gNB_id]) + 30 - ue->rx_total_gain_dB, + ue->measurements.rsrp_dBm[gNB_id], ue->measurements.rsrp[gNB_id]); } +// This function computes the received noise power +// Measurement units: +// - psd_awgn (AWGN power spectral density): dBm/Hz void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t slot){ @@ -279,6 +284,9 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue, uint8_t k_length = 8; uint8_t l_sss = ue->symbol_offset + 2; unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier; + double rx_gain = openair0_cfg[0].rx_gain[0]; + double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; + ue->measurements.n0_power_tot = 0; LOG_D(PHY, "In %s doing measurements for ssb_offset %d l_sss %d \n", __FUNCTION__, ssb_offset, l_sss); @@ -322,10 +330,17 @@ void nr_ue_rrc_measurements(PHY_VARS_NR_UE *ue, ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/aarx); #ifdef DEBUG_MEAS_RRC - int nf_usrp = ue->measurements.n0_power_tot_dB + 30 - ((int)openair0_cfg[0].rx_gain[0] - (int)openair0_cfg[0].rx_gain_offset[0]) - 90 - (-174 + dB_fixed(30000/*scs*/) + dB_fixed(ue->frame_parms.ofdm_symbol_size)); - LOG_D(PHY, "In %s slot %d NF USRP %d dBm\n", __FUNCTION__, nf_usrp); + const int psd_awgn = -174; + const int scs = 15000 * (1 << ue->frame_parms.numerology_index); + const int nf_usrp = ue->measurements.n0_power_tot_dB + 3 + 30 - ((int)rx_gain - (int)rx_gain_offset) - 10 * log10(pow(2, 30)) - (psd_awgn + dB_fixed(scs) + dB_fixed(ue->frame_parms.ofdm_symbol_size)); + LOG_D(PHY, "In [%s][slot:%d] NF USRP %d dB\n", __FUNCTION__, slot, nf_usrp); #endif - LOG_D(PHY, "In %s slot %d Noise Level %d ue->measurements.n0_power_tot_dB %d \n", __FUNCTION__, slot, ue->measurements.n0_power_tot, ue->measurements.n0_power_tot_dB); + LOG_D(PHY, "In [%s][slot:%d] Noise Level %d (digital level %d dB, noise power spectral density %f dBm/RE)\n", + __FUNCTION__, + slot, + ue->measurements.n0_power_tot, + ue->measurements.n0_power_tot_dB, + ue->measurements.n0_power_tot_dB + 30 - 10*log10(pow(2, 30)) - dB_fixed(ue->frame_parms.ofdm_symbol_size) - ((int)rx_gain - (int)rx_gain_offset)); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c index 8176514eb4..15303bb0c8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c @@ -132,7 +132,7 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr, if (reg_bundle_size_L != 0) { // interleaving will be done only if reg_bundle_size_L != 0 coreset_interleaved = 1; - coreset_C = (uint32_t) ((coreset_nbr_rb * coreset_time_dur) / (coreset_interleaver_size_R * reg_bundle_size_L)); + coreset_C = (uint32_t) (coreset_nbr_rb / (coreset_interleaver_size_R * reg_bundle_size_L)); } else { reg_bundle_size_L = 6; } @@ -140,7 +140,7 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr, int f_bundle_j_list[NR_MAX_PDCCH_AGG_LEVEL] = {}; - for (int reg = 0; reg < ((coreset_nbr_rb * coreset_time_dur)); reg++) { + for (int reg = 0; reg < coreset_nbr_rb; reg++) { if ((reg % reg_bundle_size_L) == 0) { if (r == coreset_interleaver_size_R) { r = 0; @@ -148,7 +148,7 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr, } bundle_j = (c * coreset_interleaver_size_R) + r; - f_bundle_j = ((r * coreset_C) + c + n_shift) % ((coreset_nbr_rb * coreset_time_dur) / reg_bundle_size_L); + f_bundle_j = ((r * coreset_C) + c + n_shift) % (coreset_nbr_rb / reg_bundle_size_L); if (coreset_interleaved == 0) f_bundle_j = bundle_j; @@ -174,22 +174,28 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr, } } - for(int reg=0; reg<((coreset_nbr_rb*coreset_time_dur)); reg++) { + int rb = 0; + for (int c_id = 0; c_id < number_of_candidates; c_id++ ) { + for (int symbol_idx = 0; symbol_idx < coreset_time_dur; symbol_idx++) { + for (int cce_count = CCE[c_id/coreset_time_dur]+c_id%coreset_time_dur; cce_count < CCE[c_id/coreset_time_dur]+c_id%coreset_time_dur+L[c_id]; cce_count += coreset_time_dur) { + for (int reg_in_cce_idx = 0; reg_in_cce_idx < NR_NB_REG_PER_CCE; reg_in_cce_idx++) { - f_reg = (f_bundle_j_list_ord[reg/6]*reg_bundle_size_L)+(reg%reg_bundle_size_L); - index_z = 9*reg; - index_llr = 9*((uint16_t)floor(f_reg/coreset_time_dur)+((f_reg%coreset_time_dur)*(coreset_nbr_rb))); + f_reg = (f_bundle_j_list_ord[cce_count] * reg_bundle_size_L) + reg_in_cce_idx; + index_z = 9 * rb; + index_llr = (uint16_t) (f_reg + symbol_idx * coreset_nbr_rb) * 9; - for (int i=0; i<9; i++) { - z[index_z + i] = llr[index_llr + i]; + for (int i = 0; i < 9; i++) { + z[index_z + i] = llr[index_llr + i]; #ifdef NR_PDCCH_DCI_DEBUG - LOG_D(PHY,"[reg=%d,bundle_j=%d] z[%d]=(%d,%d) <-> \t[f_reg=%d,fbundle_j=%d] llr[%d]=(%d,%d) \n", - reg,bundle_j,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]), - f_reg,f_bundle_j,(index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i])); + LOG_I(PHY,"[cce_count=%d,reg_in_cce_idx=%d,bundle_j=%d,symbol_idx=%d,candidate=%d] z[%d]=(%d,%d) <-> \t[f_reg=%d,fbundle_j=%d] llr[%d]=(%d,%d) \n", + cce_count,reg_in_cce_idx,bundle_j,symbol_idx,c_id,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]), + f_reg,f_bundle_j,(index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i])); #endif + } + rb++; + } + } } - - if ((reg%reg_bundle_size_L) == 0) r++; } } @@ -874,6 +880,33 @@ void nr_pdcch_unscrambling(int16_t *z, #ifdef NR_PDCCH_DCI_RUN +/* This function compares the received DCI bits with + * re-encoded DCI bits and returns the number of mismatched bits + */ +uint16_t nr_dci_false_detection(uint64_t *dci, + int16_t *soft_in, + const t_nrPolar_params *polar_param, + int encoded_length, + int rnti) { + + uint32_t encoder_output[NR_MAX_DCI_SIZE_DWORD]; + polar_encoder_fast(dci, (void*)encoder_output, rnti, 1, polar_param); + uint8_t *enout_p = (uint8_t*)encoder_output; + uint16_t x = 0; + + for (int i=0; i> 15 ) & 1); + x += ( ( enout_p[i] >> 1 ) & 1 ) ^ ( ( soft_in[i*8+1] >> 15 ) & 1 ); + x += ( ( enout_p[i] >> 2 ) & 1 ) ^ ( ( soft_in[i*8+2] >> 15 ) & 1 ); + x += ( ( enout_p[i] >> 3 ) & 1 ) ^ ( ( soft_in[i*8+3] >> 15 ) & 1 ); + x += ( ( enout_p[i] >> 4 ) & 1 ) ^ ( ( soft_in[i*8+4] >> 15 ) & 1 ); + x += ( ( enout_p[i] >> 5 ) & 1 ) ^ ( ( soft_in[i*8+5] >> 15 ) & 1 ); + x += ( ( enout_p[i] >> 6 ) & 1 ) ^ ( ( soft_in[i*8+6] >> 15 ) & 1 ); + x += ( ( enout_p[i] >> 7 ) & 1 ) ^ ( ( soft_in[i*8+7] >> 15 ) & 1 ); + } + return x; +} + uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, fapi_nr_dci_indication_t *dci_ind) { @@ -920,15 +953,23 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, if (crc == n_rnti) { LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n", proc->frame_rx, proc->nr_slot_rx,n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation); - dci_ind->SFN = proc->frame_rx; - dci_ind->slot = proc->nr_slot_rx; - dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti; - dci_ind->dci_list[dci_ind->number_of_dcis].n_CCE = CCEind; - dci_ind->dci_list[dci_ind->number_of_dcis].dci_format = rel15->dci_format_options[k]; - dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length; - memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8); - dci_ind->number_of_dcis++; - break; // If DCI is found, no need to check for remaining DCI lengths + uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,currentPtrDCI,L*108,n_rnti); + ue->dci_thres = (ue->dci_thres + mb) / 2; + if (mb > (ue->dci_thres+20)) { + LOG_W(PHY,"DCI false positive. Dropping DCI index %d. Mismatched bits: %d/%d. Current DCI threshold: %d\n",j,mb,L*108,ue->dci_thres); + continue; + } + else { + dci_ind->SFN = proc->frame_rx; + dci_ind->slot = proc->nr_slot_rx; + dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti; + dci_ind->dci_list[dci_ind->number_of_dcis].n_CCE = CCEind; + dci_ind->dci_list[dci_ind->number_of_dcis].dci_format = rel15->dci_format_options[k]; + dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length; + memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8); + dci_ind->number_of_dcis++; + break; // If DCI is found, no need to check for remaining DCI lengths + } } else { LOG_D(PHY,"(%i.%i) Decoded crc %x does not match rnti %x for DCI format %d\n", proc->frame_rx, proc->nr_slot_rx, crc, n_rnti, rel15->dci_format_options[k]); } diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index 18ab627392..9bf00a6f4a 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -261,7 +261,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params* p_decParams = &decParams; - t_nrLDPC_time_stats procTime; + t_nrLDPC_time_stats procTime = {0}; t_nrLDPC_time_stats* p_procTime =&procTime ; if (!harq_process) { @@ -678,7 +678,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, memcpy(harq_process->b+offset, harq_process->c[r], - Kr_bytes- - (harq_process->F>>3) -((harq_process->C>1)?3:0)); + Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 9a31257244..35baef1792 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -52,7 +52,7 @@ * set as command line argument, see lte-softmodem.c * default value: 0 */ -int16_t nr_dlsch_demod_shift = 0; +int32_t nr_dlsch_demod_shift = 0; //int16_t interf_unaw_shift = 13; //#define DEBUG_HARQ @@ -84,8 +84,8 @@ unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{ */ //unsigned char offset_mumimo_llr_drange[29][3]= {{0, 6, 5},{0, 4, 5},{0, 4, 5},{0, 5, 4},{0, 5, 6},{0, 5, 3},{0, 4, 4},{0, 4, 4},{0, 3, 3},{0, 1, 2},{1, 1, 0},{1, 3, 2},{3, 4, 1},{2, 0, 0},{2, 2, 2},{1, 1, 1},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; - -extern void print_shorts(char *s,int16_t *x); +#define print_ints(s,x) printf("%s %d %d %d %d\n",s,(x)[0],(x)[1],(x)[2],(x)[3]) +#define print_shorts(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) static void nr_dlsch_dual_stream_correlation_core(int **dl_ch_estimates_ext, int **dl_ch_estimates_ext_i, @@ -96,6 +96,16 @@ static void nr_dlsch_dual_stream_correlation_core(int **dl_ch_estimates_ext, int length, int start_point); +uint8_t nr_zero_forcing_rx_2layers(int **rxdataF_comp, + int **dl_ch_mag, + int **dl_ch_magb, + int **dl_ch_estimates_ext, + unsigned short nb_rb, + unsigned char n_rx, + unsigned char mod_order, + int shift, + unsigned char symbol); + static void nr_dlsch_layer_demapping(int16_t **llr_cw, uint8_t Nl, uint8_t mod_order, @@ -113,7 +123,7 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, RX_type_t rx_type, unsigned char harq_pid, unsigned char gNB_id, - unsigned char eNB_id_i, + unsigned char gNB_id_i, unsigned char first_symbol_flag, unsigned char symbol, unsigned short nb_rb, @@ -129,7 +139,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, PDSCH_t type, unsigned char gNB_id, - unsigned char eNB_id_i, //if this == ue->n_connected_gNB, we assume MU interference + unsigned char gNB_id_i, uint32_t frame, uint8_t nr_slot_rx, unsigned char symbol, @@ -145,7 +155,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, PHY_NR_MEASUREMENTS *measurements = &ue->measurements; NR_UE_DLSCH_t **dlsch; - int avg[4]; + int avg[16]; // int avg_0[2]; // int avg_1[2]; @@ -173,7 +183,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, //int16_t *pllr_symbol_cw1_deint; //uint16_t bundle_L = 2; uint8_t pilots=0; - uint8_t config_type = ue->dmrs_DownlinkConfig.pdsch_dmrs_type; + uint8_t config_type;// We should not use ue->dmrs_DownlinkConfig.pdsch_dmrs_type; uint16_t n_tx=1, n_rx=1; int32_t median[16]; uint32_t len; @@ -331,90 +341,44 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #endif pilots = ((1<dlDmrsSymbPos)>0 ? 1 : 0; + config_type = dlsch0_harq->dmrsConfigType; - if (frame_parms->nb_antenna_ports_gNB>1 && beamforming_mode==0) { -#ifdef DEBUG_DLSCH_MOD - LOG_I(PHY,"dlsch: using pmi %x (%p)\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch[0]); -#endif - + if (beamforming_mode==0) {//No beamforming #if UE_TIMING_TRACE start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); #endif - nb_rb = nr_dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[gNB_id]->rxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - dlsch0_harq->pmi_alloc, - pdsch_vars[gNB_id]->pmi_ext, - symbol, - pilots, - start_rb, - nb_rb_pdsch, - nr_slot_rx, - ue->high_speed_flag, - frame_parms, - dlsch0_harq->mimo_mode); -#ifdef DEBUG_DLSCH_MOD - printf("dlsch: using pmi %lx, pmi_ext ",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc)); - for (rb=0;rbpmi_ext[rb]); - printf("\n"); -#endif - - if (rx_type >= rx_IC_single_stream) { - if (eNB_id_i < ue->n_connected_gNB) // we are in TM5 - nb_rb = nr_dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[eNB_id_i]->rxdataF_ext, - pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, - dlsch0_harq->pmi_alloc, - pdsch_vars[eNB_id_i]->pmi_ext, - symbol, - pilots, - start_rb, - nb_rb_pdsch, - nr_slot_rx, - ue->high_speed_flag, - frame_parms, - dlsch0_harq->mimo_mode); - else - nb_rb = nr_dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[eNB_id_i]->rxdataF_ext, - pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, - dlsch0_harq->pmi_alloc, - pdsch_vars[eNB_id_i]->pmi_ext, - symbol, - pilots, - start_rb, - nb_rb_pdsch, - nr_slot_rx, - ue->high_speed_flag, - frame_parms, - dlsch0_harq->mimo_mode); - } - } else if (beamforming_mode==0) { //else if nb_antennas_ports_gNB==1 && beamforming_mode == 0 - //printf("start nr dlsch extract nr_slot_rx %d thread id %d \n", nr_slot_rx, proc->thread_id); - nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, - pdsch_vars[gNB_id]->dl_ch_estimates, - pdsch_vars[gNB_id]->rxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - dlsch0_harq->pmi_alloc, - pdsch_vars[gNB_id]->pmi_ext, - symbol, - pilots, - config_type, - start_rb + dlsch0_harq->BWPStart, - nb_rb_pdsch, - nr_slot_rx, - ue->high_speed_flag, - frame_parms, - dlsch0_harq->dlDmrsSymbPos); - - } /*else if(beamforming_mode>7) { + if (dlsch0_harq->Nl > 1)//More than or equal 2 layers + nb_rb = nr_dlsch_extract_rbs_multiple(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, + pdsch_vars[gNB_id]->dl_ch_estimates, + pdsch_vars[gNB_id]->rxdataF_ext, + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + symbol, + pilots, + config_type, + start_rb + dlsch0_harq->BWPStart, + nb_rb_pdsch, + dlsch0_harq->n_dmrs_cdm_groups, + dlsch0_harq->Nl, + frame_parms, + dlsch0_harq->dlDmrsSymbPos); + else// one layer + nb_rb = nr_dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF, + pdsch_vars[gNB_id]->dl_ch_estimates, + pdsch_vars[gNB_id]->rxdataF_ext, + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + symbol, + pilots, + config_type, + start_rb + dlsch0_harq->BWPStart, + nb_rb_pdsch, + dlsch0_harq->n_dmrs_cdm_groups, + frame_parms, + dlsch0_harq->dlDmrsSymbPos); + } + else if(beamforming_mode>7) { LOG_W(PHY,"dlsch_demodulation: beamforming mode not supported yet.\n"); - }*/ - + } + //printf("nb_rb = %d, gNB_id %d\n",nb_rb,gNB_id); if (nb_rb==0) { LOG_D(PHY,"dlsch_demodulation.c: nb_rb=0\n"); @@ -437,16 +401,18 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #if UE_TIMING_TRACE start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); #endif - n_tx = frame_parms->nb_antenna_ports_gNB; + n_tx = dlsch0_harq->Nl; n_rx = frame_parms->nb_antennas_rx; nr_dlsch_scale_channel(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - frame_parms, - dlsch, - symbol, - pilots, - len, - nb_rb); + frame_parms, + n_tx, + n_rx, + dlsch, + symbol, + pilots, + len, + nb_rb); #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); @@ -462,42 +428,40 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, #endif if (first_symbol_flag==1) { if (beamforming_mode==0){ - if (dlsch0_harq->mimo_modedl_ch_estimates_ext, - frame_parms, - avg, - symbol, - len, - nb_rb); - avgs = 0; - for (aatx=0;aatxnb_antenna_ports_gNB;aatx++) - for (aarx=0;aarxnb_antennas_rx;aarx++) - avgs = cmax(avgs,avg[(aatx<<1)+aarx]); + nr_dlsch_channel_level(pdsch_vars[gNB_id]->dl_ch_estimates_ext, + frame_parms, + n_tx, + avg, + symbol, + len, + nb_rb); + avgs = 0; + for (aatx=0;aatxnb_antennas_rx+aarx]); + avgs = cmax(avgs,avg[(aatx*frame_parms->nb_antennas_rx)+aarx]); + //LOG_I(PHY, "avgs Power per SC is %d\n", avgs); + median[(aatx*frame_parms->nb_antennas_rx)+aarx] = avg[(aatx*frame_parms->nb_antennas_rx)+aarx]; + } + pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2)+3; + //LOG_I(PHY, "avgs Power per SC is %d lg2_maxh %d\n", avgs, pdsch_vars[gNB_id]->log2_maxh); - pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2)+3; - } - else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) - { - nr_dlsch_channel_level_median(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - median, - n_tx, - n_rx, - 2*len,// subcarriers Re Im - 0); + if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { + nr_dlsch_channel_level_median(pdsch_vars[gNB_id]->dl_ch_estimates_ext, + median, + n_tx, + n_rx, + len, + symbol*nb_rb*12); - for (aatx = 0; aatx < n_tx; ++aatx) - { - for (aarx = 0; aarx < n_rx; ++aarx) - { - avgs = cmax(avgs, median[aatx*n_rx + aarx]); - } - } - - pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1; // this might need to be tuned - - } + for (aatx = 0; aatx < n_tx; aatx++) { + for (aarx = 0; aarx < n_rx; aarx++) { + avgs = cmax(avgs, median[aatx*n_rx + aarx]); + } + } + pdsch_vars[gNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1; + } } - //#ifdef UE_DEBUG_TRACE LOG_D(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n", frame%1024, nr_slot_rx, @@ -506,22 +470,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[gNB_id]->log2_maxh1, avg[0], avgs); - //LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode); - //#endif - - //wait until pdcch is decoded - //proc->channel_level = 1; } - /* - uint32_t wait = 0; - while(proc->channel_level == 0) - { - usleep(1); - wait++; - } - */ - #if T_TRACER if (type == PDSCH) { @@ -546,58 +496,25 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, // Now channel compensation if (dlsch0_harq->mimo_moderxdataF_ext, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - pdsch_vars[gNB_id]->dl_ch_mag0, - pdsch_vars[gNB_id]->dl_ch_magb0, - pdsch_vars[gNB_id]->dl_ch_magr0, - pdsch_vars[gNB_id]->rxdataF_comp0, - (aatx>1) ? pdsch_vars[gNB_id]->rho : NULL, - frame_parms, - symbol, - pilots, - first_symbol_flag, - dlsch0_harq->Qm, - nb_rb, - pdsch_vars[gNB_id]->log2_maxh, - measurements); // log2_maxh+I0_shift - /*if (symbol == 5) { - write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[gNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - } */ + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + pdsch_vars[gNB_id]->dl_ch_magr0, + pdsch_vars[gNB_id]->rxdataF_comp0, + (n_tx>1) ? pdsch_vars[gNB_id]->rho : NULL, + frame_parms, + n_tx, + symbol, + pilots, + first_symbol_flag, + dlsch0_harq->Qm, + nb_rb, + pdsch_vars[gNB_id]->log2_maxh, + measurements); // log2_maxh+I0_shift + } - /*if ((rx_type==rx_IC_single_stream) && - (eNB_id_in_connected_gNB)) { - nr_dlsch_channel_compensation(pdsch_vars[eNB_id_i]->rxdataF_ext, - pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, - pdsch_vars[eNB_id_i]->dl_ch_mag0, - pdsch_vars[eNB_id_i]->dl_ch_magb0, - pdsch_vars[eNB_id_i]->rxdataF_comp0, - (aatx>1) ? pdsch_vars[eNB_id_i]->rho : NULL, - frame_parms, - symbol, - first_symbol_flag, - i_mod, - nb_rb, - pdsch_vars[gNB_id]->log2_maxh, - measurements); // log2_maxh+I0_shift -#ifdef DEBUG_PHY - if (symbol == 5) { - write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[gNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); - } -#endif - - dlsch_dual_stream_correlation(frame_parms, - symbol, - nb_rb, - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, - pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], - pdsch_vars[gNB_id]->log2_maxh); - }*/ - } - - else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM){ - nr_dlsch_channel_compensation_core(pdsch_vars[gNB_id]->rxdataF_ext, + else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { + nr_dlsch_channel_compensation_core(pdsch_vars[gNB_id]->rxdataF_ext, pdsch_vars[gNB_id]->dl_ch_estimates_ext, pdsch_vars[gNB_id]->dl_ch_mag0, pdsch_vars[gNB_id]->dl_ch_magb0, @@ -609,40 +526,16 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, pdsch_vars[gNB_id]->log2_maxh, 2*len, // subcarriers Re Im 0); // we start from the beginning of the vector - /* if (symbol == 5) { - write_output("rxF_comp_d00.m","rxF_c_d00",&pdsch_vars[gNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM - write_output("rxF_comp_d01.m","rxF_c_d01",&pdsch_vars[gNB_id]->rxdataF_comp0[1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - write_output("rxF_comp_d10.m","rxF_c_d10",&pdsch_vars[gNB_id]->rxdataF_comp1[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - write_output("rxF_comp_d11.m","rxF_c_d11",&pdsch_vars[gNB_id]->rxdataF_comp1[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM - } */ - // compute correlation between signal and interference channels (rho12 and rho21) - nr_dlsch_dual_stream_correlation_core(pdsch_vars[gNB_id]->dl_ch_estimates_ext, - &(pdsch_vars[gNB_id]->dl_ch_estimates_ext[2]), - pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], - n_tx, - n_rx, - pdsch_vars[gNB_id]->log2_maxh, - 2*len, - 0); - //printf("rho stream1 =%d\n", &pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round] ); - nr_dlsch_dual_stream_correlation_core(&(pdsch_vars[gNB_id]->dl_ch_estimates_ext[2]), - pdsch_vars[gNB_id]->dl_ch_estimates_ext, - pdsch_vars[gNB_id]->dl_ch_rho2_ext, - n_tx, - n_rx, - pdsch_vars[gNB_id]->log2_maxh, - 2*len, - 0); - // printf("rho stream2 =%d\n",&pdsch_vars[gNB_id]->dl_ch_rho2_ext ); - //printf("TM3 log2_maxh : %d\n",pdsch_vars[gNB_id]->log2_maxh); - /* if (symbol == 5) { - write_output("rho0_0.m","rho0_0",&pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM - write_output("rho2_0.m","rho2_0",&pdsch_vars[gNB_id]->dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - write_output("rho0_1.m.m","rho0_1",&pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - write_output("rho2_1.m","rho2_1",&pdsch_vars[gNB_id]->dl_ch_rho2_ext[1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM - } */ - - } + // compute correlation between signal and interference channels (rho12 and rho21) + nr_dlsch_dual_stream_correlation_core(pdsch_vars[gNB_id]->dl_ch_estimates_ext, + &(pdsch_vars[gNB_id]->dl_ch_estimates_ext[2]), + pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], + n_tx, + n_rx, + pdsch_vars[gNB_id]->log2_maxh, + 2*len, + 0); + } #if UE_TIMING_TRACE stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]); @@ -657,35 +550,50 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, start_meas(&ue->generic_stat_bis[proc->thread_id][slot]); #endif - if (frame_parms->nb_antennas_rx > 1) { - if (dlsch0_harq->mimo_mode == NR_DUALSTREAM){ - nr_dlsch_detection_mrc_core(pdsch_vars[gNB_id]->rxdataF_comp0, - NULL, - pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], - pdsch_vars[gNB_id]->dl_ch_rho2_ext, - pdsch_vars[gNB_id]->dl_ch_mag0, - pdsch_vars[gNB_id]->dl_ch_magb0, - NULL, - NULL, - n_tx, - n_rx, - 2*len, - 0); - /* if (symbol == 5) { - write_output("rho0_mrc.m","rho0_0",&pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM - write_output("rho2_mrc.m","rho2_0",&pdsch_vars[gNB_id]->dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 - } */ + if (frame_parms->nb_antennas_rx > 1) { + if (dlsch0_harq->mimo_moderxdataF_comp0, + (n_tx>1)? pdsch_vars[gNB_id]->rho : NULL, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + n_tx, + n_rx, + symbol, + nb_rb); + if (n_tx == 2)//Apply zero forcing for 2 Tx layers + nr_zero_forcing_rx_2layers(pdsch_vars[gNB_id]->rxdataF_comp0, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + pdsch_vars[gNB_id]->dl_ch_estimates_ext, + nb_rb, + n_rx, + dlsch0_harq->Qm, + pdsch_vars[gNB_id]->log2_maxh, + symbol); } + else if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { + nr_dlsch_detection_mrc_core(pdsch_vars[gNB_id]->rxdataF_comp0, + NULL, + pdsch_vars[gNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[gNB_id]->dl_ch_rho2_ext, + pdsch_vars[gNB_id]->dl_ch_mag0, + pdsch_vars[gNB_id]->dl_ch_magb0, + NULL, + NULL, + n_tx, + n_rx, + 2*len, + 0); } - - //printf("start compute LLR\n"); + } + //printf("start compute LLR\n"); if (dlsch0_harq->mimo_mode == NR_DUALSTREAM) { rxdataF_comp_ptr = pdsch_vars[gNB_id]->rxdataF_comp1[harq_pid][round]; dl_ch_mag_ptr = pdsch_vars[gNB_id]->dl_ch_mag1[harq_pid][round]; } else { - rxdataF_comp_ptr = pdsch_vars[eNB_id_i]->rxdataF_comp0; - dl_ch_mag_ptr = pdsch_vars[eNB_id_i]->dl_ch_mag0; + rxdataF_comp_ptr = pdsch_vars[gNB_id_i]->rxdataF_comp0; + dl_ch_mag_ptr = pdsch_vars[gNB_id_i]->dl_ch_mag0; //i_mod should have been passed as a parameter } @@ -747,7 +655,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, rxdataF_comp_ptr, dl_ch_mag_ptr, dlsch0_harq, dlsch1_harq, rx_type, harq_pid, - gNB_id, eNB_id_i, + gNB_id, gNB_id_i, first_symbol_flag, i, nb_rb, round, codeword_TB0, codeword_TB1, @@ -868,10 +776,11 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, int **dl_ch_magb, int **dl_ch_magr, int **rxdataF_comp, - int **rho, + int ***rho, NR_DL_FRAME_PARMS *frame_parms, + uint8_t nb_aatx, unsigned char symbol, - uint8_t pilots, + uint8_t pilots, uint8_t first_symbol_flag, unsigned char mod_order, unsigned short nb_rb, @@ -882,12 +791,12 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, #if defined(__i386) || defined(__x86_64) unsigned short rb; - unsigned char aatx,aarx; + unsigned char aatx,aarx,atx; __m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*dl_ch_mag128r,*rxdataF128,*rxdataF_comp128,*rho128; __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b,QAM_amp128r; QAM_amp128b = _mm_setzero_si128(); - for (aatx=0; aatxnb_antenna_ports_gNB; aatx++) { + for (aatx=0; aatxnb_antennas_rx; aarx++) { - dl_ch128 = (__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12]; - dl_ch_mag128 = (__m128i *)&dl_ch_mag[(aatx<<1)+aarx][symbol*nb_rb*12]; - dl_ch_mag128b = (__m128i *)&dl_ch_magb[(aatx<<1)+aarx][symbol*nb_rb*12]; - dl_ch_mag128r = (__m128i *)&dl_ch_magr[(aatx<<1)+aarx][symbol*nb_rb*12]; + dl_ch128 = (__m128i *)&dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; + dl_ch_mag128 = (__m128i *)&dl_ch_mag[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; + dl_ch_mag128b = (__m128i *)&dl_ch_magb[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; + dl_ch_mag128r = (__m128i *)&dl_ch_magr[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*nb_rb*12]; - rxdataF_comp128 = (__m128i *)&rxdataF_comp[(aatx<<1)+aarx][symbol*nb_rb*12]; - + rxdataF_comp128 = (__m128i *)&rxdataF_comp[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; for (rb=0; rb2) { @@ -997,10 +905,15 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, // print_ints("c0",&mmtmpD2); // print_ints("c1",&mmtmpD3); rxdataF_comp128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + //printf("arx%d atx%d rb_index %d symbol%d\n",aarx,aatx,rb,symbol); // print_shorts("rx:",rxdataF128); // print_shorts("ch:",dl_ch128); // print_shorts("pack:",rxdataF_comp128); + //printf("arx%d atx%d rb_index %d symbol%d\n",aarx,aatx,rb,symbol); + //print_shorts("rx:",(int16_t*)&rxdataF128[0]); + //print_shorts("ch:",(int16_t*)&dl_ch128[0]); + //print_shorts("pack:",(int16_t*)&rxdataF_comp128[0]); // multiply by conjugated channel mmtmpD0 = _mm_madd_epi16(dl_ch128[1],rxdataF128[1]); // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) @@ -1015,9 +928,9 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); rxdataF_comp128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - // print_shorts("rx:",rxdataF128+1); - // print_shorts("ch:",dl_ch128+1); - // print_shorts("pack:",rxdataF_comp128+1); + //print_shorts("rx:",(int16_t*)&rxdataF128[1]); + //print_shorts("ch:",(int16_t*)&dl_ch128[1]); + //print_shorts("pack:",(int16_t*)&rxdataF_comp128[1]); if (pilots==0) { // multiply by conjugated channel @@ -1034,9 +947,9 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); rxdataF_comp128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); - // print_shorts("rx:",rxdataF128+2); - // print_shorts("ch:",dl_ch128+2); - // print_shorts("pack:",rxdataF_comp128+2); + //print_shorts("rx:",(int16_t*)&rxdataF128[2]); + //print_shorts("ch:",(int16_t*)&dl_ch128[2]); + //print_shorts("pack:",(int16_t*)&rxdataF_comp128[2]); dl_ch128+=3; dl_ch_mag128+=3; @@ -1044,107 +957,145 @@ void nr_dlsch_channel_compensation(int **rxdataF_ext, dl_ch_mag128r+=3; rxdataF128+=3; rxdataF_comp128+=3; - } else { // we have a smaller PDSCH in symbols with pilots so skip last group of 4 REs and increment less - dl_ch128+=2; - dl_ch_mag128+=2; - dl_ch_mag128b+=2; - dl_ch_mag128r+=2; - rxdataF128+=2; - rxdataF_comp128+=2; } - + else { // we have a smaller PDSCH in symbols with pilots so skip last group of 4 REs and increment less + dl_ch128+=2; + dl_ch_mag128+=2; + dl_ch_mag128b+=2; + dl_ch_mag128r+=2; + rxdataF128+=2; + rxdataF_comp128+=2; + } } } } - if (rho) { + //we compute the Tx correlation matrix for each Rx antenna + //As an example the 2x2 MIMO case requires + //rho[aarx][nb_aatx*nb_aatx] = [cov(H_aarx_0,H_aarx_0) cov(H_aarx_0,H_aarx_1) + // cov(H_aarx_1,H_aarx_0) cov(H_aarx_1,H_aarx_1)], aarx=0,...,nb_antennas_rx-1 + int avg_rho_re[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; + int avg_rho_im[frame_parms->nb_antennas_rx][nb_aatx*nb_aatx]; for (aarx=0; aarxnb_antennas_rx; aarx++) { - rho128 = (__m128i *)&rho[aarx][symbol*frame_parms->N_RB_DL*12]; - dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; - dl_ch128_2 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; - for (rb=0; rbnb_antennas_rx+aarx][symbol*nb_rb*12]; - // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) - mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[0],_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); - mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]); - // print_ints("im",&mmtmpD1); - mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch128_2[0]); - // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) - mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); - // print_ints("re(shift)",&mmtmpD0); - mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); - // print_ints("im(shift)",&mmtmpD1); - mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); - mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); - // print_ints("c0",&mmtmpD2); - // print_ints("c1",&mmtmpD3); - rho128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + for (atx=0; atxnb_antennas_rx+aarx][symbol*nb_rb*12]; - //print_shorts("rx:",dl_ch128_2); - //print_shorts("ch:",dl_ch128); - //print_shorts("pack:",rho128); + for (rb=0; rbrx_correlation[0][aarx] = signal_energy(&rho[aarx][symbol*nb_rb*12],rb*12); + rho128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + //print_shorts("rx:",dl_ch128_2+2); + //print_shorts("ch:",dl_ch128+2); + //print_shorts("pack:",rho128+2); + avg_rho_re[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[2])[0]+ + ((int16_t*)&rho128[2])[2] + + ((int16_t*)&rho128[2])[4] + + ((int16_t*)&rho128[2])[6])/16; + + avg_rho_im[aarx][aatx*nb_aatx+atx] +=(((int16_t*)&rho128[2])[1]+ + ((int16_t*)&rho128[2])[3] + + ((int16_t*)&rho128[2])[5] + + ((int16_t*)&rho128[2])[7])/16; + + dl_ch128+=3; + dl_ch128_2+=3; + rho128+=3; + } + if (first_symbol_flag==1) { + //measurements->rx_correlation[0][0][aarx] = signal_energy(&rho[aarx][aatx*nb_aatx+atx][symbol*nb_rb*12],rb*12); + avg_rho_re[aarx][aatx*nb_aatx+atx] = 16*avg_rho_re[aarx][aatx*nb_aatx+atx]/(nb_rb*12); + avg_rho_im[aarx][aatx*nb_aatx+atx] = 16*avg_rho_im[aarx][aatx*nb_aatx+atx]/(nb_rb*12); + printf("rho[rx]%d tx%d tx%d = Re: %d Im: %d\n",aarx, aatx,atx, avg_rho_re[aarx][aatx*nb_aatx+atx], avg_rho_im[aarx][aatx*nb_aatx+atx]); + } + } } } } - _mm_empty(); _m_empty(); #elif defined(__arm__) - unsigned short rb; unsigned char aatx,aarx,symbol_mod,pilots=0; @@ -1349,7 +1300,7 @@ void nr_dlsch_channel_compensation_core(int **rxdataF_ext, int **dl_ch_mag, int **dl_ch_magb, int **rxdataF_comp, - int **rho, + int ***rho, unsigned char n_tx, unsigned char n_rx, unsigned char mod_order, @@ -1486,7 +1437,7 @@ void nr_dlsch_channel_compensation_core(int **rxdataF_ext, for (aarx=0; aarxnb_antenna_ports_gNB; aatx++) { - for (aarx=0; aarxnb_antennas_rx; aarx++) { + for (aatx=0; aatxnb_antenna_ports_gNB; aatx++) + for (aatx=0; aatxnb_antennas_rx; aarx++) { //clear average level avg128D = _mm_setzero_si128(); - // 5 is always a symbol with no pilots for both normal and extended prefix - dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*nb_rb*12]; + dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*nb_rb*12]; for (rb=0;rbnb_antennas_rx)+aarx] =(((int32_t*)&avg128D)[0] + ((int32_t*)&avg128D)[1] + ((int32_t*)&avg128D)[2] + ((int32_t*)&avg128D)[3])/y; @@ -1729,38 +1682,36 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext, int norm_pack; __m128i *dl_ch128, norm128D; - for (aatx=0; aatx>2; + length2 = length>>2;//length = number of REs, hence length2=nb_REs*(32/128) in SIMD loop for (ii=0;ii max) - max = norm_pack; + max = norm_pack;//store values more than max if (norm_pack < min) - min = norm_pack; - + min = norm_pack;//store values less than min dl_ch128+=1; } - median[aatx*n_rx + aarx] = (max+min)>>1; - - // printf("Channel level median [%d]: %d\n",aatx*n_rx + aarx, median[aatx*n_rx + aarx]); + median[aatx*n_rx + aarx] = (max+min)>>1; + //printf("Channel level median [%d]: %d max = %d min = %d\n",aatx*n_rx + aarx, median[aatx*n_rx + aarx],max,min); } - } + } _mm_empty(); _m_empty(); @@ -2100,37 +2051,37 @@ void nr_dlsch_detection_mrc_core(int **rxdataF_comp, //============================================================================================== unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned short pmi, - unsigned char *pmi_ext, - unsigned char symbol, - uint8_t pilots, - uint8_t config_type, - unsigned short start_rb, - unsigned short nb_rb_pdsch, - unsigned char nr_slot_rx, - uint32_t high_speed_flag, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned char symbol, + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, NR_DL_FRAME_PARMS *frame_parms, - uint16_t dlDmrsSymbPos) { - - + uint16_t dlDmrsSymbPos) +{ unsigned short k,rb; - unsigned char i,aarx; //,nsymb,sss_symb,pss_symb=0,l; + unsigned char nushift,i,aarx; int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; int8_t validDmrsEst = 0; //store last DMRS Symbol index unsigned char j=0; - if (config_type==pdsch_dmrs_type1) - AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 1, - "nushift %d is illegal\n",frame_parms->nushift); - else - AssertFatal(frame_parms->nushift ==0 || frame_parms->nushift == 2 || frame_parms->nushift == 4, - "nushift %d is illegal\n",frame_parms->nushift); + if (config_type==pdsch_dmrs_type1) { + AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2, + "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); + nushift = n_dmrs_cdm_groups -1;//delta in Table 7.4.1.1.2-1 + + } else { + AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2 || n_dmrs_cdm_groups == 3, + "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); + nushift = (n_dmrs_cdm_groups -1)<<1;//delta in Table 7.4.1.1.2-2 + } for (aarx=0; aarxnb_antennas_rx; aarx++) { @@ -2151,33 +2102,35 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; } if (pilots==0) { - memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); - memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext)); - dl_ch0_ext+=12; - rxF_ext+=12; + memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); + memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext)); + dl_ch0_ext+=12; + rxF_ext+=12; } else {//the symbol contains DMRS j=0; if (config_type==pdsch_dmrs_type1){ - for (i = (1-frame_parms->nushift); i<12; i+=2) { + if (nushift == 0) {//data is multiplexed + for (i = (1-nushift); i<12; i+=2) { + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j]=dl_ch0[i]; + j++; + } + dl_ch0_ext+=6; + rxF_ext+=6; + } + } else {//pdsch_dmrs_type2 + for (i = (2+nushift); i<6; i++) { rxF_ext[j]=rxF[i]; dl_ch0_ext[j]=dl_ch0[i]; j++; } - dl_ch0_ext+=6; - rxF_ext+=6; - } else { - for (i = (2+frame_parms->nushift); i<6; i++) { + for (i = (8+nushift); i<12; i++) { rxF_ext[j]=rxF[i]; dl_ch0_ext[j]=dl_ch0[i]; j++; } - for (i = (8+frame_parms->nushift); i<12; i++) { - rxF_ext[j]=rxF[i]; - dl_ch0_ext[j]=dl_ch0[i]; - j++; - } - dl_ch0_ext+= 8; - rxF_ext+= 8; + dl_ch0_ext+= j; + rxF_ext+= j; } } @@ -2190,104 +2143,782 @@ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, } } } - - - return(nb_rb_pdsch/frame_parms->nb_antennas_rx); + return(nb_rb_pdsch); } -unsigned short nr_dlsch_extract_rbs_dual(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned short pmi, - unsigned char *pmi_ext, - unsigned char symbol, - uint8_t pilots, - unsigned short start_rb, - unsigned short nb_rb_pdsch, - unsigned char nr_slot_rx, - uint32_t high_speed_flag, - NR_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode) { +unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned char symbol, + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, + uint8_t Nl, + NR_DL_FRAME_PARMS *frame_parms, + uint16_t dlDmrsSymbPos) +{ - int prb,nb_rb=0; - unsigned short k; - int i,j,aarx; - int32_t *dl_ch0=NULL,*dl_ch0_ext=NULL,*dl_ch1=NULL,*dl_ch1_ext=NULL,*rxF=NULL,*rxF_ext=NULL; + unsigned short k,rb; + unsigned char nushift,j,i,aarx,aatx; + int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; + int8_t validDmrsEst = 0; //store last DMRS Symbol index - k = frame_parms->first_carrier_offset + 516; //0 + if (config_type==pdsch_dmrs_type1) { + AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2, + "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); + nushift = n_dmrs_cdm_groups -1;//delta in Table 7.4.1.1.2-1 + } else { + AssertFatal(n_dmrs_cdm_groups == 1 || n_dmrs_cdm_groups == 2 || n_dmrs_cdm_groups == 3, + "n_dmrs_cdm_groups %d is illegal\n",n_dmrs_cdm_groups); + nushift = (n_dmrs_cdm_groups -1)<<1;//delta in Table 7.4.1.1.2-2 + } + + validDmrsEst = get_valid_dmrs_idx_for_channel_est(dlDmrsSymbPos,symbol); for (aarx=0; aarxnb_antennas_rx; aarx++) { - if (high_speed_flag==1) { - dl_ch0 = &dl_ch_estimates[aarx][symbol*(frame_parms->ofdm_symbol_size)]; - dl_ch1 = &dl_ch_estimates[2+aarx][symbol*(frame_parms->ofdm_symbol_size)]; - } else { - dl_ch0 = &dl_ch_estimates[aarx][0]; - dl_ch1 = &dl_ch_estimates[2+aarx][0]; - } + k = frame_parms->first_carrier_offset + NR_NB_SC_PER_RB*start_rb; + if (k>frame_parms->ofdm_symbol_size) + k = k-frame_parms->ofdm_symbol_size; - //pmi_loc = pmi_ext; + rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)]; + rxF = &rxdataF[aarx][(k+(symbol*(frame_parms->ofdm_symbol_size)))]; - // pointers to extracted RX signals and channel estimates - rxF_ext = &rxdataF_ext[aarx][symbol*(nb_rb_pdsch*12)]; - dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(nb_rb_pdsch*12)]; - dl_ch1_ext = &dl_ch_estimates_ext[2+aarx][symbol*(nb_rb_pdsch*12)]; + for (aatx=0; aatxN_RB_DL; prb++) { - //skip_half=0; + dl_ch0 = &dl_ch_estimates[(aatx*frame_parms->nb_antennas_rx)+aarx][(validDmrsEst*(frame_parms->ofdm_symbol_size))]; + dl_ch0_ext = &dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx][symbol*(nb_rb_pdsch*NR_NB_SC_PER_RB)]; - if ((frame_parms->N_RB_DL&1) == 0) { // even number of RBs - - // For second half of RBs skip DC carrier - if (k>=frame_parms->ofdm_symbol_size) { - rxF = &rxdataF[aarx][(symbol*(frame_parms->ofdm_symbol_size))]; - k=k-(frame_parms->ofdm_symbol_size); + for (rb = 0; rb < nb_rb_pdsch; rb++) + { + if (pilots==0) {//data symbol only + if (aatx==0) {//Extract Rx signal only + memcpy((void*)rxF_ext,(void*)rxF,12*sizeof(*rxF_ext)); + rxF_ext+=12; + } + memcpy((void*)dl_ch0_ext,(void*)dl_ch0,12*sizeof(*dl_ch0_ext));//Extract Channel Estimate + dl_ch0_ext+=12; + } + else {//the symbol contains DMRS + j=0; + if (config_type==pdsch_dmrs_type1) { + if (nushift == 0) {//data is multiplexed + for (i = (1-nushift); i<12; i+=2) { + if (aatx==0) rxF_ext[j]=rxF[i]; + dl_ch0_ext[j]=dl_ch0[i]; + j++; + } + dl_ch0_ext+=6; + if (aatx==0) rxF_ext+=6; + } + } + else {//pdsch_dmrs_type2 + for (i = (2+nushift); i<6; i++) { + if (aatx==0) rxF_ext[j]=rxF[i]; + dl_ch0_ext[j]=dl_ch0[i]; + j++; + } + for (i = (8+nushift); i<12; i++) { + if (aatx==0) rxF_ext[j]=rxF[i]; + dl_ch0_ext[j]=dl_ch0[i]; + j++; + } + dl_ch0_ext+= j; + if (aatx==0) rxF_ext+= j; + } } - /* - if (mimo_mode <= PUSCH_PRECODING1) - *pmi_loc = (pmi>>((prb>>2)<<1))&3; - else - *pmi_loc=(pmi>>prb)&1;*/ - - // *pmi_loc = get_pmi(frame_parms->N_RB_DL,mimo_mode,pmi,prb); - // pmi_loc++; - - - if (pilots == 0) { - - memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); - memcpy(dl_ch1_ext,dl_ch1,12*sizeof(int)); - memcpy(rxF_ext,rxF,12*sizeof(int)); - dl_ch0_ext +=12; - dl_ch1_ext +=12; - rxF_ext +=12; - } else { // pilots==1 - j=0; - for (i=0; i<12; i++) { - if ((i&1)!=frame_parms->nushift) { - rxF_ext[j]=rxF[i]; - // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); - dl_ch0_ext[j]=dl_ch0[i]; - dl_ch1_ext[j++]=dl_ch1[i]; - } - } - dl_ch0_ext+=6; - dl_ch1_ext+=6; - rxF_ext+=6; - } // pilots==1 - - dl_ch0+=12; - dl_ch1+=12; + dl_ch0+=12; + if (aatx==0) { rxF+=12; k+=12; - } - } // for prb - } // for aarx - return(nb_rb/frame_parms->nb_antennas_rx); + if (k>=frame_parms->ofdm_symbol_size) { + k=k-(frame_parms->ofdm_symbol_size); + rxF = &rxdataF[aarx][k+(symbol*(frame_parms->ofdm_symbol_size))]; + } + } + }//rb + }//aatx + }//aarx + return(nb_rb_pdsch); } +void nr_dlsch_detection_mrc(int **rxdataF_comp, + int ***rho, + int **dl_ch_mag, + int **dl_ch_magb, + short n_tx, + short n_rx, + unsigned char symbol, + unsigned short nb_rb) { +#if defined(__x86_64__)||defined(__i386__) + unsigned char aatx, aarx; + int i; + __m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0,*dl_ch_mag128_1,*dl_ch_mag128_0b,*dl_ch_mag128_1b; + + if (n_rx>1) { + for (aatx=0; aatxN_RB_DL*12]; + rho128_1 = (__m128i *) &rho[1][symbol*frame_parms->N_RB_DL*12]; + for (i=0; i=2){ + // (1/2^log2_maxh)*conj_H_00xH_00: (1/(64*2))conjH_00*H_00*2^15 + nr_conjch0_mult_ch1(ch00, + ch00, + conjch00_ch00, + nb_rb, + shift); + // (1/2^log2_maxh)*conj_H_10xH_10: (1/(64*2))conjH_10*H_10*2^15 + nr_conjch0_mult_ch1(ch10, + ch10, + conjch10_ch10, + nb_rb, + shift); + // conj_H_00xH_01 + nr_conjch0_mult_ch1(ch00, + ch01, + conjch00_ch01, + nb_rb, + shift); // this shift is equal to the channel level log2_maxh + // conj_H_10xH_11 + nr_conjch0_mult_ch1(ch10, + ch11, + conjch10_ch11, + nb_rb, + shift); + // conj_H_01xH_01 + nr_conjch0_mult_ch1(ch01, + ch01, + conjch01_ch01, + nb_rb, + shift); + // conj_H_11xH_11 + nr_conjch0_mult_ch1(ch11, + ch11, + conjch11_ch11, + nb_rb, + shift); + // conj_H_01xH_00 + nr_conjch0_mult_ch1(ch01, + ch00, + conjch01_ch00, + nb_rb, + shift); + // conj_H_11xH_10 + nr_conjch0_mult_ch1(ch11, + ch10, + conjch11_ch10, + nb_rb, + shift); + } + if (n_rx==4){ + // (1/2^log2_maxh)*conj_H_20xH_20: (1/(64*2*16))conjH_20*H_20*2^15 + nr_conjch0_mult_ch1(ch20, + ch20, + conjch20_ch20, + nb_rb, + shift); + + // (1/2^log2_maxh)*conj_H_30xH_30: (1/(64*2*4))conjH_30*H_30*2^15 + nr_conjch0_mult_ch1(ch30, + ch30, + conjch30_ch30, + nb_rb, + shift); + + // (1/2^log2_maxh)*conj_H_20xH_20: (1/(64*2))conjH_20*H_20*2^15 + nr_conjch0_mult_ch1(ch20, + ch21, + conjch20_ch21, + nb_rb, + shift); + + nr_conjch0_mult_ch1(ch30, + ch31, + conjch30_ch31, + nb_rb, + shift); + + nr_conjch0_mult_ch1(ch21, + ch21, + conjch21_ch21, + nb_rb, + shift); + + nr_conjch0_mult_ch1(ch31, + ch31, + conjch31_ch31, + nb_rb, + shift); + + // (1/2^log2_maxh)*conj_H_20xH_20: (1/(64*2))conjH_20*H_20*2^15 + nr_conjch0_mult_ch1(ch21, + ch20, + conjch21_ch20, + nb_rb, + shift); + + nr_conjch0_mult_ch1(ch31, + ch30, + conjch31_ch30, + nb_rb, + shift); + + nr_construct_HhH_elements(conjch00_ch00, + conjch01_ch01, + conjch11_ch11, + conjch10_ch10,// + conjch20_ch20, + conjch21_ch21, + conjch30_ch30, + conjch31_ch31, + conjch00_ch01, + conjch01_ch00, + conjch10_ch11, + conjch11_ch10,// + conjch20_ch21, + conjch21_ch20, + conjch30_ch31, + conjch31_ch30, + af_mf_00, + af_mf_01, + af_mf_10, + af_mf_11, + nb_rb, + symbol); + } + if (n_rx==2){ + nr_construct_HhH_elements(conjch00_ch00, + conjch01_ch01, + conjch11_ch11, + conjch10_ch10,// + NULL, + NULL, + NULL, + NULL, + conjch00_ch01, + conjch01_ch00, + conjch10_ch11, + conjch11_ch10,// + NULL, + NULL, + NULL, + NULL, + af_mf_00, + af_mf_01, + af_mf_10, + af_mf_11, + nb_rb, + symbol); + } + //det_HhH = ad -bc + nr_det_HhH(af_mf_00,//a + af_mf_01,//b + af_mf_10,//c + af_mf_11,//d + determ_fin, + nb_rb, + symbol); + /* 2- Compute the channel matrix inversion ********************************** + * + * |(conj_H_00xH_00+conj_H_10xH_10) (conj_H_00xH_01+conj_H_10xH_11)| + * A= | | + * |(conj_H_01xH_00+conj_H_11xH_10) (conj_H_01xH_01+conj_H_11xH_11)| + * + * + * + *inv(A) =(1/det)*[d -b + * -c a] + * + * + **************************************************************************/ + __m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*dl_ch_mag128_0,*dl_ch_mag128b_0,*dl_ch_mag128_1,*dl_ch_mag128b_1,*determ_fin_128; + __m128i mmtmpD2,mmtmpD3,mmtmpD0,mmtmpD1,QAM_amp128,QAM_amp128b; + __m128i *after_mf_a_128,*after_mf_b_128, *after_mf_c_128, *after_mf_d_128; + + determ_fin_128 = (__m128i *)&determ_fin[0]; + + rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[0][symbol*nb_rb*12];//aatx=0 @ aarx =0 + rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[n_rx][symbol*nb_rb*12];//aatx=1 @ aarx =0 + + dl_ch_mag128_0 = (__m128i *)&dl_ch_mag[0][symbol*nb_rb*12]; + dl_ch_mag128_1 = (__m128i *)&dl_ch_mag[n_rx][symbol*nb_rb*12]; + dl_ch_mag128b_0 = (__m128i *)&dl_ch_magb[0][symbol*nb_rb*12]; + dl_ch_mag128b_1 = (__m128i *)&dl_ch_magb[n_rx][symbol*nb_rb*12]; + + after_mf_a_128 = (__m128i *)af_mf_00; + after_mf_b_128 = (__m128i *)af_mf_01; + after_mf_c_128 = (__m128i *)af_mf_10; + after_mf_d_128 = (__m128i *)af_mf_11; + + QAM_amp128b = _mm_setzero_si128(); + + if (mod_order == 4) { + QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) + QAM_amp128b = _mm_setzero_si128(); + } else if (mod_order == 6) { + QAM_amp128 = _mm_set1_epi16(QAM64_n1); // + QAM_amp128b = _mm_set1_epi16(QAM64_n2); + } + + for (int rb=0; rb<3*nb_rb; rb++) { + if (mod_order>2) { + // get channel determ (da -bc) if not QPSK + mmtmpD0 = _mm_packs_epi32(determ_fin_128[0],determ_fin_128[0]);//convert 32 bits to 16 bits + + dl_ch_mag128_0[0] = _mm_unpacklo_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag128b_0[0] = dl_ch_mag128_0[0]; + + dl_ch_mag128_0[0] = _mm_mulhi_epi16(dl_ch_mag128_0[0],QAM_amp128); + dl_ch_mag128_0[0] = _mm_slli_epi16(dl_ch_mag128_0[0],1);//aatx=0 @ aarx =0 + dl_ch_mag128_1[0] = dl_ch_mag128_0[0];//aatx=1 @ aarx =0 + + dl_ch_mag128b_0[0] = _mm_mulhi_epi16(dl_ch_mag128b_0[0],QAM_amp128b); + dl_ch_mag128b_0[0] = _mm_slli_epi16(dl_ch_mag128b_0[0],1);//aatx=0 @ aarx = + dl_ch_mag128b_1[0] = dl_ch_mag128b_0[0];//aatx=1 @ aarx =0 + + if ((rb==0)&&(symbol==1)) { + printf("\n Signal mag after ZF \n"); + print_shorts("mag layer 1:",(int16_t*)&dl_ch_mag128_0[0]); + print_shorts("mag layer 2:",(int16_t*)&dl_ch_mag128_1[0]); + print_shorts("magb layer 1:",(int16_t*)&dl_ch_mag128b_0[0]); + print_shorts("magb layer 2:",(int16_t*)&dl_ch_mag128b_1[0]); + } + } + // multiply by channel Inv + //rxdataF_zf128_0 = rxdataF_comp128_0*d - b*rxdataF_comp128_1 + //rxdataF_zf128_1 = rxdataF_comp128_1*a - c*rxdataF_comp128_0 + mmtmpD2 = nr_inv_comp_muli(rxdataF_comp128_0[0],//x + after_mf_d_128[0]);//y + mmtmpD3 = nr_inv_comp_muli(rxdataF_comp128_1[0],//x + after_mf_b_128[0]);//y + //mmtmpD2[0] - mmtmpD3[0] + //rxdataF_zf128_0 + mmtmpD0 = _mm_sub_epi16(mmtmpD2, mmtmpD3); + + mmtmpD2 = nr_inv_comp_muli(rxdataF_comp128_1[0],//x + after_mf_a_128[0]);//y + mmtmpD3 = nr_inv_comp_muli(rxdataF_comp128_0[0],//x + after_mf_c_128[0]);//y + //mmtmpD2[0] - mmtmpD3[0] + //rxdataF_zf128_1 + mmtmpD1 = _mm_sub_epi16(mmtmpD2, mmtmpD3); + + rxdataF_comp128_0[0] = mmtmpD0; + rxdataF_comp128_1[0] = mmtmpD1; + + /*if ((rb==0)&&(symbol==1)) { + printf("\n Rx signal after ZF \n"); + print_shorts("Rx layer 1:",(int16_t*)&rxdataF_comp128_0[0]); + print_shorts("Rx layer 2:",(int16_t*)&rxdataF_comp128_1[0]); + }*/ + + determ_fin_128 += 1; + dl_ch_mag128_0 += 1; + dl_ch_mag128b_0 += 1; + dl_ch_mag128_1 += 1; + dl_ch_mag128b_1 += 1; + rxdataF_comp128_0 += 1; + rxdataF_comp128_1 += 1; + after_mf_a_128 += 1; + after_mf_b_128 += 1; + after_mf_c_128 += 1; + after_mf_d_128 += 1; + } + _mm_empty(); + _m_empty(); + return(0); +} static void nr_dlsch_layer_demapping(int16_t **llr_cw, uint8_t Nl, @@ -2327,7 +2958,7 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars, RX_type_t rx_type, unsigned char harq_pid, unsigned char gNB_id, - unsigned char eNB_id_i, + unsigned char gNB_id_i, unsigned char first_symbol_flag, unsigned char symbol, unsigned short nb_rb, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 189ad53efa..df35f14869 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -308,15 +308,17 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) // every 7*(1<symbol_offset/(7*(1<ofdm_symbol_size + fp->nb_prefix_samples0)+(ue->symbol_offset-n_symb_prefix0)*(fp->ofdm_symbol_size + fp->nb_prefix_samples); - if (ue->ssb_offset < sync_pos_frame) + // for a correct computation of frame number to sync with the one decoded at MIB we need to take into account in which of the n_frames we got sync + ue->init_sync_frame = n_frames - 1 - is; + // we also need to take into account the shift by samples_per_frame in case the if is true + if (ue->ssb_offset < sync_pos_frame){ ue->rx_offset = fp->samples_per_frame - sync_pos_frame + ue->ssb_offset; + ue->init_sync_frame += 1; + } else ue->rx_offset = ue->ssb_offset - sync_pos_frame; - - ue->init_sync_frame = is; } - nr_gold_pdcch(ue,0, 2); /* int nb_prefix_samples0 = fp->nb_prefix_samples0; fp->nb_prefix_samples0 = fp->nb_prefix_samples; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index e33693ce0e..66c3de97ea 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -60,16 +60,15 @@ uint16_t nr_pbch_extract(int **rxdataF, uint8_t i,j,aarx; int32_t *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; int nushiftmod4 = frame_parms->nushift; - unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier; //and - - // if (rx_offset>= frame_parms->ofdm_symbol_size) rx_offset-=frame_parms->ofdm_symbol_size; - rx_offset=(rx_offset)%(frame_parms->ofdm_symbol_size); AssertFatal(symbol>=1 && symbol<5, "symbol %d illegal for PBCH extraction\n", symbol); for (aarx=0; aarxnb_antennas_rx; aarx++) { + unsigned int rx_offset = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier; + rx_offset = (rx_offset)%(frame_parms->ofdm_symbol_size); + rxF = &rxdataF[aarx][(symbol+s_offset)*frame_parms->ofdm_symbol_size]; rxF_ext = &rxdataF_ext[aarx][symbol*20*12]; #ifdef DEBUG_PBCH @@ -590,7 +589,9 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, frame_parms->ssb_index += (((nr_ue_pbch_vars->xtra_byte>>(7-i))&0x01)<<(3+i)); } - ue->symbol_offset = nr_get_ssb_start_symbol(frame_parms); + ue->symbol_offset = nr_get_ssb_start_symbol(frame_parms,frame_parms->ssb_index); + if (frame_parms->half_frame_bit) + ue->symbol_offset += (frame_parms->slots_per_frame>>1)*frame_parms->symbols_per_slot; uint8_t frame_number_4lsb = 0; for (int i=0; i<4; i++) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 0ba02c6bac..2c4c0b9e14 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -130,6 +130,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ #endif not_found = 1; + nr_fill_du(N_ZC,prach_root_sequence_map); preamble_index0 = preamble_index; // set preamble_offset to initial rootSequenceIndex and look if we need more root sequences for this // preamble index and find the corresponding cyclic shift diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index 91274b908a..1e7e10def7 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -686,11 +686,8 @@ void dlsch_detection_mrc_TM34(NR_DL_FRAME_PARMS *frame_parms, int32_t **dl_ch_estimates, int32_t **rxdataF_ext, int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, uint32_t *rb_alloc, uint8_t symbol, - uint8_t nr_slot_rx, NR_DL_FRAME_PARMS *frame_parms) \brief This function extracts the received resource blocks, both channel estimates and data symbols, for the current allocation and for single antenna eNB transmission. @@ -698,67 +695,61 @@ void dlsch_detection_mrc_TM34(NR_DL_FRAME_PARMS *frame_parms, @param dl_ch_estimates Channel estimates of current slot @param rxdataF_ext FFT output for RBs in this allocation @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs @param rb_alloc RB allocation vector @param symbol Symbol to extract - @param nr_slot_rx Slot number - @param high_speed_flag + @param n_dmrs_cdm_groups @param frame_parms Pointer to frame descriptor */ unsigned short nr_dlsch_extract_rbs_single(int **rxdataF, int **dl_ch_estimates, int **rxdataF_ext, int **dl_ch_estimates_ext, - unsigned short pmi, - unsigned char *pmi_ext, unsigned char symbol, uint8_t pilots, uint8_t config_type, unsigned short start_rb, - unsigned short nb_pdsch_rb, - unsigned char nr_slot_rx, - uint32_t high_speed_flag, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, NR_DL_FRAME_PARMS *frame_parms, uint16_t dlDmrsSymbPos); -/** \fn dlsch_extract_rbs_dual(int32_t **rxdataF, +/** \fn dlsch_extract_rbs_multiple(int32_t **rxdataF, int32_t **dl_ch_estimates, int32_t **rxdataF_ext, int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - NR_DL_FRAME_PARMS *frame_parms) + unsigned char symbol + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, + uint8_t Nl, + NR_DL_FRAME_PARMS *frame_parms, + uint16_t dlDmrsSymbPos) \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for dual antenna eNB transmission. + for the current allocation and for multiple layer antenna gNB transmission. @param rxdataF Raw FFT output of received signal @param dl_ch_estimates Channel estimates of current slot @param rxdataF_ext FFT output for RBs in this allocation @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs - @param rb_alloc RB allocation vector + @param Nl nb of antenna layers @param symbol Symbol to extract - @param nr_slot_rx Slot index - @param high_speed_flag + @param n_dmrs_cdm_groups @param frame_parms Pointer to frame descriptor */ -unsigned short nr_dlsch_extract_rbs_dual(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned short pmi, - unsigned char *pmi_ext, - unsigned char symbol, - uint8_t pilots, - unsigned short start_rb, - unsigned short nb_rb_pdsch, - unsigned char nr_slot_rx, - uint32_t high_speed_flag, - NR_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode); +unsigned short nr_dlsch_extract_rbs_multiple(int **rxdataF, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned char symbol, + uint8_t pilots, + uint8_t config_type, + unsigned short start_rb, + unsigned short nb_rb_pdsch, + uint8_t n_dmrs_cdm_groups, + uint8_t Nl, + NR_DL_FRAME_PARMS *frame_parms, + uint16_t dlDmrsSymbPos); /** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, int32_t **dl_bf_ch_estimates, @@ -812,8 +803,9 @@ void nr_dlsch_channel_compensation(int32_t **rxdataF_ext, int32_t **dl_ch_magb, int32_t **dl_ch_magr, int32_t **rxdataF_comp, - int32_t **rho, + int32_t ***rho, NR_DL_FRAME_PARMS *frame_parms, + uint8_t nb_aatx, uint8_t symbol, uint8_t start_symbol, uint8_t first_symbol_flag, @@ -827,7 +819,7 @@ void nr_dlsch_channel_compensation_core(int **rxdataF_ext, int **dl_ch_mag, int **dl_ch_magb, int **rxdataF_comp, - int **rho, + int ***rho, unsigned char n_tx, unsigned char n_rx, unsigned char mod_order, @@ -898,6 +890,15 @@ void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext, int length, int start_point); +void nr_dlsch_detection_mrc(int **rxdataF_comp, + int ***rho, + int **dl_ch_mag, + int **dl_ch_magb, + short n_tx, + short n_rx, + unsigned char symbol, + unsigned short nb_rb); + void nr_dlsch_detection_mrc_core(int **rxdataF_comp, int **rxdataF_comp_i, int **rho, @@ -971,6 +972,7 @@ void dlsch_channel_compensation_TM34(NR_DL_FRAME_PARMS *frame_parms, */ void nr_dlsch_channel_level(int **dl_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, + uint8_t n_tx, int32_t *avg, uint8_t symbol, uint32_t len, @@ -1002,6 +1004,8 @@ void dlsch_channel_level_TM7(int32_t **dl_bf_ch_estimates_ext, void nr_dlsch_scale_channel(int32_t **dl_ch_estimates_ext, NR_DL_FRAME_PARMS *frame_parms, + uint8_t n_tx, + uint8_t n_rx, NR_UE_DLSCH_t **dlsch_ue, uint8_t symbol, uint8_t start_symbol, diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h index aa32ecc8c9..f3cca9e33d 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h @@ -38,10 +38,10 @@ //#include "PHY/defs_nr_UE.h" #include "../NR_TRANSPORT/nr_transport_common_proto.h" -#ifndef STANDALONE_COMPILE +/*#ifndef STANDALONE_COMPILE #include "UTIL/LISTS/list.h" #endif - +*/ #include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h" diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 3d8c975a5c..60b87fae08 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -137,7 +137,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint8_t mod_order = pusch_pdu->qam_mod_order; uint16_t rnti = pusch_pdu->rnti; uint8_t cdm_grps_no_data = pusch_pdu->num_dmrs_cdm_grps_no_data; - uint16_t start_sc = frame_parms->first_carrier_offset + start_rb*NR_NB_SC_PER_RB; + uint16_t start_sc = frame_parms->first_carrier_offset + (start_rb+pusch_pdu->bwp_start)*NR_NB_SC_PER_RB; if (start_sc >= frame_parms->ofdm_symbol_size) start_sc -= frame_parms->ofdm_symbol_size; @@ -195,7 +195,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, /////////////////////////DMRS Modulation///////////////////////// /////////// uint32_t ***pusch_dmrs = UE->nr_gold_pusch_dmrs[slot]; - uint16_t n_dmrs = (start_rb+nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4); + uint16_t n_dmrs = (pusch_pdu->bwp_start + start_rb + nb_rb)*((dmrs_type == pusch_dmrs_type1) ? 6:4); int16_t mod_dmrs[n_dmrs<<1] __attribute((aligned(16))); /////////// //////////////////////////////////////////////////////////////////////// @@ -355,16 +355,17 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, if (pusch_pdu->transform_precoding == transform_precoder_disabled){ if (dmrs_type == pusch_dmrs_type1) - dmrs_idx = start_rb*6; + dmrs_idx = (pusch_pdu->bwp_start + start_rb)*6; else - dmrs_idx = start_rb*4; - - // Perform this on gold sequence, not required when SC FDMA operation is done, + dmrs_idx = (pusch_pdu->bwp_start + start_rb)*4; + + // TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part + // Perform this on gold sequence, not required when SC FDMA operation is done, nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated } else { - dmrs_idx = 0; - } + dmrs_idx = 0; + } } else if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) { diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c index 4ac1c47b02..28b6677b2c 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c @@ -213,7 +213,7 @@ void generate_pss_nr(NR_DL_FRAME_PARMS *fp,int N_ID_2) } for (int n=0; n < LENGTH_PSS_NR; n++) { - int m = (n + 43*N_ID_2)%(LENGTH_PSS_NR); + int m = (n + 43*N_ID_2)%(LENGTH_PSS_NR); d_pss[n] = 1 - 2*x[m]; } diff --git a/openair1/PHY/TOOLS/calibration_scope.c b/openair1/PHY/TOOLS/calibration_scope.c new file mode 100644 index 0000000000..da1acb5175 --- /dev/null +++ b/openair1/PHY/TOOLS/calibration_scope.c @@ -0,0 +1,387 @@ +#include +#include +#include "executables/softmodem-common.h" +#include "executables/nr-softmodem-common.h" +#include +#include + +#define TPUT_WINDOW_LENGTH 100 +#define ScaleZone 4 + +const FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; +const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED}; + +typedef struct { + int16_t r; + int16_t i; +} scopeSample_t; +#define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i) +typedef struct { + void ** samplesRx; + openair0_device *rfdevice; +} calibData_t; + +typedef struct OAIgraph { + FL_OBJECT *graph; + FL_OBJECT *text; + float maxX; + float maxY; + float minX; + float minY; + int x; + int y; + int w; + int h; + int waterFallh; + double *waterFallAvg; + boolean_t initDone; + int iteration; + void (*funct) (struct OAIgraph *graph, calibData_t *); +} OAIgraph_t; + + +/* Forms and Objects */ +typedef struct { + calibData_t * context; + FL_FORM *phy_scope; + OAIgraph_t graph[20]; + FL_OBJECT *button_0; +} OAI_phy_scope_t; + +typedef struct { + FL_FORM *stats_form; + void *vdata; + char *cdata; + long ldata; + FL_OBJECT *stats_text; + FL_OBJECT *stats_button; +} FD_stats_form; + +static void drawsymbol(FL_OBJECT *obj, int id, + FL_POINT *p, int n, int w, int h) { + fl_points( p, n, FL_YELLOW); +} + +#define WATERFALL 10000 + +static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { + if (type==WATERFALL) { + graph->waterFallh=h-15; + graph->waterFallAvg=malloc(sizeof(*graph->waterFallAvg) * graph->waterFallh); + + for (int i=0; i< graph->waterFallh; i++) + graph->waterFallAvg[i]=0; + + graph->graph=fl_add_canvas(FL_NORMAL_CANVAS, x, y, w, graph->waterFallh, label); + graph->text=fl_add_text(FL_NORMAL_TEXT, x, y+graph->waterFallh, w, 15, label); + fl_set_object_lcolor(graph->text,FL_WHITE); + fl_set_object_color(graph->text, FL_BLACK, FL_BLACK); + fl_set_object_lalign(graph->text, FL_ALIGN_CENTER ); + } else { + graph->graph=fl_add_xyplot(type, x, y, w, h, label); + fl_set_object_lcolor(graph->graph, FL_WHITE ); // Label color + fl_set_object_color(graph->graph, FL_BLACK, pointColor); + + for (int i=0; i< FL_MAX_XYPLOTOVERLAY; i++) + fl_set_xyplot_symbol(graph->graph, i, drawsymbol); + } + + graph->x=x; + graph->y=y; + graph->w=w; + graph->h=h; + graph->maxX=0; + graph->maxY=0; + graph->minX=0; + graph->minY=0; + graph->initDone=false; + graph->iteration=0; +} + +static OAIgraph_t calibrationCommonGraph( void (*funct) (OAIgraph_t *graph, calibData_t *context), + int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { + OAIgraph_t graph; + commonGraph(&graph, type, x, y, w, h, label, pointColor); + graph.funct=funct; + return graph; +} + + +static void setRange(OAIgraph_t *graph, float minX, float maxX, float minY, float maxY) { + if ( maxX > graph->maxX || minX < graph->minX || + abs(maxX-graph->maxX)>abs(graph->maxX)/2 || + abs(maxX-graph->maxX)>abs(graph->maxX)/2 ) { + graph->maxX/=2; + graph->minX/=2; + graph->maxX=max(graph->maxX,maxX); + graph->minX=min(graph->minX,minX); + fl_set_xyplot_xbounds(graph->graph, graph->minX*1.2, graph->maxX*1.2); + } + + if ( maxY > graph->maxY || minY < graph->minY || + abs(maxY-graph->maxY)>abs(graph->maxY)/2 || + abs(maxY-graph->maxY)>abs(graph->maxY)/2 ) { + graph->maxY/=2; + graph->minY/=2; + graph->maxY=max(graph->maxY,maxY); + graph->minY=min(graph->minY,minY); + fl_set_xyplot_ybounds(graph->graph, graph->minY*1.2, graph->maxY*1.2); + } +} + +static void oai_xygraph_getbuff(OAIgraph_t *graph, float **x, float **y, int len, int layer) { + float *old_x; + float *old_y; + int old_len=-1; + + if (graph->iteration >1) + fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len); + + if (old_len != len) { + LOG_W(HW,"allocating graph of %d scope\n", len); + float values[len]; + float time[len]; + + // make time in case we will use it + for (int i=0; igraph,time,values,len,"","",""); + else + fl_add_xyplot_overlay(graph->graph,layer,time,values,len,rx_antenna_colors[layer]); + + fl_get_xyplot_data_pointer(graph->graph, layer, &old_x, &old_y, &old_len); + AssertFatal(old_len==len,""); + } + + *x=old_x; + *y=old_y; +} + +static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int layer, boolean_t NoAutoScale) { + fl_redraw_object(graph->graph); + + if ( NoAutoScale && graph->iteration%NoAutoScale == 0) { + float maxX=0, maxY=0, minX=0, minY=0; + + for (int k=0; kiteration++; +} + +static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) { + if ( values == NULL ) + return; + fl_winset(FL_ObjWin(graph->graph)); + const int samplesPerPixel=datasize/graph->w; + int displayPart=graph->waterFallh-ScaleZone; + int row=graph->iteration%displayPart; + double avg=0; + + for (int i=0; i < displayPart; i++) + avg+=graph->waterFallAvg[i]; + + avg/=displayPart; + graph->waterFallAvg[row]=0; + + for (int pix=0; pixw; pix++) { + scopeSample_t *end=values+(pix+1)*samplesPerPixel; + end-=2; + AssertFatal(end <= values+datasize,"diff : %ld", end-values+datasize); + double val=0; + + for (scopeSample_t *s=values+(pix)*samplesPerPixel; + s waterFallAvg[row]+=val/graph->w; + int col=0; + + if (val > avg*2 ) + col=1; + + if (val > avg*10 ) + col=2; + + if (val > avg*100 ) + col=3; + + fl_point(pix, graph->iteration%displayPart, water_colors[col]); + } + + if (graph->initDone==false) { + for ( int i=0; i < graph->waterFallh; i++ ) + for ( int j = 0 ; j < graph->w ; j++ ) + fl_point(j, i, FL_BLACK); + + for ( int i=1; iwaterFallh; j++) + fl_point(i*(graph->w/divisions),j, FL_WHITE); + + graph->initDone=true; + } + + fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, sqrt(avg)); + graph->iteration++; +} + +static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) { + float *values, *time; + oai_xygraph_getbuff(graph, &time, &values, len, 0); + + for (int ant=0; antsamplesRx[0], + 0, 0, + "X axis:one frame in time"); +} +static void gNBfreqWaterFall (OAIgraph_t *graph, calibData_t *context) { + //use 1st antenna + genericWaterFall(graph, (scopeSample_t *)context->samplesRx[0], + 0, 0, + "X axis:one frame in time"); +} +static void timeResponse (OAIgraph_t *graph, calibData_t *context) { + #if 0 + const int len=2*phy_vars_gnb->frame_parms.ofdm_symbol_size; + float *values, *time; + oai_xygraph_getbuff(graph, &time, &values, len, 0); + const int ant=0; // display antenna 0 for each UE + + for (int ue=0; uepusch_vars[ue]->ul_ch_estimates_time[ant]; + + if (data != NULL) { + for (int i=0; iframe_parms; + int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; + + for (int ue=0; uepusch_vars[ue]->rxdataF_comp[0]; + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, sz, ue); + + if (pusch_comp) { + for (int k=0; kcontext=context; + // Define form + fdui->phy_scope = fl_bgn_form( FL_NO_BOX, 800, 800 ); + // This the whole UI box + obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 800, "" ); + fl_set_object_color( obj, FL_BLACK, FL_WHITE ); + int curY=0,x,y,w,h; + // Received signal + fdui->graph[0] = calibrationCommonGraph( gNBWaterFall, WATERFALL, 0, curY, 400, 100, + "Received Signal (Time-Domain, one frame)", FL_RED ); + + // Time-domain channel response + //fdui->graph[1] = calibrationCommonGraph( timeResponse, FL_NORMAL_XYPLOT, 410, curY, 400, 100, "SRS Frequency Response (samples, abs)", FL_RED ); + fl_get_object_bbox(fdui->graph[0].graph,&x, &y,&w, &h); + curY+=h; + // Frequency-domain channel response + fdui->graph[1] = calibrationCommonGraph( gNBfreqWaterFall, WATERFALL, 0, curY, 800, 100, + "Channel Frequency domain (RE, one frame)", FL_RED ); + fl_get_object_bbox(fdui->graph[1].graph,&x, &y,&w, &h); + curY+=h+20; + // LLR of PUSCH + //fdui->graph[3] = calibrationCommonGraph( puschLLR, FL_POINTS_XYPLOT, 0, curY, 500, 200, "PUSCH Log-Likelihood Ratios (LLR, mag)", FL_YELLOW ); + // I/Q PUSCH comp + fdui->graph[2] = calibrationCommonGraph( puschIQ, FL_POINTS_XYPLOT, 500, curY, 300, 200, + "PUSCH I/Q of MF Output", FL_YELLOW ); + fl_get_object_bbox(fdui->graph[2].graph,&x, &y,&w, &h); + curY+=h; + //fl_get_object_bbox(fdui->graph[6].graph,&x, &y,&w, &h); + curY+=h; + fdui->graph[3].graph=NULL; + fl_end_form( ); + fdui->phy_scope->fdui = fdui; + fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "LTE UL SCOPE gNB"); + return fdui; +} + +void calibrationScope(OAI_phy_scope_t *form) { + int i=0; + + while (form->graph[i].graph) { + form->graph[i].funct(form->graph+i, form->context); + i++; + } + + //fl_check_forms(); +} + +static void *scopeThread(void *arg) { + calibData_t * context = (calibData_t *)arg; + size_t stksize=0; + pthread_attr_t atr; + pthread_attr_init(&atr); + pthread_attr_getstacksize(&atr, &stksize); + pthread_attr_setstacksize(&atr,32*1024*1024 ); + sleep(3); // no clean interthread barriers + int fl_argc=1; + char *name="Calibration-scope"; + fl_initialize (&fl_argc, &name, NULL, 0, 0); + OAI_phy_scope_t *form = createScopeCalibration(context); + + while (!oai_exit) { + calibrationScope(form); + usleep(99*1000); + } + + return NULL; +} + +void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice) { + pthread_t forms_thread; + calibData_t * tmp=(calibData_t *) malloc(sizeof(*tmp)); + tmp->samplesRx=samplesRx; + tmp->rfdevice=rfdevice; + threadCreate(&forms_thread, scopeThread, (void*) tmp, "scope", -1, OAI_PRIORITY_RT_LOW); +} diff --git a/openair1/PHY/TOOLS/calibration_scope.h b/openair1/PHY/TOOLS/calibration_scope.h new file mode 100644 index 0000000000..052a1a6b6e --- /dev/null +++ b/openair1/PHY/TOOLS/calibration_scope.h @@ -0,0 +1,5 @@ +#ifndef CALIB_SCOPE_H +#define CALIB_SCOPE_H + +void CalibrationInitScope(void ** samplesRx,openair0_device *rfdevice); +#endif diff --git a/openair1/PHY/TOOLS/calibration_test.c b/openair1/PHY/TOOLS/calibration_test.c new file mode 100644 index 0000000000..982ca9d254 --- /dev/null +++ b/openair1/PHY/TOOLS/calibration_test.c @@ -0,0 +1,330 @@ +#include +#include +#include +#include +#include + + +volatile int oai_exit=false; +unsigned int mmapped_dma=0; +int single_thread_flag; +uint32_t timing_advance; +int8_t threequarter_fs; +int usrp_tx_thread; +uint64_t downlink_frequency[MAX_NUM_CCs][4]; +int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; +int opp_enabled; +static double snr_dB=20; +THREAD_STRUCT thread_struct; +#include + +int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_state) {return 0;} +void nfapi_setmode(nfapi_mode_t nfapi_mode) {} +void set_taus_seed(unsigned int seed_init){}; + +int main(int argc, char **argv) { + ///static configuration for NR at the moment + if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == NULL) { + exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); + } + set_softmodem_sighandler(); + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + logInit(); + paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC_GNB ; + + CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); + get_common_options(SOFTMODEM_GNB_BIT ); + config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); + CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); + configure_linux(); + + + int N_RB=50; + int subCarrierFreq=30e3; + int sampling_rate=30.72e6; + int DFT=2048; + int TxAdvanceInDFTSize=12; + int antennas=1; + uint64_t freq=3619.200e6; + int rxGain=90; + int txGain=90; + int filterBand=40e6; + char * usrp_addrs="type=b200"; + + openair0_config_t openair0_cfg= { + //! Module ID for this configuration + .Mod_id=0, + //! device log level + .log_level=0, + //! duplexing mode + .duplex_mode=0, + //! number of downlink resource blocks + .num_rb_dl=N_RB, + //! number of samples per frame + .samples_per_frame=0, + //! the sample rate for both transmit and receive. + .sample_rate=sampling_rate, + //device is doing mmapped DMA transfers + .mmapped_dma=0, + //! offset in samples between TX and RX paths + .tx_sample_advance=0, + //! samples per packet on the fronthaul interface + .samples_per_packet=1024, + //! number of RX channels (=RX antennas) + .rx_num_channels=antennas, + //! number of TX channels (=TX antennas) + .tx_num_channels=antennas, + //! \brief Center frequency in Hz for RX. + //! index: [0..rx_num_channels[ + .rx_freq={freq,freq,freq,freq}, + //! \brief Center frequency in Hz for TX. + //! index: [0..rx_num_channels[ !!! see lte-ue.c:427 FIXME iterates over rx_num_channels + .tx_freq={freq,freq,freq,freq}, + //! \brief memory + //! \brief Pointer to Calibration table for RX gains + .rx_gain_calib_table=NULL, + //! mode for rxgain (ExpressMIMO2) + .rxg_mode={0}, + //! \brief Gain for RX in dB. + //! index: [0..rx_num_channels] + .rx_gain={rxGain,rxGain,rxGain,rxGain}, + //! \brief Gain offset (for calibration) in dB + //! index: [0..rx_num_channels] + .rx_gain_offset={0}, + //! gain for TX in dB + .tx_gain={txGain,txGain,txGain,txGain}, + //! RX bandwidth in Hz + .rx_bw=filterBand, + //! TX bandwidth in Hz + .tx_bw=filterBand, + //! clock source + .clock_source=external,//internal gpsdo external + //! timing_source + .time_source=internal, //internal gpsdo external + //! Manual SDR IP address + //#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR) + .sdr_addrs=usrp_addrs, + //! Auto calibration flag + .autocal={0}, + //! rf devices work with x bits iqs when oai have its own iq format + //! the two following parameters are used to convert iqs + .iq_txshift=0, + .iq_rxrescale=0, + //! Configuration file for LMS7002M + .configFilename="", + //! remote IP/MAC addr for Ethernet interface + .remote_addr="", + //! remote port number for Ethernet interface + .remote_port=0, + //! local IP/MAC addr for Ethernet interface (eNB/BBU, UE) + .my_addr=0, + //! local port number for Ethernet interface (eNB/BBU, UE) + .my_port=0, + //! record player configuration, definition in record_player.h + .recplay_mode=0, + .recplay_conf=NULL, + //! number of samples per tti + .samples_per_tti=0, + //! check for threequarter sampling rate + .threequarter_fs=0, + }; + //----------------------- + openair0_device rfdevice= { + /*!tx write thread*/ + //.write_thread={0}, + /*!brief Module ID of this device */ + .Mod_id=0, + /*!brief Component Carrier ID of this device */ + .CC_id=0, + /*!brief Type of this device */ + .type=NONE_DEV, + /*!brief Transport protocol type that the device supports (in case I/Q samples need to be transported) */ + .transp_type=NONE_TP, + /*!brief Type of the device's host (RAU/RRU) */ + .host_type=MIN_HOST_TYPE, + /* !brief RF frontend parameters set by application */ + .openair0_cfg=NULL, //set by device_init + /* !brief ETH params set by application */ + .eth_params=NULL, + //! record player data, definition in record_player.h + .recplay_state=NULL, + /* !brief Indicates if device already initialized */ + .is_init=0, + /*!brief Can be used by driver to hold internal structure*/ + .priv=NULL, + /* Functions API, which are called by the application*/ + /*! \brief Called to start the transceiver. Return 0 if OK, < 0 if error + @param device pointer to the device structure specific to the RF hardware target + */ + .trx_start_func=NULL, + + /*! \brief Called to configure the device + @param device pointer to the device structure specific to the RF hardware target + */ + .trx_config_func=NULL, + + /*! \brief Called to send a request message between RAU-RRU on control port + @param device pointer to the device structure specific to the RF hardware target + @param msg pointer to the message structure passed between RAU-RRU + @param msg_len length of the message + */ + .trx_ctlsend_func=NULL, + + /*! \brief Called to receive a reply message between RAU-RRU on control port + @param device pointer to the device structure specific to the RF hardware target + @param msg pointer to the message structure passed between RAU-RRU + @param msg_len length of the message + */ + .trx_ctlrecv_func=NULL, + + /*! \brief Called to send samples to the RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at whicch the first sample MUST be sent + @param buff Buffer which holds the samples (2 dimensional) + @param nsamps number of samples to be sent + @param number of antennas + @param flags flags must be set to TRUE if timestamp parameter needs to be applied + */ + .trx_write_func=NULL, + + /*! \brief Called to send samples to the RF target + @param device pointer to the device structure specific to the RF hardware target + @param timestamp The timestamp at whicch the first sample MUST be sent + @param buff Buffer which holds the samples (1 dimensional) + @param nsamps number of samples to be sent + @param antenna_id index of the antenna if the device has multiple anteannas + @param flags flags must be set to TRUE if timestamp parameter needs to be applied + */ + .trx_write_func2=NULL, + + /*! \brief Receive samples from hardware. + * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for + * the first channel. *ptimestamp is the time at which the first sample + * was received. + * \param device the hardware to use + * \param[out] ptimestamp the time at which the first sample was received. + * \param[out] buff An array of pointers to buffers for received samples. The buffers must be large enough to hold the number of samples \ref nsamps. + * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. + * \param num_antennas number of antennas from which to receive samples + * \returns the number of sample read + */ + + .trx_read_func=NULL, + + /*! \brief Receive samples from hardware, this version provides a single antenna at a time and returns. + * Read \ref nsamps samples from each channel to buffers. buff[0] is the array for + * the first channel. *ptimestamp is the time at which the first sample + * was received. + * \param device the hardware to use + * \param[out] ptimestamp the time at which the first sample was received. + * \param[out] buff A pointers to a buffer for received samples. The buffer must be large enough to hold the number of samples \ref nsamps. + * \param nsamps Number of samples. One sample is 2 byte I + 2 byte Q => 4 byte. + * \param antenna_id Index of antenna from which samples were received + * \returns the number of sample read + */ + .trx_read_func2=NULL, + + /*! \brief print the device statistics + * \param device the hardware to use + * \returns 0 on success + */ + /*! \brief print the device statistics + * \param device the hardware to use + * \returns 0 on success + */ + .trx_get_stats_func=NULL, + + /*! \brief Reset device statistics + * \param device the hardware to use + * \returns 0 in success + */ + .trx_reset_stats_func=NULL, + + /*! \brief Terminate operation of the transceiver -- free all associated resources + * \param device the hardware to use + */ + .trx_end_func=NULL, + + /*! \brief Stop operation of the transceiver + */ + .trx_stop_func=NULL, + + /* Functions API related to UE*/ + + /*! \brief Set RX feaquencies + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \param exmimo_dump_config dump EXMIMO configuration + * \returns 0 in success + */ + .trx_set_freq_func=NULL, + + /*! \brief Set gains + * \param device the hardware to use + * \param openair0_cfg RF frontend parameters set by application + * \returns 0 in success + */ + .trx_set_gains_func=NULL, + + /*! \brief RRU Configuration callback + * \param idx RU index + * \param arg pointer to capabilities or configuration + */ + .configure_rru=NULL, + /*! \brief Pointer to generic RRU private information + */ + .thirdparty_priv=NULL, + .thirdparty_init=NULL, + /*! \brief Callback for Third-party RRU Cleanup routine + \param device the hardware configuration to use + */ + .thirdparty_cleanup=NULL, + + /*! \brief Callback for Third-party start streaming routine + \param device the hardware configuration to use + */ + .thirdparty_startstreaming=NULL, + + /*! \brief RRU Configuration callback + * \param idx RU index + * \param arg pointer to capabilities or configuration + */ + .trx_write_init=NULL, + /* \brief Get internal parameter + * \param id parameter to get + * \return a pointer to the parameter + */ + .get_internal_parameter=NULL, + }; + + openair0_device_load(&rfdevice,&openair0_cfg); + + void ** samplesRx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); + void ** samplesTx = (void **)malloc16(antennas* sizeof(struct complex16 *) ); + + for (int i=0; ilte_phy_scope_enb, FL_PLACE_HOTSPOT, FL_FULLBORDER, title); - if (otg_enabled) { + if (0) { fl_set_button(form_enb[CC_id][UE_id]->button_0,1); fl_set_object_label(form_enb[CC_id][UE_id]->button_0,"DL Traffic ON"); } else { diff --git a/openair1/PHY/TOOLS/lte_phy_scope.c b/openair1/PHY/TOOLS/lte_phy_scope.c index acd22bc78d..d28bb1b8ba 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.c +++ b/openair1/PHY/TOOLS/lte_phy_scope.c @@ -27,7 +27,6 @@ #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h" #define TPUT_WINDOW_LENGTH 100 -int otg_enabled; FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; @@ -57,11 +56,9 @@ static void ia_receiver_on_off( FL_OBJECT *button, long arg) { static void dl_traffic_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "DL Traffic ON"); - otg_enabled = 1; fl_set_object_color(button, FL_GREEN, FL_GREEN); } else { fl_set_object_label(button, "DL Traffic OFF"); - otg_enabled = 0; fl_set_object_color(button, FL_RED, FL_RED); } } @@ -131,7 +128,6 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) { fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 20, 600, 240, 40, "" ); fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER ); fl_set_button(fdui->button_0,0); - otg_enabled = 0; fl_set_object_label(fdui->button_0, "DL Traffic OFF"); fl_set_object_color(fdui->button_0, FL_RED, FL_RED); fl_set_object_callback(fdui->button_0, dl_traffic_on_off, 0 ); @@ -153,7 +149,6 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, int16_t **chest_t; int16_t **chest_f; int16_t *pusch_llr; - int32_t *pusch_comp; int32_t *pucch1_comp; int32_t *pucch1_thres; int32_t *pucch1ab_comp; @@ -184,12 +179,11 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); llr = (float *) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero bit = malloc(coded_bits_per_codeword*sizeof(float)); - - rxsig_t = (int16_t**) phy_vars_enb->RU_list[0]->common.rxdata; + rxsig_t = (int16_t **) phy_vars_enb->RU_list[0]->common.rxdata; chest_t = (int16_t **) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates; chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates; pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr; - pusch_comp = (int32_t *) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0]; + int16_t *pusch_comp= (int16_t *) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[0]; pucch1_comp = (int32_t *) phy_vars_enb->pucch1_stats[UE_id]; pucch1_thres = (int32_t *) phy_vars_enb->pucch1_stats_thres[UE_id]; pucch1ab_comp = (int32_t *) phy_vars_enb->pucch1ab_stats[UE_id]; diff --git a/openair1/PHY/TOOLS/lte_phy_scope.h b/openair1/PHY/TOOLS/lte_phy_scope.h index af9858ebad..1873fabea0 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope.h +++ b/openair1/PHY/TOOLS/lte_phy_scope.h @@ -28,6 +28,7 @@ #include "PHY/defs_eNB.h" #include "PHY/defs_UE.h" #include "PHY/impl_defs_top.h" +#include /* Forms and Objects */ diff --git a/openair1/PHY/TOOLS/lte_phy_scope_tm4.c b/openair1/PHY/TOOLS/lte_phy_scope_tm4.c index d44f8e325b..a9caf8713b 100644 --- a/openair1/PHY/TOOLS/lte_phy_scope_tm4.c +++ b/openair1/PHY/TOOLS/lte_phy_scope_tm4.c @@ -32,8 +32,7 @@ float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; float tput_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; float tput_ue_max[NUMBER_OF_UE_MAX] = {0}; -static void ia_receiver_on_off( FL_OBJECT *button, long arg) -{ +static void ia_receiver_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "IA Receiver ON"); // PHY_vars_UE_g[0][0]->use_ia_receiver = 1; @@ -45,8 +44,7 @@ static void ia_receiver_on_off( FL_OBJECT *button, long arg) } } -static void dl_traffic_on_off( FL_OBJECT *button, long arg) -{ +static void dl_traffic_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "DL Traffic ON"); otg_enabled = 1; @@ -58,9 +56,7 @@ static void dl_traffic_on_off( FL_OBJECT *button, long arg) } } -static void sic_receiver_on_off( FL_OBJECT *button, long arg) -{ - +static void sic_receiver_on_off( FL_OBJECT *button, long arg) { if (fl_get_button(button)) { fl_set_object_label(button, "SIC Receiver ON"); use_sic_receiver = 1; @@ -72,8 +68,7 @@ static void sic_receiver_on_off( FL_OBJECT *button, long arg) } } -FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) -{ +FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) { FL_OBJECT *obj; FD_lte_phy_scope_enb *fdui = fl_malloc( sizeof *fdui ); // Define form @@ -145,8 +140,7 @@ FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void ) void phy_scope_eNB(FD_lte_phy_scope_enb *form, PHY_VARS_eNB *phy_vars_enb, - int UE_id) -{ + int UE_id) { int eNB_id = 0; int i,i2,arx,atx,ind,k; LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_enb->frame_parms; @@ -176,24 +170,27 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, int coded_bits_per_codeword = 0; uint8_t harq_pid; // in TDD config 3 it is sf-2, i.e., can be 0,1,2 int mcs = 0; + // choose max MCS to compute coded_bits_per_codeword if (phy_vars_enb->ulsch[UE_id]!=NULL) { for (harq_pid=0; harq_pid<3; harq_pid++) { mcs = cmax(phy_vars_enb->ulsch[UE_id]->harq_processes[harq_pid]->mcs,mcs); } } + coded_bits_per_codeword = frame_parms->N_RB_UL*12*get_Qm(mcs)*frame_parms->symbols_per_tti; - chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); - llr = (float*) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero + chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); + llr = (float *) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero bit = malloc(coded_bits_per_codeword*sizeof(float)); - rxsig_t = (int16_t**) phy_vars_enb->common_vars.rxdata[eNB_id]; - chest_t = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; - chest_f = (int16_t**) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id]; - pusch_llr = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->llr; - pusch_comp = (int16_t*) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[eNB_id][0]; - pucch1_comp = (int32_t*) phy_vars_enb->pucch1_stats[UE_id]; - pucch1_thres = (int32_t*) phy_vars_enb->pucch1_stats_thres[UE_id]; - pucch1ab_comp = (int32_t*) phy_vars_enb->pucch1ab_stats[UE_id]; + rxsig_t = (int16_t **) phy_vars_enb->common_vars.rxdata[eNB_id]; + chest_t = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates_time[eNB_id]; + chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates[eNB_id]; + pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr; + pusch_comp = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->rxdataF_comp[eNB_id][0]; + pucch1_comp = (int32_t *) phy_vars_enb->pucch1_stats[UE_id]; + pucch1_thres = (int32_t *) phy_vars_enb->pucch1_stats_thres[UE_id]; + pucch1ab_comp = (int32_t *) phy_vars_enb->pucch1ab_stats[UE_id]; + // Received signal in time domain of receive antenna 0 if (rxsig_t != NULL) { if (rxsig_t[0] != NULL) { @@ -201,48 +198,61 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, rxsig_t_dB[0][i] = 10*log10(1.0+(float) ((rxsig_t[0][2*i])*(rxsig_t[0][2*i])+(rxsig_t[0][2*i+1])*(rxsig_t[0][2*i+1]))); time[i] = (float) i; } + fl_set_xyplot_data(form->rxsig_t,time,rxsig_t_dB[0],FRAME_LENGTH_COMPLEX_SAMPLES,"","",""); } + for (arx=1; arxrxsig_t,arx,time,rxsig_t_dB[arx],FRAME_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]); } } } + // Channel Impulse Response if (chest_t != NULL) { ymax = 0; + if (chest_t[0] !=NULL) { for (i=0; i<(frame_parms->ofdm_symbol_size); i++) { - i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size; - time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); + i2 = (i+(frame_parms->ofdm_symbol_size>>1))%frame_parms->ofdm_symbol_size; + time2[i] = (float)(i-(frame_parms->ofdm_symbol_size>>1)); chest_t_abs[0][i] = 10*log10((float) (1+chest_t[0][2*i2]*chest_t[0][2*i2]+chest_t[0][2*i2+1]*chest_t[0][2*i2+1])); + if (chest_t_abs[0][i] > ymax) ymax = chest_t_abs[0][i]; } + fl_set_xyplot_data(form->chest_t,time2,chest_t_abs[0],(frame_parms->ofdm_symbol_size),"","",""); } + for (arx=1; arxofdm_symbol_size>>3); i++) { chest_t_abs[arx][i] = 10*log10((float) (1+chest_t[arx][2*i]*chest_t[arx][2*i]+chest_t[arx][2*i+1]*chest_t[arx][2*i+1])); + if (chest_t_abs[arx][i] > ymax) ymax = chest_t_abs[arx][i]; } + fl_add_xyplot_overlay(form->chest_t,arx,time,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); fl_set_xyplot_overlay_type(form->chest_t,arx,FL_DASHED_XYPLOT); } } + // Avoid flickering effect // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); fl_set_xyplot_ybounds(form->chest_t,0,ymax); } + // Channel Frequency Response if (chest_f != NULL) { ind = 0; + for (atx=0; atxchest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,3); fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","",""); + for (arx=1; arxchest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); } + // other tx antennas if (nb_antennas_tx > 1) { if (nb_antennas_rx > 1) { @@ -279,17 +292,21 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, } } } + // PUSCH LLRs if (pusch_llr != NULL) { for (i=0; ipusch_llr,bit,llr,coded_bits_per_codeword,"","",""); } + // PUSCH I/Q of MF Output if (pusch_comp!=NULL) { ind=0; + for (k=0; ksymbols_per_tti; k++) { for (i=0; i<12*frame_parms->N_RB_UL; i++) { I[ind] = pusch_comp[(2*frame_parms->N_RB_UL*12*k)+2*i]; @@ -297,8 +314,10 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, ind++; } } + fl_set_xyplot_data(form->pusch_comp,I,Q,ind,"","",""); } + // PUSCH I/Q of MF Output if (pucch1ab_comp!=NULL) { for (ind=0; ind<10240; ind++) { @@ -308,6 +327,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, B_pucch[ind] = ind; C_pucch[ind] = (float)pucch1_thres[ind]; } + fl_set_xyplot_data(form->pucch_comp,I_pucch,Q_pucch,10240,"","",""); fl_set_xyplot_data(form->pucch_comp1,B_pucch,A_pucch,1024,"","",""); fl_add_xyplot_overlay(form->pucch_comp1,1,B_pucch,C_pucch,1024,FL_RED); @@ -315,6 +335,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, fl_set_xyplot_xbounds(form->pucch_comp,-5000,5000); fl_set_xyplot_ybounds(form->pucch_comp1,0,80); } + // PUSCH Throughput memmove( tput_time_enb[UE_id], &tput_time_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); memmove( tput_enb[UE_id], &tput_enb[UE_id][1], (TPUT_WINDOW_LENGTH-1)*sizeof(float) ); @@ -329,509 +350,564 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form, free(chest_f_abs); } -FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) -{ - FL_OBJECT *obj; - FD_lte_phy_scope_ue *fdui = fl_malloc( sizeof *fdui ); - // Define form - fdui->lte_phy_scope_ue = fl_bgn_form( FL_NO_BOX, 800, 1000 ); - // This the whole UI box - obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 1000, "" ); - fl_set_object_color( obj, FL_BLACK, FL_BLACK ); - // Received signal - fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" ); - fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color - fl_set_xyplot_ybounds(fdui->rxsig_t,30,70); - // Time-domain channel response - fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" ); - fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color - // Frequency-domain channel response - fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" ); - fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED ); - fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color - fl_set_xyplot_ybounds( fdui->chest_f,30,70); - /* - // LLR of PBCH - fdui->pbch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pbch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pbch_llr, FL_BLACK, FL_GREEN ); - fl_set_object_lcolor( fdui->pbch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pbch_llr,2); - fl_set_xyplot_xgrid( fdui->pbch_llr,FL_GRID_MAJOR); - fl_set_xyplot_xbounds( fdui->pbch_llr,0,1920); - // I/Q PBCH comp - fdui->pbch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 100, "PBCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pbch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pbch_comp, FL_BLACK, FL_GREEN ); - fl_set_object_lcolor( fdui->pbch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pbch_comp,2); - fl_set_xyplot_xbounds( fdui->pbch_comp,-100,100); - fl_set_xyplot_ybounds( fdui->pbch_comp,-100,100); - // LLR of PDCCH - fdui->pdcch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 380, 500, 100, "PDCCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pdcch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdcch_llr, FL_BLACK, FL_CYAN ); - fl_set_object_lcolor( fdui->pdcch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdcch_llr,2); - // I/Q PDCCH comp - fdui->pdcch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 380, 240, 100, "PDCCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pdcch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdcch_comp, FL_BLACK, FL_CYAN ); - fl_set_object_lcolor( fdui->pdcch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdcch_comp,2); - fl_set_xyplot_xgrid( fdui->pdcch_llr,FL_GRID_MAJOR); - */ - int offset=240; - // LLR of PDSCH - fdui->pdsch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 500-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pdsch_llr, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_llr, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_llr, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_llr,2); - fl_set_xyplot_xgrid( fdui->pdsch_llr,FL_GRID_MAJOR); - // I/Q PDSCH comp - fdui->pdsch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 500-offset, 240, 200, "PDSCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pdsch_comp, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_comp, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_comp, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_comp,2); - // LLR of PDSCH - fdui->pdsch_llr1 = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 720-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); - fl_set_object_boxtype( fdui->pdsch_llr1, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_llr1, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_llr1, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_llr1,2); - fl_set_xyplot_xgrid( fdui->pdsch_llr1,FL_GRID_MAJOR); - // I/Q PDSCH comp - fdui->pdsch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 720-offset, 240, 200, "PDSCH I/Q of MF Output" ); - fl_set_object_boxtype( fdui->pdsch_comp1, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_comp1, FL_BLACK, FL_YELLOW ); - fl_set_object_lcolor( fdui->pdsch_comp1, FL_WHITE ); // Label color - fl_set_xyplot_symbolsize( fdui->pdsch_comp1,2); - /* - // Throughput on PDSCH - fdui->pdsch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 720, 500, 100, "PDSCH Throughput [frame]/[kbit/s]" ); - fl_set_object_boxtype( fdui->pdsch_tput, FL_EMBOSSED_BOX ); - fl_set_object_color( fdui->pdsch_tput, FL_BLACK, FL_WHITE ); - fl_set_object_lcolor( fdui->pdsch_tput, FL_WHITE ); // Label color - */ - // Generic UE Button - fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 540, 720, 240, 40, "" ); - fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER ); - //use_sic_receiver = 0; - fl_set_button(fdui->button_0,0); - fl_set_object_label(fdui->button_0, "SIC Receiver OFF"); - fl_set_object_color(fdui->button_0, FL_RED, FL_RED); - fl_set_object_callback(fdui->button_0, sic_receiver_on_off, 0 ); - fl_hide_object(fdui->button_0); - - fl_end_form( ); - fdui->lte_phy_scope_ue->fdui = fdui; - return fdui; +FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) { + FL_OBJECT *obj; + FD_lte_phy_scope_ue *fdui = fl_malloc( sizeof *fdui ); + // Define form + fdui->lte_phy_scope_ue = fl_bgn_form( FL_NO_BOX, 800, 1000 ); + // This the whole UI box + obj = fl_add_box( FL_BORDER_BOX, 0, 0, 800, 1000, "" ); + fl_set_object_color( obj, FL_BLACK, FL_BLACK ); + // Received signal + fdui->rxsig_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 20, 370, 100, "Received Signal (Time-Domain, dB)" ); + fl_set_object_boxtype( fdui->rxsig_t, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->rxsig_t, FL_BLACK, FL_RED ); + fl_set_object_lcolor( fdui->rxsig_t, FL_WHITE ); // Label color + fl_set_xyplot_ybounds(fdui->rxsig_t,30,70); + // Time-domain channel response + fdui->chest_t = fl_add_xyplot( FL_NORMAL_XYPLOT, 410, 20, 370, 100, "Channel Impulse Response (samples, abs)" ); + fl_set_object_boxtype( fdui->chest_t, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->chest_t, FL_BLACK, FL_RED ); + fl_set_object_lcolor( fdui->chest_t, FL_WHITE ); // Label color + // Frequency-domain channel response + fdui->chest_f = fl_add_xyplot( FL_IMPULSE_XYPLOT, 20, 140, 760, 100, "Channel Frequency Response (RE, dB)" ); + fl_set_object_boxtype( fdui->chest_f, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->chest_f, FL_BLACK, FL_RED ); + fl_set_object_lcolor( fdui->chest_f, FL_WHITE ); // Label color + fl_set_xyplot_ybounds( fdui->chest_f,30,70); + /* + // LLR of PBCH + fdui->pbch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 260, 500, 100, "PBCH Log-Likelihood Ratios (LLR, mag)" ); + fl_set_object_boxtype( fdui->pbch_llr, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pbch_llr, FL_BLACK, FL_GREEN ); + fl_set_object_lcolor( fdui->pbch_llr, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pbch_llr,2); + fl_set_xyplot_xgrid( fdui->pbch_llr,FL_GRID_MAJOR); + fl_set_xyplot_xbounds( fdui->pbch_llr,0,1920); + // I/Q PBCH comp + fdui->pbch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 260, 240, 100, "PBCH I/Q of MF Output" ); + fl_set_object_boxtype( fdui->pbch_comp, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pbch_comp, FL_BLACK, FL_GREEN ); + fl_set_object_lcolor( fdui->pbch_comp, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pbch_comp,2); + fl_set_xyplot_xbounds( fdui->pbch_comp,-100,100); + fl_set_xyplot_ybounds( fdui->pbch_comp,-100,100); + // LLR of PDCCH + fdui->pdcch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 380, 500, 100, "PDCCH Log-Likelihood Ratios (LLR, mag)" ); + fl_set_object_boxtype( fdui->pdcch_llr, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdcch_llr, FL_BLACK, FL_CYAN ); + fl_set_object_lcolor( fdui->pdcch_llr, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdcch_llr,2); + // I/Q PDCCH comp + fdui->pdcch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 380, 240, 100, "PDCCH I/Q of MF Output" ); + fl_set_object_boxtype( fdui->pdcch_comp, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdcch_comp, FL_BLACK, FL_CYAN ); + fl_set_object_lcolor( fdui->pdcch_comp, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdcch_comp,2); + fl_set_xyplot_xgrid( fdui->pdcch_llr,FL_GRID_MAJOR); + */ + int offset=240; + // LLR of PDSCH + fdui->pdsch_llr = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 500-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); + fl_set_object_boxtype( fdui->pdsch_llr, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_llr, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_llr, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_llr,2); + fl_set_xyplot_xgrid( fdui->pdsch_llr,FL_GRID_MAJOR); + // I/Q PDSCH comp + fdui->pdsch_comp = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 500-offset, 240, 200, "PDSCH I/Q of MF Output" ); + fl_set_object_boxtype( fdui->pdsch_comp, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_comp, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_comp, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_comp,2); + // LLR of PDSCH + fdui->pdsch_llr1 = fl_add_xyplot( FL_POINTS_XYPLOT, 20, 720-offset, 500, 200, "PDSCH Log-Likelihood Ratios (LLR, mag)" ); + fl_set_object_boxtype( fdui->pdsch_llr1, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_llr1, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_llr1, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_llr1,2); + fl_set_xyplot_xgrid( fdui->pdsch_llr1,FL_GRID_MAJOR); + // I/Q PDSCH comp + fdui->pdsch_comp1 = fl_add_xyplot( FL_POINTS_XYPLOT, 540, 720-offset, 240, 200, "PDSCH I/Q of MF Output" ); + fl_set_object_boxtype( fdui->pdsch_comp1, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_comp1, FL_BLACK, FL_YELLOW ); + fl_set_object_lcolor( fdui->pdsch_comp1, FL_WHITE ); // Label color + fl_set_xyplot_symbolsize( fdui->pdsch_comp1,2); + /* + // Throughput on PDSCH + fdui->pdsch_tput = fl_add_xyplot( FL_NORMAL_XYPLOT, 20, 720, 500, 100, "PDSCH Throughput [frame]/[kbit/s]" ); + fl_set_object_boxtype( fdui->pdsch_tput, FL_EMBOSSED_BOX ); + fl_set_object_color( fdui->pdsch_tput, FL_BLACK, FL_WHITE ); + fl_set_object_lcolor( fdui->pdsch_tput, FL_WHITE ); // Label color + */ + // Generic UE Button + fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 540, 720, 240, 40, "" ); + fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER ); + //use_sic_receiver = 0; + fl_set_button(fdui->button_0,0); + fl_set_object_label(fdui->button_0, "SIC Receiver OFF"); + fl_set_object_color(fdui->button_0, FL_RED, FL_RED); + fl_set_object_callback(fdui->button_0, sic_receiver_on_off, 0 ); + fl_hide_object(fdui->button_0); + fl_end_form( ); + fdui->lte_phy_scope_ue->fdui = fdui; + return fdui; } void phy_scope_UE(FD_lte_phy_scope_ue *form, PHY_VARS_UE *phy_vars_ue, int eNB_id, int UE_id, - uint8_t subframe) -{ - int i,arx,atx,ind,k; - LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; - int nsymb_ce = frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti; - uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; - uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_eNB; - int16_t **rxsig_t; - int16_t **chest_t; - int16_t **chest_f; - int16_t *pdsch_llr,*pdsch_llr1; - int16_t *pdsch_comp,*pdsch_comp1; - int16_t *pdsch_mag0,*pdsch_mag1,*pdsch_magb0,*pdsch_magb1; - int8_t *pdcch_llr; - int16_t *pdcch_comp; - int8_t *pbch_llr; - int16_t *pbch_comp; - float Re,Im,ymax=1; - int num_pdcch_symbols=3; - float *llr0, *bit0, *llr1, *bit1, *chest_f_abs, llr_pbch[1920], bit_pbch[1920], *llr_pdcch, *bit_pdcch; - float *I, *Q; - float rxsig_t_dB[nb_antennas_rx][FRAME_LENGTH_COMPLEX_SAMPLES]; - float **chest_t_abs; - float time[FRAME_LENGTH_COMPLEX_SAMPLES]; - float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; - int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx; - uint32_t total_dlsch_bitrate = phy_vars_ue->bitrate[eNB_id]; - int coded_bits_per_codeword0=0,coded_bits_per_codeword1=1; - int mod0,mod1; - int mcs0 = 0; - int mcs1=0; - unsigned char harq_pid = 0; - int beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0; - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { - harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->current_harq_pid; - if (harq_pid>=8) - return; - mcs0 = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->mcs; - // Button 0 - /* - if(!phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->dl_power_off) { - // we are in TM5 - fl_show_object(form->button_0); - } - */ - } - fl_show_object(form->button_0); - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { - harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->current_harq_pid; - if (harq_pid>=8) - return; - mcs1 = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->mcs; - } - if (phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]!=NULL) { - num_pdcch_symbols = phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->num_pdcch_symbols; - } - // coded_bits_per_codeword = frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { - mod0 = get_Qm(mcs0); - coded_bits_per_codeword0 = get_G(frame_parms, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even, - get_Qm(mcs0), - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols, - frame, - subframe, - beamforming_mode); - } else { - coded_bits_per_codeword0 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - mod0=0; - } - if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { - mod1 = get_Qm(mcs1); - coded_bits_per_codeword1 = get_G(frame_parms, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->nb_rb, - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->rb_alloc_even, - get_Qm(mcs1), - phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->Nl, - num_pdcch_symbols, - frame, - subframe, - beamforming_mode); - } else { - coded_bits_per_codeword1 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); - mod1=0; - } - I = (float*) calloc(nsymb_ce*2,sizeof(float)); - Q = (float*) calloc(nsymb_ce*2,sizeof(float)); - chest_t_abs = (float**) malloc(nb_antennas_rx*sizeof(float*)); - for (arx=0;arxofdm_symbol_size,sizeof(float)); - } - chest_f_abs = (float*) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); - //llr0 = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. - llr0 = (float*) malloc(coded_bits_per_codeword0*sizeof(float)); - memset((void *)llr0, 0,coded_bits_per_codeword0*sizeof(float)); // init to zero - bit0 = malloc(coded_bits_per_codeword0*sizeof(float)); + uint8_t subframe) { + int i,arx,atx,ind,k; + LTE_DL_FRAME_PARMS *frame_parms = &phy_vars_ue->frame_parms; + int nsymb_ce = frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti; + uint8_t nb_antennas_rx = frame_parms->nb_antennas_rx; + uint8_t nb_antennas_tx = frame_parms->nb_antenna_ports_eNB; + int16_t **rxsig_t; + int16_t **chest_t; + int16_t **chest_f; + int16_t *pdsch_llr,*pdsch_llr1; + int16_t *pdsch_comp,*pdsch_comp1; + int16_t *pdsch_mag0,*pdsch_mag1,*pdsch_magb0,*pdsch_magb1; + int8_t *pdcch_llr; + int16_t *pdcch_comp; + int8_t *pbch_llr; + int16_t *pbch_comp; + float Re,Im,ymax=1; + int num_pdcch_symbols=3; + float *llr0, *bit0, *llr1, *bit1, *chest_f_abs, llr_pbch[1920], bit_pbch[1920], *llr_pdcch, *bit_pdcch; + float *I, *Q; + float rxsig_t_dB[nb_antennas_rx][FRAME_LENGTH_COMPLEX_SAMPLES]; + float **chest_t_abs; + float time[FRAME_LENGTH_COMPLEX_SAMPLES]; + float freq[nsymb_ce*nb_antennas_rx*nb_antennas_tx]; + int frame = phy_vars_ue->proc.proc_rxtx[0].frame_rx; + uint32_t total_dlsch_bitrate = phy_vars_ue->bitrate[eNB_id]; + int coded_bits_per_codeword0=0,coded_bits_per_codeword1=1; + int mod0,mod1; + int mcs0 = 0; + int mcs1=0; + unsigned char harq_pid = 0; + int beamforming_mode = phy_vars_ue->transmission_mode[eNB_id]>6 ? phy_vars_ue->transmission_mode[eNB_id] : 0; - //llr1 = (float*) calloc(coded_bits_per_codeword1,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. - llr1 = (float*) malloc(coded_bits_per_codeword1*sizeof(float)); - memset((void *)llr1, 0,coded_bits_per_codeword1*sizeof(float)); // init to zero - bit1 = malloc(coded_bits_per_codeword1*sizeof(float)); - llr_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero - bit_pdcch = (float*) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); - rxsig_t = (int16_t**) phy_vars_ue->common_vars.rxdata; - chest_t = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id]; - chest_f = (int16_t**) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id]; - pbch_llr = (int8_t*) phy_vars_ue->pbch_vars[eNB_id]->llr; - pbch_comp = (int16_t*) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; - pdcch_llr = (int8_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr; - pdcch_comp = (int16_t*) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp[0]; - pdsch_llr = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0]; // stream 0 - pdsch_llr1 = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[1]; // stream 1 - pdsch_comp = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0]; - //pdsch_comp = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0]; - //pdsch_comp1 = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[1]; - pdsch_comp1 = (int16_t*) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp1[0][0])[0]; - //pdsch_comp1 = (int16_t*) (phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[0][0])[0]; - pdsch_mag0 = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0]; - pdsch_mag1 = (int16_t*) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag1[0][0])[0]; - pdsch_magb0 = (int16_t*) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0]; - pdsch_magb1 = (int16_t*) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb1[0][0])[0]; - fl_freeze_form(form->lte_phy_scope_ue); - // Received signal in time domain of receive antenna 0 - if (rxsig_t != NULL) { - if (rxsig_t[0] != NULL) { - for (i=0; irxsig_t,time,rxsig_t_dB[0],FRAME_LENGTH_COMPLEX_SAMPLES,"","",""); - } - for (arx=1;arxrxsig_t,arx,time,rxsig_t_dB[arx],FRAME_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]); - } - } + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { + harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->current_harq_pid; + + if (harq_pid>=8) + return; + + mcs0 = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->mcs; + // Button 0 + /* + if(!phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[harq_pid]->dl_power_off) { + // we are in TM5 + fl_show_object(form->button_0); + } + */ + } + + fl_show_object(form->button_0); + + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { + harq_pid = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->current_harq_pid; + + if (harq_pid>=8) + return; + + mcs1 = phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->mcs; + } + + if (phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]!=NULL) { + num_pdcch_symbols = phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->num_pdcch_symbols; + } + + // coded_bits_per_codeword = frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]!=NULL) { + mod0 = get_Qm(mcs0); + coded_bits_per_codeword0 = get_G(frame_parms, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->nb_rb, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->rb_alloc_even, + get_Qm(mcs0), + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][0]->harq_processes[harq_pid]->Nl, + num_pdcch_symbols, + frame, + subframe, + beamforming_mode); + } else { + coded_bits_per_codeword0 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); + mod0=0; + } + + if (phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]!=NULL) { + mod1 = get_Qm(mcs1); + coded_bits_per_codeword1 = get_G(frame_parms, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->nb_rb, + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->rb_alloc_even, + get_Qm(mcs1), + phy_vars_ue->dlsch[phy_vars_ue->current_thread_id[subframe]][eNB_id][1]->harq_processes[harq_pid]->Nl, + num_pdcch_symbols, + frame, + subframe, + beamforming_mode); + } else { + coded_bits_per_codeword1 = 0; //frame_parms->N_RB_DL*12*get_Qm(mcs)*(frame_parms->symbols_per_tti); + mod1=0; + } + + I = (float *) calloc(nsymb_ce*2,sizeof(float)); + Q = (float *) calloc(nsymb_ce*2,sizeof(float)); + chest_t_abs = (float **) malloc(nb_antennas_rx*sizeof(float *)); + + for (arx=0; arxofdm_symbol_size,sizeof(float)); + } + + chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float)); + //llr0 = (float*) calloc(coded_bits_per_codeword0,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. + llr0 = (float *) malloc(coded_bits_per_codeword0*sizeof(float)); + memset((void *)llr0, 0,coded_bits_per_codeword0*sizeof(float)); // init to zero + bit0 = malloc(coded_bits_per_codeword0*sizeof(float)); + //llr1 = (float*) calloc(coded_bits_per_codeword1,sizeof(float)); // Cppcheck returns "invalidFunctionArg" error. + llr1 = (float *) malloc(coded_bits_per_codeword1*sizeof(float)); + memset((void *)llr1, 0,coded_bits_per_codeword1*sizeof(float)); // init to zero + bit1 = malloc(coded_bits_per_codeword1*sizeof(float)); + llr_pdcch = (float *) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); // init to zero + bit_pdcch = (float *) calloc(12*frame_parms->N_RB_DL*num_pdcch_symbols*2,sizeof(float)); + rxsig_t = (int16_t **) phy_vars_ue->common_vars.rxdata; + chest_t = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates_time[eNB_id]; + chest_f = (int16_t **) phy_vars_ue->common_vars.common_vars_rx_data_per_thread[phy_vars_ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id]; + pbch_llr = (int8_t *) phy_vars_ue->pbch_vars[eNB_id]->llr; + pbch_comp = (int16_t *) phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]; + pdcch_llr = (int8_t *) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr; + pdcch_comp = (int16_t *) phy_vars_ue->pdcch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp[0]; + pdsch_llr = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[0]; // stream 0 + pdsch_llr1 = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->llr[1]; // stream 1 + pdsch_comp = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0]; + //pdsch_comp = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0]; + //pdsch_comp1 = (int16_t*) phy_vars_ue->lte_ue_pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[1]; + pdsch_comp1 = (int16_t *) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp1[0][0])[0]; + //pdsch_comp1 = (int16_t*) (phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_ch_rho_ext[0][0])[0]; + pdsch_mag0 = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0]; + pdsch_mag1 = (int16_t *) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag1[0][0])[0]; + pdsch_magb0 = (int16_t *) phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0]; + pdsch_magb1 = (int16_t *) (phy_vars_ue->pdsch_vars[phy_vars_ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb1[0][0])[0]; + fl_freeze_form(form->lte_phy_scope_ue); + + // Received signal in time domain of receive antenna 0 + if (rxsig_t != NULL) { + if (rxsig_t[0] != NULL) { + for (i=0; irxsig_t,time,rxsig_t_dB[0],FRAME_LENGTH_COMPLEX_SAMPLES,"","",""); } + + for (arx=1; arxrxsig_t,arx,time,rxsig_t_dB[arx],FRAME_LENGTH_COMPLEX_SAMPLES,rx_antenna_colors[arx]); + } + } + } + // Channel Impulse Response (still repeated format) if (chest_t != NULL) { ymax = 0; + if (chest_t[0] !=NULL) { for (i=0; i<(frame_parms->ofdm_symbol_size>>3); i++) { chest_t_abs[0][i] = (float) (chest_t[0][4*i]*chest_t[0][4*i]+chest_t[0][4*i+1]*chest_t[0][4*i+1]); + if (chest_t_abs[0][i] > ymax) ymax = chest_t_abs[0][i]; } + fl_set_xyplot_data(form->chest_t,time,chest_t_abs[0],(frame_parms->ofdm_symbol_size>>3),"","",""); } + for (arx=1; arxofdm_symbol_size>>3); i++) { chest_t_abs[arx][i] = (float) (chest_t[arx][4*i]*chest_t[arx][4*i]+chest_t[arx][4*i+1]*chest_t[arx][4*i+1]); + if (chest_t_abs[arx][i] > ymax) ymax = chest_t_abs[arx][i]; } + fl_add_xyplot_overlay(form->chest_t,arx,time,chest_t_abs[arx],(frame_parms->ofdm_symbol_size>>3),rx_antenna_colors[arx]); fl_set_xyplot_overlay_type(form->chest_t,arx,FL_DASHED_XYPLOT); } } - // Avoid flickering effect - // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); - fl_set_xyplot_ybounds(form->chest_t,0,ymax); + + // Avoid flickering effect + // fl_get_xyplot_ybounds(form->chest_t,&ymin,&ymax); + fl_set_xyplot_ybounds(form->chest_t,0,ymax); + } + + // Channel Frequency Response (includes 5 complex sample for filter) + if (chest_f != NULL) { + ind = 0; + + for (atx=0; atxchest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); - //fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2); - // fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2); - fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); - fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","",""); - for (arx=1;arxchest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - // other tx antennas - if (nb_antennas_tx > 1) { - if (nb_antennas_rx > 1) { - for (atx=1;atxchest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } - } else { // 1 rx antenna - atx=1; arx=0; - fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); - } - } + + // tx antenna 0 + fl_set_xyplot_xbounds(form->chest_f,0,nb_antennas_rx*nb_antennas_tx*nsymb_ce); + //fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*frame_parms->symbols_per_tti,2); + // fl_set_xyplot_xtics(form->chest_f,nb_antennas_rx*nb_antennas_tx*2,2); + fl_set_xyplot_xgrid(form->chest_f,FL_GRID_MAJOR); + fl_set_xyplot_data(form->chest_f,freq,chest_f_abs,nsymb_ce,"","",""); + + for (arx=1; arxchest_f,1,&freq[arx*nsymb_ce],&chest_f_abs[arx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); } - /* - // PBCH LLRs - if (pbch_llr != NULL) { - for (i=0; i<1920;i++) { - llr_pbch[i] = (float) pbch_llr[i]; - bit_pbch[i] = (float) i; + + // other tx antennas + if (nb_antennas_tx > 1) { + if (nb_antennas_rx > 1) { + for (atx=1; atxchest_f,(atx<<1)+arx,&freq[((atx<<1)+arx)*nsymb_ce],&chest_f_abs[((atx<<1)+arx)*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); + } } - fl_set_xyplot_data(form->pbch_llr,bit_pbch,llr_pbch,1920,"","",""); + } else { // 1 rx antenna + atx=1; + arx=0; + fl_add_xyplot_overlay(form->chest_f,atx,&freq[atx*nsymb_ce],&chest_f_abs[atx*nsymb_ce],nsymb_ce,rx_antenna_colors[arx]); + } } - // PBCH I/Q of MF Output - if (pbch_comp!=NULL) { - for (i=0; i<72*2; i++) { - I[i] = pbch_comp[2*i]; - Q[i] = pbch_comp[2*i+1]; - } - fl_set_xyplot_data(form->pbch_comp,I,Q,72*2,"","",""); - } - // PDCCH LLRs - if (pdcch_llr != NULL) { - for (i=0; i<12*frame_parms->N_RB_DL*2*num_pdcch_symbols;i++) { - llr_pdcch[i] = (float) pdcch_llr[i]; - bit_pdcch[i] = (float) i; - } - fl_set_xyplot_xbounds(form->pdcch_llr,0,12*frame_parms->N_RB_DL*2*3); - fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","",""); - } - // PDCCH I/Q of MF Output - if (pdcch_comp!=NULL) { - for (i=0; i<12*frame_parms->N_RB_DL*num_pdcch_symbols; i++) { - I[i] = pdcch_comp[2*i]; - Q[i] = pdcch_comp[2*i+1]; - } - fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); - } - */ - // PDSCH LLRs CW0 - if (pdsch_llr != NULL) { - for (i=0; ipdsch_llr,0,coded_bits_per_codeword0); - fl_set_xyplot_data(form->pdsch_llr,bit0,llr0,coded_bits_per_codeword0,"","",""); + } + + /* + // PBCH LLRs + if (pbch_llr != NULL) { + for (i=0; i<1920;i++) { + llr_pbch[i] = (float) pbch_llr[i]; + bit_pbch[i] = (float) i; + } + fl_set_xyplot_data(form->pbch_llr,bit_pbch,llr_pbch,1920,"","",""); + } + // PBCH I/Q of MF Output + if (pbch_comp!=NULL) { + for (i=0; i<72*2; i++) { + I[i] = pbch_comp[2*i]; + Q[i] = pbch_comp[2*i+1]; + } + fl_set_xyplot_data(form->pbch_comp,I,Q,72*2,"","",""); + } + // PDCCH LLRs + if (pdcch_llr != NULL) { + for (i=0; i<12*frame_parms->N_RB_DL*2*num_pdcch_symbols;i++) { + llr_pdcch[i] = (float) pdcch_llr[i]; + bit_pdcch[i] = (float) i; + } + fl_set_xyplot_xbounds(form->pdcch_llr,0,12*frame_parms->N_RB_DL*2*3); + fl_set_xyplot_data(form->pdcch_llr,bit_pdcch,llr_pdcch,12*frame_parms->N_RB_DL*2*num_pdcch_symbols,"","",""); + } + // PDCCH I/Q of MF Output + if (pdcch_comp!=NULL) { + for (i=0; i<12*frame_parms->N_RB_DL*num_pdcch_symbols; i++) { + I[i] = pdcch_comp[2*i]; + Q[i] = pdcch_comp[2*i+1]; + } + fl_set_xyplot_data(form->pdcch_comp,I,Q,12*frame_parms->N_RB_DL*num_pdcch_symbols,"","",""); + } + */ + // PDSCH LLRs CW0 + if (pdsch_llr != NULL) { + for (i=0; ipdsch_llr,0,coded_bits_per_codeword0); + fl_set_xyplot_data(form->pdsch_llr,bit0,llr0,coded_bits_per_codeword0,"","",""); + } + // PDSCH I/Q of MF Output - if (pdsch_comp!=NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { - I[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i]; - Q[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; - ind++; - } - } - fl_set_xyplot_data(form->pdsch_comp,I,Q,ind,"","",""); + if (pdsch_comp!=NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + I[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i]; + Q[ind] = pdsch_comp[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; + ind++; + } } - if (pdsch_mag0 != NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_set_xyplot_data(form->pdsch_comp,I,Q,ind,"","",""); + } + + if (pdsch_mag0 != NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp,1,I,Q,ind,FL_GREEN); + } } - if (pdsch_magb0 != NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp,1,I,Q,ind,FL_GREEN); + } + + if (pdsch_magb0 != NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp,2,I,Q,ind,FL_RED); + } } - if ((pdsch_mag0 != NULL) && (pdsch_magb0 != NULL)) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp,2,I,Q,ind,FL_RED); + } + + if ((pdsch_mag0 != NULL) && (pdsch_magb0 != NULL)) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = - (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i]+ - pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i])* - cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i]+ + pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i])* + cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = - (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ - pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* - sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag0[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ + pdsch_magb0[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* + sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp,3,I,Q,ind,FL_BLUE); + } } - // PDSCH LLRs CW1 - if (pdsch_llr1 != NULL) { - for (i=0; ipdsch_llr1,0,coded_bits_per_codeword1); - fl_set_xyplot_data(form->pdsch_llr1,bit1,llr1,coded_bits_per_codeword1,"","",""); + + fl_add_xyplot_overlay(form->pdsch_comp,3,I,Q,ind,FL_BLUE); + } + + // PDSCH LLRs CW1 + if (pdsch_llr1 != NULL) { + for (i=0; isymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { - I[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i]; - Q[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; - ind++; - } - } - fl_set_xyplot_data(form->pdsch_comp1,I,Q,ind,"","",""); + + fl_set_xyplot_xbounds(form->pdsch_llr1,0,coded_bits_per_codeword1); + fl_set_xyplot_data(form->pdsch_llr1,bit1,llr1,coded_bits_per_codeword1,"","",""); + } + + // PDSCH I/Q of MF Output + if (pdsch_comp1!=NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + I[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i]; + Q[ind] = pdsch_comp1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]; + ind++; + } } - if (pdsch_mag1 != NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_set_xyplot_data(form->pdsch_comp1,I,Q,ind,"","",""); + } + + if (pdsch_mag1 != NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp1,1,I,Q,ind,FL_GREEN); + } } - if (pdsch_magb1 != NULL) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp1,1,I,Q,ind,FL_GREEN); + } + + if (pdsch_magb1 != NULL) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i]*cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]*sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp1,2,I,Q,ind,FL_RED); + } } - if ((pdsch_mag1 != NULL) && (pdsch_magb1 != NULL)) { - ind=0; - for (k=0; ksymbols_per_tti; k++) { - for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { + + fl_add_xyplot_overlay(form->pdsch_comp1,2,I,Q,ind,FL_RED); + } + + if ((pdsch_mag1 != NULL) && (pdsch_magb1 != NULL)) { + ind=0; + + for (k=0; ksymbols_per_tti; k++) { + for (i=0; i<12*frame_parms->N_RB_DL/2; i++) { I[ind] = - (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i]+ - pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i])* - cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i]+ + pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i])* + cos(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); Q[ind] = - (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ - pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* - sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); + (pdsch_mag1[(2*frame_parms->N_RB_DL*12*k)+4*i+1]+ + pdsch_magb1[(2*frame_parms->N_RB_DL*12*k)+4*i+1])* + sin(i*2*M_PI/(12*frame_parms->N_RB_DL/2)); ind++; - } - } - fl_add_xyplot_overlay(form->pdsch_comp1,3,I,Q,ind,FL_BLUE); + } } - /* - // PDSCH Throughput - memcpy((void*)tput_time_ue[UE_id],(void*)&tput_time_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); - memcpy((void*)tput_ue[UE_id],(void*)&tput_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); - tput_time_ue[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame; - tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0; - if (tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] > tput_ue_max[UE_id]) { - tput_ue_max[UE_id] = tput_ue[UE_id][TPUT_WINDOW_LENGTH-1]; - } - fl_set_xyplot_data(form->pdsch_tput,tput_time_ue[UE_id],tput_ue[UE_id],TPUT_WINDOW_LENGTH,"","",""); - fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]); - */ - fl_unfreeze_form(form->lte_phy_scope_ue); - fl_check_forms(); - free(I); - free(Q); - free(chest_f_abs); - free(llr0); - free(bit0); - free(llr1); - free(bit1); - free(bit_pdcch); - free(llr_pdcch); - //This is done to avoid plotting old data when TB0 is disabled, and TB1 is mapped onto CW0 - /*if (phy_vars_ue->transmission_mode[eNB_id]==3 && phy_vars_ue->transmission_mode[eNB_id]==4){ - for (int i = 0; i<8; ++i) - for (int j = 0; j < 7*2*frame_parms->N_RB_DL*12+4; ++j ) - phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[0][0][i][j]=0; + fl_add_xyplot_overlay(form->pdsch_comp1,3,I,Q,ind,FL_BLUE); + } - for (int m=0; mpdsch_vars[subframe&0x1][eNB_id]->llr[0][m]=0; - }*/ + /* + // PDSCH Throughput + memcpy((void*)tput_time_ue[UE_id],(void*)&tput_time_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); + memcpy((void*)tput_ue[UE_id],(void*)&tput_ue[UE_id][1],(TPUT_WINDOW_LENGTH-1)*sizeof(float)); + tput_time_ue[UE_id][TPUT_WINDOW_LENGTH-1] = (float) frame; + tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] = ((float) total_dlsch_bitrate)/1000.0; + if (tput_ue[UE_id][TPUT_WINDOW_LENGTH-1] > tput_ue_max[UE_id]) { + tput_ue_max[UE_id] = tput_ue[UE_id][TPUT_WINDOW_LENGTH-1]; + } + fl_set_xyplot_data(form->pdsch_tput,tput_time_ue[UE_id],tput_ue[UE_id],TPUT_WINDOW_LENGTH,"","",""); + fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]); + */ + fl_unfreeze_form(form->lte_phy_scope_ue); + fl_check_forms(); + free(I); + free(Q); + free(chest_f_abs); + free(llr0); + free(bit0); + free(llr1); + free(bit1); + free(bit_pdcch); + free(llr_pdcch); + //This is done to avoid plotting old data when TB0 is disabled, and TB1 is mapped onto CW0 + /*if (phy_vars_ue->transmission_mode[eNB_id]==3 && phy_vars_ue->transmission_mode[eNB_id]==4){ + for (int i = 0; i<8; ++i) + for (int j = 0; j < 7*2*frame_parms->N_RB_DL*12+4; ++j ) + phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[0][0][i][j]=0; + + for (int m=0; mpdsch_vars[subframe&0x1][eNB_id]->llr[0][m]=0; + }*/ } diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index b45c1abf0b..c840149507 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -38,10 +38,7 @@ int otg_enabled; const FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW}; const FL_COLOR water_colors[4] = {FL_BLUE,FL_GREEN,FL_YELLOW,FL_RED}; -typedef struct { - int16_t r; - int16_t i; -} scopeSample_t; +typedef struct complex16 scopeSample_t; #define SquaredNorm(VaR) ((VaR).r*(VaR).r+(VaR).i*(VaR).i) typedef struct OAIgraph { @@ -59,7 +56,7 @@ typedef struct OAIgraph { double *waterFallAvg; boolean_t initDone; int iteration; - void (*gNBfunct) (struct OAIgraph *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id); + void (*gNBfunct) (struct OAIgraph *graph, scopeData_t *p, int UE_id); void (*nrUEfunct)(struct OAIgraph *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id); } OAIgraph_t; @@ -135,7 +132,7 @@ static void commonGraph(OAIgraph_t *graph, int type, FL_Coord x, FL_Coord y, FL_ graph->iteration=0; } -static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int UE_id), +static OAIgraph_t gNBcommonGraph( void (*funct) (OAIgraph_t *graph, scopeData_t *p, int UE_id), int type, FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h, const char *label, FL_COLOR pointColor) { OAIgraph_t graph; commonGraph(&graph, type, x, y, w, h, label, pointColor); @@ -226,7 +223,8 @@ static void oai_xygraph(OAIgraph_t *graph, float *x, float *y, int len, int laye static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const int datasize, const int divisions, const char *label) { if ( values == NULL ) - return; + return; + fl_winset(FL_ObjWin(graph->graph)); const int samplesPerPixel=datasize/graph->w; int displayPart=graph->waterFallh-ScaleZone; @@ -278,7 +276,7 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in graph->initDone=true; } - fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, sqrt(avg)); + fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, 0/*sqrt(avg)*/); graph->iteration++; } @@ -297,10 +295,10 @@ static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const sc } } -static void gNBWaterFall (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { - NR_DL_FRAME_PARMS *frame_parms=&phy_vars_gnb->frame_parms; +static void gNBWaterFall (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; //use 1st antenna - genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdata[0], + genericWaterFall(graph, (scopeSample_t *)p->ru->common.rxdata[0], frame_parms->samples_per_frame, frame_parms->slots_per_frame, "X axis:one frame in time"); } @@ -318,31 +316,35 @@ static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy } */ -static void timeResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { - const int len=2*phy_vars_gnb->frame_parms.ofdm_symbol_size; +static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + const int len=2*p->gNB->frame_parms.ofdm_symbol_size; float *values, *time; oai_xygraph_getbuff(graph, &time, &values, len, 0); const int ant=0; // display antenna 0 for each UE for (int ue=0; uepusch_vars[ue]->ul_ch_estimates_time[ant]; + if ( p->gNB->pusch_vars && p->gNB->pusch_vars[ue] && + p->gNB->pusch_vars[ue]->ul_ch_estimates_time && + p->gNB->pusch_vars[ue]->ul_ch_estimates_time[ant] ) { + scopeSample_t *data= (scopeSample_t *)p->gNB->pusch_vars[ue]->ul_ch_estimates_time[ant]; - if (data != NULL) { - for (int i=0; iframe_parms; +static void gNBfreqWaterFall (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; //use 1st antenna - genericWaterFall(graph, (scopeSample_t *)phy_vars_ru->common.rxdataF[0], frame_parms->samples_per_frame_wCP, + genericWaterFall(graph, (scopeSample_t *)p->rxdataF, frame_parms->samples_per_frame_wCP, frame_parms->slots_per_frame, - "X axis: Frequency domain, one frame"); + "X axis: Frequency domain, one subframe"); } /* @@ -354,16 +356,18 @@ static void frequencyResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU } */ -static void puschLLR (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void puschLLR (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { //int Qm = 2; int coded_bits_per_codeword =3*8*6144+12; // (8*((3*8*6144)+12)); // frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti; for (int ue=0; uepusch_vars[ue]->llr; - float *llr, *bit; - oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword, ue); + if ( p->gNB->pusch_vars && + p->gNB->pusch_vars[ue] && + p->gNB->pusch_vars[ue]->llr ) { + int16_t *pusch_llr = (int16_t *)p->gNB->pusch_vars[ue]->llr; + float *llr, *bit; + oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword, ue); - if (pusch_llr) { for (int i=0; iframe_parms; +static void puschIQ (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; int sz=frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; for (int ue=0; uepusch_vars[ue]->rxdataF_comp[0]; - float *I, *Q; - oai_xygraph_getbuff(graph, &I, &Q, sz, ue); + if ( p->gNB->pusch_vars && + p->gNB->pusch_vars[ue] && + p->gNB->pusch_vars[ue]->rxdataF_comp && + p->gNB->pusch_vars[ue]->rxdataF_comp[0] ) { + scopeSample_t *pusch_comp = (scopeSample_t *) p->gNB->pusch_vars[ue]->rxdataF_comp[0]; + float *I, *Q; + oai_xygraph_getbuff(graph, &I, &Q, sz, ue); - if (pusch_comp) { for (int k=0; kpucch1ab_stats[UE_id]; @@ -419,10 +426,10 @@ static void pucchEnergy (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *ph */ } -static void pucchIQ (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void pucchIQ (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { } -static void puschThroughtput (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy_vars_ru, int nb_UEs) { +static void puschThroughtput (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { // PUSCH Throughput /* float tput_time_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; @@ -437,7 +444,6 @@ static void puschThroughtput (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_ // fl_set_xyplot_ybounds(form->pusch_tput,0,ymax); */ } - static OAI_phy_scope_t *create_phy_scope_gnb(void) { FL_OBJECT *obj; OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); @@ -486,11 +492,9 @@ static OAI_phy_scope_t *create_phy_scope_gnb(void) { fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, "LTE UL SCOPE gNB"); return fdui; } - static const int scope_enb_num_ue = 1; void phy_scope_gNB(OAI_phy_scope_t *form, - PHY_VARS_gNB *phy_vars_gnb, - RU_t *phy_vars_ru, + scopeData_t *p, int UE_id) { static OAI_phy_scope_t *rememberForm=NULL; @@ -505,15 +509,14 @@ void phy_scope_gNB(OAI_phy_scope_t *form, int i=0; while (form->graph[i].graph) { - form->graph[i].gNBfunct(form->graph+i, phy_vars_gnb, phy_vars_ru, UE_id); + form->graph[i].gNBfunct(form->graph+i, p, UE_id); i++; } //fl_check_forms(); } - static void *scope_thread_gNB(void *arg) { - scopeParms_t *p=(scopeParms_t *) arg; + scopeData_t *p=(scopeData_t *) arg; //# ifdef ENABLE_XFORMS_WRITE_STATS // FILE *gNB_stats = fopen("gNB_stats.txt", "w"); //#endif @@ -530,20 +533,31 @@ static void *scope_thread_gNB(void *arg) { OAI_phy_scope_t *form_gnb = create_phy_scope_gnb(); while (!oai_exit) { - phy_scope_gNB(form_gnb, p->gNB, p->ru, nb_ue); + phy_scope_gNB(form_gnb, p, nb_ue); usleep(99*1000); } return NULL; } - -void gNBinitScope(scopeParms_t *p) { - static scopeParms_t parms; - memcpy(&parms,p,sizeof(parms)); - pthread_t forms_thread; - threadCreate(&forms_thread, scope_thread_gNB, &parms, "scope", -1, OAI_PRIORITY_RT_LOW); +static void copyRxdataF(int32_t *data, int slot, void *scopeData) { + scopeData_t *scope=(scopeData_t *)scopeData; + memcpy(scope->rxdataF + slot*scope->gNB->frame_parms.samples_per_slot_wCP, + data, + scope->gNB->frame_parms.samples_per_slot_wCP); } +void gNBinitScope(scopeParms_t *p) { + AssertFatal(p->gNB->scopeData=malloc(sizeof(scopeData_t)),""); + scopeData_t *scope=(scopeData_t *) p->gNB->scopeData; + scope->argc=p->argc; + scope->argv=p->argv; + scope->ru=p->ru; + scope->gNB=p->gNB; + scope->slotFunc=copyRxdataF; + AssertFatal(scope->rxdataF=(int32_t *) calloc(p->gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t),1),""); + pthread_t forms_thread; + threadCreate(&forms_thread, scope_thread_gNB, p->gNB->scopeData, "scope", -1, OAI_PRIORITY_RT_LOW); +} static void ueWaterFall (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Received signal in time domain of receive antenna 0 genericWaterFall(graph, @@ -552,7 +566,6 @@ static void ueWaterFall (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eN phy_vars_ue->frame_parms.slots_per_frame, "X axis: one frame time"); } - /* replaced by waterfall static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Received signal in time domain of receive antenna 0 @@ -561,14 +574,12 @@ static void ueTimeResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int phy_vars_ue->frame_parms.samples_per_frame); } */ - static void ueChannelResponse (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Channel Impulse Response genericPowerPerAntena(graph, phy_vars_ue->frame_parms.nb_antennas_rx, (const scopeSample_t **) phy_vars_ue->pbch_vars[eNB_id]->dl_ch_estimates_time, phy_vars_ue->frame_parms.ofdm_symbol_size>>3); } - static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id ) { NR_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->frame_parms; //use 1st antenna @@ -578,7 +589,6 @@ static void ueFreqWaterFall (OAIgraph_t *graph,PHY_VARS_NR_UE *phy_vars_ue, int phy_vars_ue->frame_parms.slots_per_frame, "X axis: one frame frequency" ); } - /* static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // Channel Frequency Response (includes 5 complex sample for filter) @@ -614,7 +624,6 @@ static void uePbchFrequencyResp (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue oai_xygraph(graph,freq,chest_f_abs,frame_parms->ofdm_symbol_size,0,10); } */ - static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PBCH LLRs if ( !phy_vars_ue->pbch_vars[eNB_id]->llr) @@ -630,7 +639,6 @@ static void uePbchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ oai_xygraph(graph,bit_pbch,llr_pbch,864,0,10); } - static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PBCH I/Q of MF Output if (!phy_vars_ue->pbch_vars[eNB_id]->rxdataF_comp[0]) @@ -665,15 +673,14 @@ static void uePbchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i AssertFatal(base <= 180*3,""); oai_xygraph(graph,I,Q,base,0, 10); } - static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDCCH LLRs if (!phy_vars_ue->pdcch_vars[0][eNB_id]->llr) return; - int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols - int Qm = 2; - int coded_bits_per_codeword = num_re*Qm; + //int num_re = 4*273*12; // 12*frame_parms->N_RB_DL*num_pdcch_symbols + //int Qm = 2; + int coded_bits_per_codeword = 2*4*100*12; //num_re*Qm; float *llr, *bit; oai_xygraph_getbuff(graph, &bit, &llr, coded_bits_per_codeword*RX_NB_TH_MAX, 0); int base=0; @@ -691,7 +698,6 @@ static void uePcchLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ AssertFatal(base <= coded_bits_per_codeword*RX_NB_TH_MAX, ""); oai_xygraph(graph,bit,llr,base,0,10); } - static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDCCH I/Q of MF Output if (!phy_vars_ue->pdcch_vars[0][eNB_id]->rxdataF_comp[0]) @@ -716,7 +722,6 @@ static void uePcchIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_i AssertFatal(base <= nb*RX_NB_TH_MAX, ""); oai_xygraph(graph,I,Q,base,0,10); } - static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDSCH LLRs if (!phy_vars_ue->pdsch_vars[0][eNB_id]->llr[0]) @@ -744,7 +749,6 @@ static void uePdschLLR (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB //fl_set_xyplot_xbounds(form->pdsch_llr,0,coded_bits_per_codeword); oai_xygraph(graph,bit,llr,base,0,10); } - static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { // PDSCH I/Q of MF Output if (!phy_vars_ue->pdsch_vars[0][eNB_id]->rxdataF_comp0[0]) @@ -772,7 +776,6 @@ static void uePdschIQ (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_ AssertFatal(base <= sz*RX_NB_TH_MAX, ""); oai_xygraph(graph,I,Q,sz*RX_NB_TH_MAX,0,10); } - static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, int UE_id) { /* float tput_time_ue[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}}; @@ -796,7 +799,6 @@ static void uePdschThroughput (OAIgraph_t *graph, PHY_VARS_NR_UE *phy_vars_ue, fl_set_xyplot_ybounds(form->pdsch_tput,0,tput_ue_max[UE_id]); */ } - static OAI_phy_scope_t *create_phy_scope_nrue( int ID ) { FL_OBJECT *obj; OAI_phy_scope_t *fdui = calloc(( sizeof *fdui ),1); @@ -866,7 +868,6 @@ static OAI_phy_scope_t *create_phy_scope_nrue( int ID ) { fl_show_form (fdui->phy_scope, FL_PLACE_HOTSPOT, FL_FULLBORDER, buf); return fdui; } - void phy_scope_nrUE(OAI_phy_scope_t *form, PHY_VARS_NR_UE *phy_vars_ue, int eNB_id, @@ -890,8 +891,6 @@ void phy_scope_nrUE(OAI_phy_scope_t *form, //fl_check_forms(); } - - static void *nrUEscopeThread(void *arg) { PHY_VARS_NR_UE *ue=(PHY_VARS_NR_UE *)arg; size_t stksize; @@ -915,13 +914,10 @@ static void *nrUEscopeThread(void *arg) { pthread_exit((void *)arg); } - void nrUEinitScope(PHY_VARS_NR_UE *ue) { pthread_t forms_thread; threadCreate(&forms_thread, nrUEscopeThread, ue, "scope", -1, OAI_PRIORITY_RT_LOW); } - - void nrscope_autoinit(void *dataptr) { AssertFatal( (IS_SOFTMODEM_GNB_BIT||IS_SOFTMODEM_5GUE_BIT),"Scope cannot find NRUE or GNB context"); @@ -956,7 +952,6 @@ static void reset_stats_gNB(FL_OBJECT *button, } } } - static FD_stats_form *create_form_stats_form(int ID) { FL_OBJECT *obj; FD_stats_form *fdui = calloc(( sizeof *fdui ),1); diff --git a/openair1/PHY/TOOLS/nr_phy_scope.h b/openair1/PHY/TOOLS/nr_phy_scope.h index 84b9e66908..e34ddf2c20 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.h +++ b/openair1/PHY/TOOLS/nr_phy_scope.h @@ -33,13 +33,7 @@ //#include "PHY/impl_defs_top.h" #include "PHY/defs_nr_UE.h" -typedef struct { - int *argc; - char **argv; - RU_t *ru; - PHY_VARS_gNB *gNB; -} scopeParms_t; - +#include extern RAN_CONTEXT_t RC; #endif diff --git a/openair1/PHY/TOOLS/oai_dfts.c b/openair1/PHY/TOOLS/oai_dfts.c index 6569f7eab5..83207426fd 100644 --- a/openair1/PHY/TOOLS/oai_dfts.c +++ b/openair1/PHY/TOOLS/oai_dfts.c @@ -18,7 +18,7 @@ * For more information about the OpenAirInterface (OAI) Software Alliance: * contact@openairinterface.org */ - + #include #include #include @@ -32,17 +32,17 @@ #define M_PI 3.14159265358979323846 #endif #define OAIDFTS_MAIN -#ifndef MR_MAIN -#include "PHY/defs_common.h" -#include "PHY/impl_defs_top.h" -#else +//#ifndef MR_MAIN +//#include "PHY/defs_common.h" +//#include "PHY/impl_defs_top.h" +//#else #include "time_meas.h" #include "LOG/log.h" #define debug_msg #define ONE_OVER_SQRT2_Q15 23170 -int oai_exit=0; -#endif +//int oai_exit=0; +//#endif #define ONE_OVER_SQRT3_Q15 18919 @@ -50,6 +50,8 @@ int oai_exit=0; #include "assertions.h" +#include "tools_defs.h" + #define print_shorts(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) #define print_shorts256(s,x) printf("%s %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7],(x)[8],(x)[9],(x)[10],(x)[11],(x)[12],(x)[13],(x)[14],(x)[15]) @@ -3103,10 +3105,12 @@ void dft128(int16_t *x,int16_t *y,unsigned char scale) dft64((int16_t*)(xtmp),(int16_t*)ytmp,1); dft64((int16_t*)(xtmp+32),(int16_t*)(ytmp+16),1); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128a.m","dfta",ytmp,64,1,1); LOG_M("dft128b.m","dftb",ytmp+16,64,1,1); } +#endif for (i=0; i<16; i++) { bfly2_16(ytmpp,ytmpp+16, y128p,y128p+16, @@ -3155,10 +3159,12 @@ void dft128(int16_t *x,int16_t *y,unsigned char scale) } +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128out.m","dft128",y,128,1,1); exit(-1); } +#endif _mm_empty(); _m_empty(); @@ -3183,18 +3189,20 @@ void dft128(int16_t *x,int16_t *y,unsigned char scale) transpose4_ooff_simd256(x256+10,xtmp+5,8); transpose4_ooff_simd256(x256+12,xtmp+6,8); transpose4_ooff_simd256(x256+14,xtmp+7,8); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128ina_256.m","dftina",xtmp,64,1,1); LOG_M("dft128inb_256.m","dftinb",xtmp+8,64,1,1); } - +#endif dft64((int16_t*)(xtmp),(int16_t*)ytmp,1); dft64((int16_t*)(xtmp+8),(int16_t*)(ytmp+8),1); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128outa_256.m","dftouta",ytmp,64,1,1); LOG_M("dft128outb_256.m","dftoutb",ytmp+8,64,1,1); } - +#endif for (i=0; i<8; i++) { bfly2_16_256(ytmpp,ytmpp+8, y256p,y256p+8, @@ -3226,10 +3234,12 @@ void dft128(int16_t *x,int16_t *y,unsigned char scale) y256[15] = mulhi_int16_simd256(y256[15],ONE_OVER_SQRT2_Q15_256); } +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft128.m","dft",y256,128,1,1); exit(-1); } +#endif } #endif @@ -6031,11 +6041,13 @@ void dft1536(int16_t *input, int16_t *output, unsigned char scale) tmpo[1][i] = tmpo[1][i<<1]; tmpo[2][i] = tmpo[2][i<<1]; }*/ +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft1536out0.m","o0",tmpo[0],2048,1,1); LOG_M("dft1536out1.m","o1",tmpo[1],2048,1,1); LOG_M("dft1536out2.m","o2",tmpo[2],2048,1,1); } +#endif for (i=0,i2=0; i<1024; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+1024+i),(simd_q15_t*)(output+2048+i), @@ -6193,14 +6205,14 @@ void idft6144(int16_t *input, int16_t *output,unsigned char scale) idft2048((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1); idft2048((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1); idft2048((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1); - +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft6144in.m","in",input,6144,1,1); LOG_M("idft6144out0.m","o0",tmpo[0],2048,1,1); LOG_M("idft6144out1.m","o1",tmpo[1],2048,1,1); LOG_M("idft6144out2.m","o2",tmpo[2],2048,1,1); } - +#endif for (i=0,i2=0; i<4096; i+=8,i2+=4) { ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+4096+i),(simd_q15_t*)(output+8192+i), @@ -6260,11 +6272,13 @@ void dft6144(int16_t *input, int16_t *output,unsigned char scale) tmpo[1][i] = tmpo[1][i<<1]; tmpo[2][i] = tmpo[2][i<<1]; }*/ +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("ft6144out0.m","o0",tmpo[0],2048,1,1); LOG_M("ft6144out1.m","o1",tmpo[1],2048,1,1); LOG_M("ft6144out2.m","o2",tmpo[2],2048,1,1); } +#endif for (i=0,i2=0; i<4096; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+4096+i),(simd_q15_t*)(output+8192+i), @@ -6336,11 +6350,13 @@ void dft12288(int16_t *input, int16_t *output,unsigned char scale) tmpo[1][i] = tmpo[1][i<<1]; tmpo[2][i] = tmpo[2][i<<1]; }*/ +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft12288out0.m","o0",tmpo[0],4096,1,1); LOG_M("dft12288out1.m","o1",tmpo[1],4096,1,1); LOG_M("dft12288out2.m","o2",tmpo[2],4096,1,1); } +#endif for (i=0,i2=0; i<8192; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+8192+i),(simd_q15_t*)(output+16384+i), @@ -6392,14 +6408,14 @@ void idft12288(int16_t *input, int16_t *output,unsigned char scale) idft4096((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),scale); idft4096((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),scale); idft4096((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),scale); - +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft12288in.m","in",input,12288,1,1); LOG_M("idft12288out0.m","o0",tmpo[0],4096,1,1); LOG_M("idft12288out1.m","o1",tmpo[1],4096,1,1); LOG_M("idft12288out2.m","o2",tmpo[2],4096,1,1); } - +#endif for (i=0,i2=0; i<8192; i+=8,i2+=4) { ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+8192+i),(simd_q15_t*)(output+16384+i), @@ -6429,9 +6445,11 @@ void idft12288(int16_t *input, int16_t *output,unsigned char scale) } _mm_empty(); _m_empty(); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft12288out.m","out",output,6144,1,1); } +#endif } int16_t twa18432[12288] __attribute__((aligned(32))); @@ -6560,11 +6578,13 @@ void dft24576(int16_t *input, int16_t *output,unsigned char scale) tmpo[1][i] = tmpo[1][i<<1]; tmpo[2][i] = tmpo[2][i<<1]; }*/ +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft24576out0.m","o0",tmpo[0],8192,1,1); LOG_M("dft24576out1.m","o1",tmpo[1],8192,1,1); LOG_M("dft24576out2.m","o2",tmpo[2],8192,1,1); } +#endif for (i=0,i2=0; i<16384; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+16384+i),(simd_q15_t*)(output+32768+i), @@ -6595,9 +6615,11 @@ void dft24576(int16_t *input, int16_t *output,unsigned char scale) } _mm_empty(); _m_empty(); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("out.m","out",output,24576,1,1); } +#endif } void idft24576(int16_t *input, int16_t *output,unsigned char scale) @@ -6617,14 +6639,14 @@ void idft24576(int16_t *input, int16_t *output,unsigned char scale) idft8192((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1); idft8192((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1); idft8192((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1); - + #ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft24576in.m","in",input,24576,1,1); LOG_M("idft24576out0.m","o0",tmpo[0],8192,1,1); LOG_M("idft24576out1.m","o1",tmpo[1],8192,1,1); LOG_M("idft24576out2.m","o2",tmpo[2],8192,1,1); } - +#endif for (i=0,i2=0; i<16384; i+=8,i2+=4) { ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+16384+i),(simd_q15_t*)(output+32768+i), @@ -6653,10 +6675,11 @@ void idft24576(int16_t *input, int16_t *output,unsigned char scale) } _mm_empty(); _m_empty(); - +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("idft24576out.m","out",output,24576,1,1); } +#endif } int16_t twa36864[24576] __attribute__((aligned(32))); @@ -6680,13 +6703,13 @@ void dft36864(int16_t *input, int16_t *output,uint8_t scale) { dft12288((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1); dft12288((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1); dft12288((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1); - +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("dft36864out0.m","o0",tmpo[0],12288,1,1); LOG_M("dft36864out1.m","o1",tmpo[1],12288,1,1); LOG_M("dft36864out2.m","o2",tmpo[2],12288,1,1); } - +#endif for (i=0,i2=0; i<24576; i+=8,i2+=4) { bfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),(simd_q15_t*)(&tmpo[2][i2]), (simd_q15_t*)(output+i),(simd_q15_t*)(output+24576+i),(simd_q15_t*)(output+49152+i), @@ -6716,9 +6739,11 @@ void dft36864(int16_t *input, int16_t *output,uint8_t scale) { } _mm_empty(); _m_empty(); +#ifndef MR_MAIN if (LOG_DUMPFLAG(DEBUG_DFT)) { LOG_M("out.m","out",output,36864,1,1); } +#endif } void idft36864(int16_t *input, int16_t *output,uint8_t scale) { diff --git a/openair1/PHY/TOOLS/phy_scope_interface.c b/openair1/PHY/TOOLS/phy_scope_interface.c index af237b2325..7cd68c53d2 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.c +++ b/openair1/PHY/TOOLS/phy_scope_interface.c @@ -35,6 +35,7 @@ #include "phy_scope_interface.h" #define SOFTSCOPE_ENDFUNC_IDX 0 + static loader_shlibfunc_t scope_fdesc[]= {{"end_forms",NULL}}; int load_softscope(char *exectype, void *initarg) { diff --git a/openair1/PHY/TOOLS/phy_scope_interface.h b/openair1/PHY/TOOLS/phy_scope_interface.h index adf04d5ea4..8b747d575d 100644 --- a/openair1/PHY/TOOLS/phy_scope_interface.h +++ b/openair1/PHY/TOOLS/phy_scope_interface.h @@ -29,7 +29,26 @@ * \note * \warning */ +#ifndef __PHY_SCOPE_INTERFACE_H__ +#define __PHY_SCOPE_INTERFACE_H__ +#include +typedef struct { + int *argc; + char **argv; + RU_t *ru; + PHY_VARS_gNB *gNB; +} scopeParms_t; +typedef struct scopeData_s { + int *argc; + char **argv; + RU_t *ru; + PHY_VARS_gNB *gNB; + int32_t * rxdataF; + void (*slotFunc)(int32_t* data, int slot, void * scopeData); +} scopeData_t; + int load_softscope(char *exectype, void *initarg); int end_forms(void) ; +#endif diff --git a/openair1/PHY/TOOLS/time_meas.c b/openair1/PHY/TOOLS/time_meas.c index cfa3b93007..001770c876 100644 --- a/openair1/PHY/TOOLS/time_meas.c +++ b/openair1/PHY/TOOLS/time_meas.c @@ -26,9 +26,12 @@ // global var for openair performance profiler int opp_enabled = 0; +double cpu_freq_GHz __attribute__ ((aligned(32))); +double cpu_freq_GHz __attribute__ ((aligned(32)))=0.0; double get_cpu_freq_GHz(void) { + if (cpu_freq_GHz <1 ) { time_stats_t ts = {0}; reset_meas(&ts); ts.trials++; @@ -37,6 +40,7 @@ double get_cpu_freq_GHz(void) ts.diff = (rdtsc_oai()-ts.in); cpu_freq_GHz = (double)ts.diff/1000000000; printf("CPU Freq is %f \n", cpu_freq_GHz); + } return cpu_freq_GHz; } @@ -99,10 +103,11 @@ void print_meas(time_stats_t *ts, if (ts->trials>0) { //printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials); if ((total_exec_time == NULL) || (sf_exec_time== NULL)) { - fprintf(stderr, "%25s: %15.3f us; %15d;\n", + fprintf(stderr, "%25s: %15.3f us; %15d; %15.3f us;\n", name, (ts->diff/ts->trials/cpu_freq_GHz/1000.0), - ts->trials); + ts->trials, + ts->max/cpu_freq_GHz/1000.0); } else { fprintf(stderr, "%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n", name, diff --git a/openair1/PHY/TOOLS/time_meas.h b/openair1/PHY/TOOLS/time_meas.h index 2deab40f27..e2ceef8405 100644 --- a/openair1/PHY/TOOLS/time_meas.h +++ b/openair1/PHY/TOOLS/time_meas.h @@ -33,7 +33,7 @@ #include // global var to enable openair performance profiler extern int opp_enabled; -double cpu_freq_GHz __attribute__ ((aligned(32)));; +extern double cpu_freq_GHz __attribute__ ((aligned(32)));; #if defined(__x86_64__) || defined(__i386__) typedef struct { diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index db7ac3d813..4c68c15cb6 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -44,6 +44,11 @@ struct complex { double y; }; +struct complexd { + double r; + double i; +}; + struct complexf { float r; float i; diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 885f955a2a..66cb51adc6 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -92,17 +92,17 @@ typedef enum { typedef struct { - /// \brief Holds the transmit data in the frequency domain. + /// \brief Holds the transmit data in the frequency domain (1 frame). /// - first index: rx antenna [0..nb_antennas_rx[ - /// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[ + /// - second index: ? [0..samples_per_frame[ int32_t **txdata; - /// \brief holds the transmit data after beamforming in the frequency domain. + /// \brief holds the transmit data after beamforming in the frequency domain (1 slot). /// - first index: tx antenna [0..nb_antennas_tx[ - /// - second index: sample [0..] + /// - second index: sample [0..samples_per_slot_woCP] int32_t **txdataF_BF; - /// \brief holds the transmit data before beamforming in the frequency domain. - /// - first index: tx antenna [0..nb_antennas_tx[ - /// - second index: sample [0..] + /// \brief holds the transmit data before beamforming in the frequency domain (1 frame). + /// - first index: tx antenna [0..nb_antenna_ports[ + /// - second index: sample [0..samples_per_frame_woCP] int32_t **txdataF; /// \brief holds the transmit data before beamforming for epdcch/mpdcch /// - first index : tx antenna [0..nb_epdcch_antenna_ports[ @@ -128,6 +128,10 @@ typedef struct { /// - second index: tx antenna [0..nb_antennas_tx[ /// - third index: frequency [0..] int32_t **tdd_calib_coeffs; + /// \brief Anaglogue beam ID for each OFDM symbol (used when beamforming not done in RU) + /// - first index: antenna port + /// - second index: beam_id [0.. symbols_per_frame[ + uint8_t **beam_id; } RU_COMMON; @@ -432,6 +436,14 @@ typedef enum { typedef struct RU_t_s { /// index of this ru uint32_t idx; + /// pointer to first RU + struct RU_t_s *ru0; + /// pointer to ru_mask + uint64_t *ru_mask; + /// pointer to ru_mutex + pthread_mutex_t *ru_mutex; + /// pointer to ru_cond + pthread_cond_t *ru_cond; /// Pointer to configuration file char *rf_config_file; /// southbound interface @@ -442,6 +454,12 @@ typedef struct RU_t_s { node_function_t function; /// Ethernet parameters for fronthaul interface eth_params_t eth_params; + /// flag to indicate RF emulation mode + int emulate_rf; + /// numerology index + int numerology; + /// flag to indicate basicsim operation + int basicsim; /// flag to indicate the RU is in sync with a master reference int in_synch; /// timing offset diff --git a/openair1/PHY/defs_common.h b/openair1/PHY/defs_common.h index 27765a8548..b9c776f1c8 100644 --- a/openair1/PHY/defs_common.h +++ b/openair1/PHY/defs_common.h @@ -867,8 +867,9 @@ typedef enum { NOT_SYNCHED=0, PRACH=1, RA_RESPONSE=2, - PUSCH=3, - RESYNCH=4 + RA_WAIT_CR=3, + PUSCH=4, + RESYNCH=5 } UE_MODE_t; #define FOREACH_PARALLEL(GEN) \ @@ -943,6 +944,23 @@ extern int sync_var; #define DECODE_NUM_FPTR 13 +// Mask for identifying subframe for MBMS +#define MBSFN_TDD_SF3 0x80// for TDD +#define MBSFN_TDD_SF4 0x40 +#define MBSFN_TDD_SF7 0x20 +#define MBSFN_TDD_SF8 0x10 +#define MBSFN_TDD_SF9 0x08 + + + +#define MBSFN_FDD_SF1 0x80// for FDD +#define MBSFN_FDD_SF2 0x40 +#define MBSFN_FDD_SF3 0x20 +#define MBSFN_FDD_SF6 0x10 +#define MBSFN_FDD_SF7 0x08 +#define MBSFN_FDD_SF8 0x04 + + typedef uint8_t(decoder_if_t)(int16_t *y, int16_t *y2, uint8_t *decoded_bytes, diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index 0f1bf75114..030d50bc04 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -164,10 +164,10 @@ typedef struct { /// - first index: rx antenna id [0..nb_antennas_rx[ /// - second index: ? [0..12*N_RB_UL*frame_parms->symbols_per_tti[ int32_t **ul_ch_magb; - /// measured RX power based on DRS - int ulsch_power[2]; - /// measured Interference power based on DRS - int ulsch_interference_power[2]; + /// measured RX power based on DMRS + int ulsch_power[4]; + /// measured RX power of noise + int ulsch_noise_power[4]; /// \brief llr values. /// - first index: ? [0..1179743] (hard coded) int16_t *llr; @@ -217,6 +217,58 @@ typedef struct { int ret; } td_params; +/// Context data structure for RX/TX portion of subframe processing +typedef struct { + /// Component Carrier index + uint8_t CC_id; + /// timestamp transmitted to HW + openair0_timestamp timestamp_tx; + openair0_timestamp timestamp_rx; + /// subframe to act upon for transmission + int subframe_tx; + /// subframe to act upon for reception + int subframe_rx; + /// frame to act upon for transmission + int frame_tx; + /// frame to act upon for reception + int frame_rx; + int frame_prach; + int subframe_prach; + int frame_prach_br; + int subframe_prach_br; + /// \brief Instance count for RXn-TXnp4 processing thread. + /// \internal This variable is protected by \ref mutex_rxtx. + int instance_cnt; + /// pthread structure for RXn-TXnp4 processing thread + pthread_t pthread; + /// pthread attributes for RXn-TXnp4 processing thread + pthread_attr_t attr; + /// condition variable for tx processing thread + pthread_cond_t cond; + /// mutex for RXn-TXnp4 processing thread + pthread_mutex_t mutex; + /// scheduling parameters for RXn-TXnp4 thread + struct sched_param sched_param_rxtx; + + /// \internal This variable is protected by \ref mutex_RUs. + int instance_cnt_RUs; + /// condition variable for tx processing thread + pthread_cond_t cond_RUs; + /// mutex for RXn-TXnp4 processing thread + pthread_mutex_t mutex_RUs; + tpool_t *threadPool; + int nbEncode; + int nbDecode; + notifiedFIFO_t *respEncode; + notifiedFIFO_t *respDecode; + pthread_mutex_t mutex_emulateRF; + int instance_cnt_emulateRF; + pthread_t pthread_emulateRF; + pthread_attr_t attr_emulateRF; + pthread_cond_t cond_emulateRF; + int first_rx; +} L1_rxtx_proc_t; + typedef struct { struct PHY_VARS_eNB_s *eNB; LTE_eNB_DLSCH_t *dlsch; @@ -362,8 +414,11 @@ typedef struct L1_proc_t_s { L1_rxtx_proc_t L1_proc,L1_proc_tx; /// stats thread pthread descriptor pthread_t process_stats_thread; + /// L1 stats pthread descriptor + pthread_t L1_stats_thread; /// for waking up tx procedure RU_proc_t *ru_proc; + struct PHY_VARS_eNB_s *eNB; } L1_proc_t; @@ -395,36 +450,73 @@ typedef struct { short n0_subband_power_avg_dB; // eNB measurements (per user) //! estimated received spatial signal power (linear) - unsigned int rx_spatial_power[NUMBER_OF_UE_MAX][2][2]; + unsigned int rx_spatial_power[NUMBER_OF_SRS_MAX][2][2]; //! estimated received spatial signal power (dB) - unsigned short rx_spatial_power_dB[NUMBER_OF_UE_MAX][2][2]; + unsigned short rx_spatial_power_dB[NUMBER_OF_SRS_MAX][2][2]; //! estimated rssi (dBm) - short rx_rssi_dBm[NUMBER_OF_UE_MAX]; + short rx_rssi_dBm[NUMBER_OF_SRS_MAX]; //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation) - int rx_correlation[NUMBER_OF_UE_MAX][2]; + int rx_correlation[NUMBER_OF_SRS_MAX][2]; //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation) - int rx_correlation_dB[NUMBER_OF_UE_MAX][2]; + int rx_correlation_dB[NUMBER_OF_SRS_MAX][2]; /// Wideband CQI (= SINR) - int wideband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB]; + int wideband_cqi[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB]; /// Wideband CQI in dB (= SINR dB) - int wideband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB]; + int wideband_cqi_dB[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB]; /// Wideband CQI (sum of all RX antennas, in dB) - char wideband_cqi_tot[NUMBER_OF_UE_MAX]; + char wideband_cqi_tot[NUMBER_OF_SRS_MAX]; /// Subband CQI per RX antenna and RB (= SINR) - int subband_cqi[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100]; + int subband_cqi[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB][100]; /// Total Subband CQI and RB (= SINR) int subband_cqi_tot[NUMBER_OF_UE_MAX][100]; /// Subband CQI in dB and RB (= SINR dB) - int subband_cqi_dB[NUMBER_OF_UE_MAX][MAX_NUM_RU_PER_eNB][100]; + int subband_cqi_dB[NUMBER_OF_SRS_MAX][MAX_NUM_RU_PER_eNB][100]; /// Total Subband CQI and RB - int subband_cqi_tot_dB[NUMBER_OF_UE_MAX][100]; + int subband_cqi_tot_dB[NUMBER_OF_SRS_MAX][100]; /// PRACH background noise level int prach_I0; /// PUCCH background noise level int n0_pucch_dB; } PHY_MEASUREMENTS_eNB; +typedef struct { + uint16_t rnti; + int frame; + int round_trials[8]; + int total_bytes_tx; + int total_bytes_rx; + int current_G; + int current_TBS; + int current_Qm; + int current_mcs; + int current_RI; + int timing_offset; + int ulsch_power[4]; + int ulsch_noise_power[4]; +} eNB_SCH_STATS_t; + +typedef struct { + uint16_t rnti; + int frame; + int pucch1_trials; + int pucch1_thres; + int current_pucch1_stat_pos; + int current_pucch1_stat_neg; + int pucch1_positive_SR; + int pucch1_low_stat[4]; + int pucch1_high_stat[4]; + int pucch1_phase; + int pucch1a_trials; + int current_pucch1a_stat_re; + int current_pucch1a_stat_im; + int pucch1ab_DTX; + int pucch1b_trials; + int current_pucch1b_stat_re; + int current_pucch1b_stat_im; + int pucch3_trials; + int current_pucch3_stat; +} eNB_UCI_STATS_t; /// Top-level PHY Data Structure for eNB typedef struct PHY_VARS_eNB_s { @@ -472,13 +564,13 @@ typedef struct PHY_VARS_eNB_s { LTE_eNB_MPDCCH mpdcch_vars[2]; LTE_eNB_PRACH prach_vars_br; LTE_eNB_COMMON common_vars; - LTE_eNB_UCI uci_vars[NUMBER_OF_UCI_VARS_MAX]; - LTE_eNB_SRS srs_vars[NUMBER_OF_UE_MAX]; + LTE_eNB_UCI uci_vars[NUMBER_OF_UCI_MAX]; + LTE_eNB_SRS srs_vars[NUMBER_OF_SRS_MAX]; LTE_eNB_PBCH pbch; - LTE_eNB_PUSCH *pusch_vars[NUMBER_OF_UE_MAX]; + LTE_eNB_PUSCH *pusch_vars[NUMBER_OF_ULSCH_MAX]; LTE_eNB_PRACH prach_vars; - LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_UE_MAX][2]; // Nusers times two spatial streams - LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA + LTE_eNB_DLSCH_t *dlsch[NUMBER_OF_DLSCH_MAX][2]; // Num active DLSCH contexts times two spatial streams + LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_ULSCH_MAX]; // Num active ULSCH contexts LTE_eNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p; LTE_eNB_DLSCH_t *dlsch_MCH; LTE_eNB_DLSCH_t *dlsch_PCH; @@ -489,7 +581,7 @@ typedef struct PHY_VARS_eNB_s { uint32_t lte_gold_table[20][2][14]; /// UE-specific reference symbols (p=5), TM 7 - uint32_t lte_gold_uespec_port5_table[NUMBER_OF_UE_MAX][20][38]; + uint32_t lte_gold_uespec_port5_table[NUMBER_OF_DLSCH_MAX][20][38]; /// UE-specific reference symbols (p=7...14), TM 8/9/10 uint32_t lte_gold_uespec_table[2][20][2][21]; @@ -521,6 +613,9 @@ typedef struct PHY_VARS_eNB_s { uint8_t pbch_pdu[4]; //PBCH_PDU_SIZE char eNB_generate_rar; + /// indicator that eNB signal generation uses DTX (i.e. signal is cleared in each subframe + int use_DTX; + int32_t **subframe_mask; /// Indicator set to 0 after first SR uint8_t first_sr[NUMBER_OF_UE_MAX]; @@ -592,7 +687,12 @@ typedef struct PHY_VARS_eNB_s { /// Information regarding TM5 MU_MIMO_mode mu_mimo_mode[NUMBER_OF_UE_MAX]; - + /// statistics for DLSCH measurement collection + eNB_SCH_STATS_t dlsch_stats[NUMBER_OF_SCH_STATS_MAX]; + /// statistics for ULSCH measurement collection + eNB_SCH_STATS_t ulsch_stats[NUMBER_OF_SCH_STATS_MAX]; + /// statis for UCI (PUCCH) measurement collection + eNB_UCI_STATS_t uci_stats[NUMBER_OF_SCH_STATS_MAX]; /// target_ue_dl_mcs : only for debug purposes uint32_t target_ue_dl_mcs; /// target_ue_ul_mcs : only for debug purposes diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 822f4c3986..d815c75567 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -138,8 +138,10 @@ typedef struct { typedef struct { /// Pointers to variables related to DLSCH harq process NR_DL_gNB_HARQ_t harq_process; - /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) + /// TX buffers for UE-spec transmission (antenna layers 1,...,4 after to precoding) int32_t *txdataF[NR_MAX_NB_LAYERS]; + /// TX buffers for UE-spec transmission (antenna ports 1000 or 1001,...,1007, before precoding) + int32_t *txdataF_precoding[NR_MAX_NB_LAYERS]; /// Modulated symbols buffer int32_t *mod_symbs[NR_MAX_NB_CODEWORDS]; /// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers? @@ -180,7 +182,10 @@ typedef struct { int16_t sqrt_rho_b; } NR_gNB_DLSCH_t; - +typedef struct { + bool active; + nfapi_nr_dl_tti_ssb_pdu ssb_pdu; +} NR_gNB_SSB_t; typedef struct { int frame; @@ -385,8 +390,12 @@ typedef struct { /// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //? /// - first index: eNB id [0..2] (hard coded) /// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports. - /// - third index: sample [0..] + /// - third index: sample [0..samples_per_frame_woCP] int32_t **txdataF; + /// \brief Anaglogue beam ID for each OFDM symbol (used when beamforming not done in RU) + /// - first index: antenna port + /// - second index: beam_id [0.. symbols_per_frame[ + uint8_t **beam_id; int32_t *debugBuff; int32_t debugBuff_sample_offset; } NR_gNB_COMMON; @@ -655,6 +664,7 @@ typedef struct { int prach_I0; } PHY_MEASUREMENTS_gNB; +#define MAX_NUM_NR_PRACH_PREAMBLES 64 #define MAX_NUM_NR_RX_RACH_PDUS 4 #define MAX_NUM_NR_RX_PRACH_PREAMBLES 4 #define MAX_UL_PDUS_PER_SLOT 8 @@ -705,10 +715,9 @@ typedef struct PHY_VARS_gNB_s { // nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu; // nfapi_nr_ul_dci_request_pdus_t *ul_dci_pdu; - nfapi_nr_dl_tti_ssb_pdu ssb_pdu; - uint16_t num_pdsch_rnti[80]; - NR_gNB_PBCH pbch; + NR_gNB_SSB_t ssb[64]; + NR_gNB_PBCH pbch; nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL]; NR_gNB_COMMON common_vars; NR_gNB_PRACH prach_vars; @@ -791,6 +800,7 @@ typedef struct PHY_VARS_gNB_s { int prach_energy_counter; int pucch0_thres; + uint64_t bad_pucch; /* time_stats_t phy_proc; */ @@ -813,6 +823,7 @@ typedef struct PHY_VARS_gNB_s { time_stats_t dlsch_segmentation_stats; time_stats_t rx_pusch_stats; + time_stats_t ul_indication_stats; time_stats_t ulsch_decoding_stats; time_stats_t ulsch_rate_unmatching_stats; time_stats_t ulsch_ldpc_decoding_stats; @@ -836,7 +847,9 @@ typedef struct PHY_VARS_gNB_s { tpool_t *threadPool; int nbDecode; uint8_t pusch_proc_threads; - + int number_of_nr_dlsch_max; + int number_of_nr_ulsch_max; + void * scopeData; } PHY_VARS_gNB; typedef struct LDPCDecode_s { diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 390574a66b..e3c0737838 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -142,6 +142,7 @@ typedef struct { uint32_t rsrp[7]; float rsrp_filtered[7]; // after layer 3 filtering float rsrq_filtered[7]; + short rsrp_dBm[7]; // common measurements //! estimated noise power (linear) unsigned int n0_power[NB_ANTENNAS_RX]; @@ -187,7 +188,7 @@ typedef struct { //! estimated rssi (dBm) short rx_rssi_dBm[NUMBER_OF_CONNECTED_gNB_MAX]; //! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation) - int rx_correlation[NUMBER_OF_CONNECTED_gNB_MAX][2]; + int rx_correlation[NUMBER_OF_CONNECTED_gNB_MAX][4][4]; //! estimated correlation (wideband dB) between spatial channels (computed in dlsch_demodulation) int rx_correlation_dB[NUMBER_OF_CONNECTED_gNB_MAX][2]; @@ -332,12 +333,10 @@ typedef struct { int32_t **dl_ch_magb1[8][8]; /// \brief Magnitude of Downlink Channel, first layer (256QAM level). int32_t **dl_ch_magr0; - /// \brief Cross-correlation of two gNB signals. - /// - first index: rx antenna [0..nb_antennas_rx[ + /// \brief Cross-correlation Matrix of the gNB Tx channel signals. + /// - first index: aatx*n_rx+aarx for all aatx=[0..n_tx[ and aarx=[0..nb_rx[ /// - second index: symbol [0..] - int32_t **rho; - /// never used... always send dl_ch_rho_ext instead... - int32_t **rho_i; + int32_t ***rho; /// \brief Pointers to llr vectors (2 TBs). /// - first index: ? [0..1] (hard coded) /// - second index: ? [0..1179743] (hard coded) @@ -764,6 +763,8 @@ typedef struct { int is_synchronized; /// \brief Indicates on which frame is synchronized in a two frame synchronization int is_synchronized_on_frame; + /// \brief Indicator that UE lost frame synchronization + int lost_sync; /// Data structure for UE process scheduling UE_nr_proc_t proc; /// Flag to indicate the UE shouldn't do timing correction at all @@ -790,6 +791,8 @@ typedef struct { uint8_t ho_initiated; /// \brief indicator that Handover procedure has been triggered uint8_t ho_triggered; + /// threshold for false dci detection + int dci_thres; /// \brief Measurement variables. PHY_NR_MEASUREMENTS measurements; NR_DL_FRAME_PARMS frame_parms; @@ -842,9 +845,15 @@ typedef struct { /// PDSCH DMRS uint32_t ****nr_gold_pdsch[NUMBER_OF_CONNECTED_eNB_MAX]; + // Scrambling IDs used in PDSCH DMRS + uint16_t scramblingID[2]; + /// PDCCH DMRS uint32_t ***nr_gold_pdcch[NUMBER_OF_CONNECTED_eNB_MAX]; + // Scrambling IDs used in PDCCH DMRS + uint16_t scramblingID_pdcch; + /// PUSCH DMRS sequence uint32_t ****nr_gold_pusch_dmrs; @@ -1075,6 +1084,7 @@ typedef struct { typedef struct nr_rxtx_thread_data_s { UE_nr_rxtx_proc_t proc; PHY_VARS_NR_UE *UE; + notifiedFIFO_t txFifo; } nr_rxtx_thread_data_t; #include "SIMULATION/ETH_TRANSPORT/defs.h" diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 398252c37b..d1d69ecabe 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -109,6 +109,8 @@ #define MAX_NUM_NR_CHANNEL_BITS (14*273*12*8) // 14 symbols, 273 RB #define MAX_NUM_NR_RE (14*273*12) +#define NR_RX_NB_TH 1 +#define NR_NB_TH_SLOT 2 extern const uint8_t nr_rv_round_map[4]; extern const uint8_t nr_rv_round_map_ue[4]; diff --git a/openair1/PHY/impl_defs_nr.h b/openair1/PHY/impl_defs_nr.h index ceb75c2554..a74c3675a4 100644 --- a/openair1/PHY/impl_defs_nr.h +++ b/openair1/PHY/impl_defs_nr.h @@ -36,7 +36,6 @@ #include #include "types.h" -#include "NR_PDSCH-TimeDomainResourceAllocation.h" #ifdef DEFINE_VARIABLES_PHY_IMPLEMENTATION_DEFS_NR_H #define EXTERN @@ -214,10 +213,8 @@ typedef enum { #define NB_SRS_PERIOD (17) -const uint16_t srs_period[NB_SRS_PERIOD] -#ifdef INIT_VARIABLES_PHY_IMPLEMENTATION_DEFS_NR_H +static const uint16_t srs_period[NB_SRS_PERIOD] = { 1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 160, 320, 640, 1280, 2560} -#endif ; /// SRS_Resource of SRS_Config information element from 38.331 RRC specifications @@ -397,6 +394,13 @@ typedef struct{ typedef struct{ // to be defined FIXME!!! }zp_CSI_RS_Resource_t; + +typedef struct{ + int k0; + int mappingType; + int startSymbolAndLength; + +}PDSCH_TimeDomainResourceAllocation_t; typedef struct { /* * resourceAllocation @@ -449,7 +453,8 @@ typedef struct { */ maxNrofCodeWordsScheduledByDCI_t maxNrofCodeWordsScheduledByDCI; - NR_PDSCH_TimeDomainResourceAllocation_t *pdsch_TimeDomainResourceAllocation[MAX_NR_OF_DL_ALLOCATIONS]; + + PDSCH_TimeDomainResourceAllocation_t *pdsch_TimeDomainResourceAllocation[MAX_NR_OF_DL_ALLOCATIONS]; } PDSCH_Config_t; @@ -796,7 +801,6 @@ typedef struct { uint8_t initial_CS_indexes[MAX_NB_CYCLIC_SHIFT]; } initial_pucch_resource_t; -const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE]; /* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ /* structure with all possible fields for pucch format from 0 to 4 */ typedef struct { @@ -1051,11 +1055,6 @@ typedef struct { #define NB_SR_PERIOD (15) -const uint16_t scheduling_request_periodicity[NB_SR_PERIOD] -#ifdef INIT_VARIABLES_PHY_IMPLEMENTATION_DEFS_NR_H -= { 0, 0, 1, 2, 4, 5, 8, 10, 16, 20, 40, 80, 160, 320, 640 } -#endif -; typedef enum { sr_sym2 = 0, diff --git a/openair1/PHY/impl_defs_top.h b/openair1/PHY/impl_defs_top.h index a8548af8dc..fa021ffe81 100644 --- a/openair1/PHY/impl_defs_top.h +++ b/openair1/PHY/impl_defs_top.h @@ -275,6 +275,12 @@ #define NR_UE_CAPABILITY_SLOT_RX_TO_TX (6) /* FFS_NR_TODO it defines ue capability which is the number of slots */ /* - between reception of pdsch and tarnsmission of its acknowlegment */ /* - between reception of un uplink grant and its related transmission */ +#ifndef NO_RAT_NR + #define DURATION_RX_TO_TX (NR_UE_CAPABILITY_SLOT_RX_TO_TX) /* for NR this will certainly depends to such UE capability which is not yet defined */ +#else + #define DURATION_RX_TO_TX (6) /* For LTE, this duration is fixed to 4 and it is linked to LTE standard for both modes FDD/TDD */ +#endif + #define NR_MAX_HARQ_PROCESSES (16) #define NR_MAX_ULSCH_HARQ_PROCESSES (NR_MAX_HARQ_PROCESSES) /* cf 38.214 6.1 UE procedure for receiving the physical uplink shared channel */ diff --git a/openair1/PHY/phy_extern.h b/openair1/PHY/phy_extern.h index 165ed961b3..d5fea5aec6 100644 --- a/openair1/PHY/phy_extern.h +++ b/openair1/PHY/phy_extern.h @@ -23,7 +23,6 @@ #define __PHY_EXTERN_H__ #include "PHY/defs_common.h" -#include "common/ran_context.h" extern char* namepointer_chMag ; extern char* namepointer_log2; @@ -33,14 +32,13 @@ extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX]; extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; #include "PHY/LTE_TRANSPORT/transport_extern.h" -//#include "SIMULATION/ETH_TRANSPORT/extern.h" +#include "PHY/defs_RU.h" extern unsigned int DAQ_MBOX; extern int number_of_cards; extern const short conjugate[8],conjugate2[8]; -extern RAN_CONTEXT_t RC; extern short primary_synch0[144]; extern short primary_synch1[144]; @@ -48,12 +46,6 @@ extern short primary_synch2[144]; extern unsigned char primary_synch0_tab[72]; extern unsigned char primary_synch1_tab[72]; extern unsigned char primary_synch2_tab[72]; -extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ -extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ extern int flagMag; //extern short **txdataF_rep_tmp; diff --git a/openair1/PHY/phy_extern_nr_ue.h b/openair1/PHY/phy_extern_nr_ue.h index 700419c61c..f1704a7902 100644 --- a/openair1/PHY/phy_extern_nr_ue.h +++ b/openair1/PHY/phy_extern_nr_ue.h @@ -55,9 +55,6 @@ extern unsigned char primary_synch2_tab[72]; extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ -extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ extern int flagMag; //extern short **txdataF_rep_tmp; diff --git a/openair1/PHY/phy_extern_ue.h b/openair1/PHY/phy_extern_ue.h index 622551c2fe..9f227806fd 100644 --- a/openair1/PHY/phy_extern_ue.h +++ b/openair1/PHY/phy_extern_ue.h @@ -23,7 +23,6 @@ #define __PHY_EXTERN_UE__H__ #include "PHY/defs_UE.h" -#include "common/ran_context.h" extern char* namepointer_chMag ; extern char* namepointer_log2; @@ -47,12 +46,6 @@ extern short primary_synch2[144]; extern unsigned char primary_synch0_tab[72]; extern unsigned char primary_synch1_tab[72]; extern unsigned char primary_synch2_tab[72]; -extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[ -extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[ -extern int *sync_corr_ue0; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue1; //!< index [0..10*samples_per_tti[ -extern int *sync_corr_ue2; //!< index [0..10*samples_per_tti[ extern int flagMag; //extern short **txdataF_rep_tmp; diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h index 5e2be8bd8f..9edb7031b9 100644 --- a/openair1/PHY/phy_vars.h +++ b/openair1/PHY/phy_vars.h @@ -25,7 +25,6 @@ #include "PHY/types.h" #include "PHY/defs_eNB.h" #include "PHY/defs_UE.h" -#include "common/ran_context.h" char* namepointer_chMag ; char fmageren_name2[512]; @@ -33,17 +32,15 @@ char* namepointer_log2; #include "PHY/LTE_REFSIG/primary_synch.h" -int16_t *primary_synch0_time; -int16_t *primary_synch1_time; -int16_t *primary_synch2_time; #include "PHY/LTE_TRANSPORT/transport_vars.h" #include "PHY/MODULATION/modulation_vars.h" +#include "nfapi/oai_integration/vendor_ext.h" + PHY_VARS_UE ***PHY_vars_UE_g; -RAN_CONTEXT_t RC; UL_RCC_IND_t UL_RCC_INFO; unsigned short rev[2048],rev_times4[8192],rev_half[1024]; diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h index e90c2641aa..469a5c4754 100644 --- a/openair1/PHY/phy_vars_ue.h +++ b/openair1/PHY/phy_vars_ue.h @@ -33,9 +33,6 @@ char *namepointer_log2; #include "PHY/LTE_REFSIG/primary_synch.h" -int16_t *primary_synch0_time; -int16_t *primary_synch1_time; -int16_t *primary_synch2_time; PHY_VARS_UE ***PHY_vars_UE_g; diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index 3f342802b4..ecfec02193 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -32,11 +32,15 @@ #include "PHY/defs_eNB.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" +#include "PHY/LTE_TRANSPORT/transport_extern.h" #include "SCHED/sched_eNB.h" #include "nfapi/oai_integration/vendor_ext.h" #include "nfapi_pnf_interface.h" #include "fapi_l1.h" +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req); int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req); int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req); @@ -209,13 +213,13 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE); - if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ) { + if( (UE_id<0) || (UE_id>=NUMBER_OF_DLSCH_MAX) ) { LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rel8->rnti,UE_id); return; } //AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); - //AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); + //AssertFatal(UE_id= %d(NUMBER_OF_DLSCHMAX)\n",UE_id,NUMBER_OF_DLSCH_MAX); dlsch0 = eNB->dlsch[UE_id][0]; dlsch1 = eNB->dlsch[UE_id][1]; @@ -291,7 +295,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro if ((rel13->pdsch_payload_type <2) && (rel13->ue_type>0)) { // this is a BR/CE UE and SIB1-BR/SI-BR UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE); AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); - AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); + AssertFatal(UE_id= %d(NUMBER_OF_DLSCH_MAX)\n",UE_id,NUMBER_OF_DLSCH_MAX); dlsch0 = eNB->dlsch[UE_id][0]; dlsch0->harq_mask = 1; dlsch0_harq = dlsch0->harq_processes[0]; @@ -366,7 +370,7 @@ void handle_nfapi_dlsch_pdu(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_pro } else { UE_id = find_dlsch(rel8->rnti,eNB,SEARCH_EXIST_OR_FREE); AssertFatal(UE_id!=-1,"no free or exiting dlsch_context\n"); - AssertFatal(UE_id= %d(NUMBER_OF_UE_MAX)\n",UE_id,NUMBER_OF_UE_MAX); + AssertFatal(UE_id= %d(NUMBER_OF_DLSCH_MAX)\n",UE_id,NUMBER_OF_DLSCH_MAX); dlsch0 = eNB->dlsch[UE_id][0]; dlsch1 = eNB->dlsch[UE_id][1]; dlsch0->sib1_br_flag=0; @@ -596,7 +600,7 @@ void handle_uci_sr_pdu(PHY_VARS_eNB *eNB, uci->frame = frame; uci->subframe = subframe; uci->rnti = ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti; - uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE); + uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE); uci->type = SR; uci->pucch_fmt = pucch_format1; uci->num_antenna_ports = 1; @@ -622,7 +626,7 @@ void handle_uci_sr_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_ uci->frame = frame; uci->subframe = subframe; uci->rnti = ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti; - uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE); + uci->ue_id = find_ulsch(ul_config_pdu->uci_sr_harq_pdu.ue_information.ue_information_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE); uci->type = HARQ_SR; uci->num_antenna_ports = 1; uci->num_pucch_resources = 1; @@ -660,7 +664,7 @@ void handle_srs_pdu(PHY_VARS_eNB *eNB,nfapi_ul_config_request_pdu_t *ul_config_p if (NFAPI_MODE==NFAPI_MODE_VNF) return; - for (i=0; isoundingrs_ul_config_dedicated[i].active==1) continue; eNB->soundingrs_ul_config_dedicated[i].active = 1; @@ -676,7 +680,7 @@ void handle_srs_pdu(PHY_VARS_eNB *eNB,nfapi_ul_config_request_pdu_t *ul_config_p break; } - AssertFatal(imodule_id; @@ -780,7 +785,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) { nfapi_dl_config_request_pdu_t *dl_config_pdu; nfapi_hi_dci0_request_pdu_t *hi_dci0_req_pdu; nfapi_ul_config_request_pdu_t *ul_config_pdu; - int i; + eNB->pdcch_vars[subframe&1].num_pdcch_symbols = number_pdcch_ofdm_symbols; eNB->pdcch_vars[subframe&1].num_dci = 0; eNB->phich_vars[subframe&1].num_hi = 0; @@ -811,8 +816,8 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) { // clear DCI allocation maps for new subframe if (NFAPI_MODE!=NFAPI_MODE_VNF) - for (i=0; iulsch[i]) { + for (int i=0; iulsch[i]!=NULL) { ulsch_harq = eNB->ulsch[i]->harq_processes[harq_pid]; ulsch_harq->dci_alloc=0; ulsch_harq->rar_alloc=0; @@ -820,7 +825,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) { } } - for (i=0; idl_config_request_body.dl_config_pdu_list[i]; //LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_config_pdu->pdu_type); @@ -969,7 +974,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) { } if (NFAPI_MODE!=NFAPI_MODE_VNF) - for (i=0; ihi_dci0_request_body.hi_dci0_pdu_list[i]; LOG_D(PHY,"NFAPI: hi_dci0_pdu %d : type %d\n",i,hi_dci0_req_pdu->pdu_type); @@ -993,7 +998,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) { if (NFAPI_MODE!=NFAPI_MONOLITHIC) { if (number_ul_pdu>0) { uint8_t ulsch_pdu_num = 0; - for (i=0; iul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) || (UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE) || (UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE) || @@ -1020,7 +1025,7 @@ void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc) { } } } else { - for (i=0; iul_config_request_body.ul_config_pdu_list[i]; LOG_D(PHY,"NFAPI: ul_pdu %d : type %d\n",i,ul_config_pdu->pdu_type); AssertFatal(ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE || diff --git a/openair1/SCHED/fapi_l1.h b/openair1/SCHED/fapi_l1.h index 6b9121e17f..b8f0ae1dd8 100644 --- a/openair1/SCHED/fapi_l1.h +++ b/openair1/SCHED/fapi_l1.h @@ -31,8 +31,6 @@ */ #include "PHY/defs_eNB.h" -#include "PHY/defs_gNB.h" -#include "PHY/phy_extern.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" #include "SCHED/sched_eNB.h" #include "SCHED/sched_common.h" @@ -82,4 +80,4 @@ void handle_uci_harq_pdu(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_request_pdu void handle_srs_pdu(PHY_VARS_eNB *eNB,nfapi_ul_config_request_pdu_t *ul_config_pdu,uint16_t frame,uint8_t subframe); -void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc); +void schedule_response(Sched_Rsp_t *Sched_INFO, void *proc); diff --git a/openair1/SCHED/phy_procedures_lte_common.c b/openair1/SCHED/phy_procedures_lte_common.c index 0b592b9c55..7033c52701 100644 --- a/openair1/SCHED/phy_procedures_lte_common.c +++ b/openair1/SCHED/phy_procedures_lte_common.c @@ -1085,73 +1085,3 @@ void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeri } } - -// uint8_t eNB_id,uint8_t harq_pid, uint8_t UE_id, -int16_t estimate_ue_tx_power(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs) -{ - - /// The payload + CRC size in bits, "B" - uint32_t B; - /// Number of code segments - uint32_t C; - /// Number of "small" code segments - uint32_t Cminus; - /// Number of "large" code segments - uint32_t Cplus; - /// Number of bits in "small" code segments (<6144) - uint32_t Kminus; - /// Number of bits in "large" code segments (<6144) - uint32_t Kplus; - /// Total number of bits across all segments - uint32_t sumKr; - /// Number of "Filler" bits - uint32_t F; - // num resource elements - uint32_t num_re=0.0; - // num symbols - uint32_t num_symb=0.0; - /// effective spectral efficiency of the PUSCH - uint32_t MPR_x100=0; - /// beta_offset - uint16_t beta_offset_pusch_x8=8; - /// delta mcs - float delta_mcs=0.0; - /// bandwidth factor - float bw_factor=0.0; - - B= tbs+24; - lte_segmentation(NULL, - NULL, - B, - &C, - &Cplus, - &Cminus, - &Kplus, - &Kminus, - &F); - - - sumKr = Cminus*Kminus + Cplus*Kplus; - num_symb = 12-(ncp<<1)-(use_srs==0?0:1); - num_re = num_symb * nb_rb * 12; - - if (num_re == 0) - return(0); - - MPR_x100 = 100*sumKr/num_re; - - if (control_only == 1 ) - beta_offset_pusch_x8=8; // fixme - - //(beta_offset_pusch_x8=ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ? ue->ulsch[eNB_id]->beta_offset_cqi_times8:8; - - // if deltamcs_enabledm - delta_mcs = ((hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_x10((beta_offset_pusch_x8)>>3))/100.0); - bw_factor = (hundred_times_log10_NPRB[nb_rb-1]/100.0); -#ifdef DEBUG_SEGMENTATION - printf("estimated ue tx power %d (num_re %d, sumKr %d, mpr_x100 %d, delta_mcs %f, bw_factor %f)\n", - (int16_t)ceil(delta_mcs + bw_factor), num_re, sumKr, MPR_x100, delta_mcs, bw_factor); -#endif - return (int16_t)ceil(delta_mcs + bw_factor); - -} diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 38307a7b9e..f40f760f45 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -40,6 +40,7 @@ #include "common/utils/LOG/log.h" #include #include "common/utils/LOG/vcd_signal_dumper.h" +#include #include "assertions.h" #include "msc.h" @@ -51,22 +52,25 @@ #define MBMS_NFAPI_SCHEDULER +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + nfapi_ue_release_request_body_t release_rntis; -int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t harq_pid, uint8_t bw_factor) { +int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t ULSCH_id,uint8_t harq_pid, uint8_t bw_factor) { uint32_t Nre,sumKr,MPR_x100,Kr,r; uint16_t beta_offset_pusch; - DevAssert( UE_id < NUMBER_OF_UE_MAX+1 ); + DevAssert( ULSCH_id < NUMBER_OF_ULSCH_MAX+1 ); DevAssert( harq_pid < 8 ); - Nre = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Nsymb_initial * - eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12; + Nre = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->Nsymb_initial * + eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->nb_rb*12; sumKr = 0; - for (r=0; rulsch[UE_id]->harq_processes[harq_pid]->C; r++) { - if (rulsch[UE_id]->harq_processes[harq_pid]->Cminus) - Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kminus; + for (r=0; rulsch[ULSCH_id]->harq_processes[harq_pid]->C; r++) { + if (rulsch[ULSCH_id]->harq_processes[harq_pid]->Cminus) + Kr = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->Kminus; else - Kr = eNB->ulsch[UE_id]->harq_processes[harq_pid]->Kplus; + Kr = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->Kplus; sumKr += Kr; } @@ -79,14 +83,14 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t // FK 20140908 sumKr is only set after the ulsch_encoding beta_offset_pusch = 8; //(eNB->ulsch[UE_id]->harq_processes[harq_pid]->control_only == 1) ? eNB->ulsch[UE_id]->beta_offset_cqi_times8:8; - DevAssert( UE_id < NUMBER_OF_UE_MAX ); + DevAssert( ULSCH_id < NUMBER_OF_ULSCH_MAX ); //#warning "This condition happens sometimes. Need more investigation" // navid //DevAssert( MPR_x100/6 < 100 ); if (1==1) { //eNB->ul_power_control_dedicated[UE_id].deltaMCS_Enabled == 1) { // This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch) if (bw_factor == 1) { - uint8_t nb_rb = eNB->ulsch[UE_id]->harq_processes[harq_pid]->nb_rb; + uint8_t nb_rb = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->nb_rb; return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_x10((beta_offset_pusch)>>3)) + hundred_times_log10_NPRB[nb_rb-1]; } else return(hundred_times_delta_TF[MPR_x100/6]+10*dB_fixed_x10((beta_offset_pusch)>>3)); @@ -97,21 +101,21 @@ int16_t get_hundred_times_delta_IF_eNB(PHY_VARS_eNB *eNB,uint16_t UE_id,uint8_t int16_t get_hundred_times_delta_IF_mac(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid) { - int8_t UE_id; + int8_t ULSCH_id; if ((RC.eNB == NULL) || (module_idP > RC.nb_inst) || (CC_id > RC.nb_CC[module_idP])) { LOG_E(PHY,"get_UE_stats: No eNB found (or not allocated) for Mod_id %d,CC_id %d\n",module_idP,CC_id); return -1; } - UE_id = find_ulsch( rnti, RC.eNB[module_idP][CC_id],SEARCH_EXIST); + ULSCH_id = find_ulsch( rnti, RC.eNB[module_idP][CC_id],SEARCH_EXIST); - if (UE_id == -1) { + if (ULSCH_id == -1) { // not found return 0; } - return get_hundred_times_delta_IF_eNB( RC.eNB[module_idP][CC_id], UE_id, harq_pid, 0 ); + return get_hundred_times_delta_IF_eNB( RC.eNB[module_idP][CC_id], ULSCH_id, harq_pid, 0 ); } int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind); @@ -499,9 +503,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, int do_meas) { int frame=proc->frame_tx; int subframe=proc->subframe_tx; - uint32_t i,aa; uint8_t harq_pid; - int16_t UE_id=0; uint8_t num_pdcch_symbols=0; uint8_t num_dci=0; uint8_t num_mdci = 0; @@ -516,12 +518,15 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_TX+(eNB->CC_id),1); if (do_meas==1) start_meas(&eNB->phy_proc_tx); - if (do_meas==1) start_meas(&eNB->dlsch_common_and_dci); // clear the transmit data array for the current subframe - for (aa = 0; aa < fp->nb_antenna_ports_eNB; aa++) { - memset (&eNB->common_vars.txdataF[aa][subframe * fp->ofdm_symbol_size * (fp->symbols_per_tti)], 0, fp->ofdm_symbol_size * (fp->symbols_per_tti) * sizeof (int32_t)); + for (int aa = 0; aa < fp->nb_antenna_ports_eNB; aa++) { + if (eNB->use_DTX==0) + memcpy(&eNB->common_vars.txdataF[aa][subframe * fp->ofdm_symbol_size * (fp->symbols_per_tti)], + &eNB->subframe_mask[aa][subframe*fp->ofdm_symbol_size*fp->symbols_per_tti], + fp->ofdm_symbol_size * (fp->symbols_per_tti) * sizeof (int32_t)); + else memset(&eNB->common_vars.txdataF[aa][subframe * fp->ofdm_symbol_size * (fp->symbols_per_tti)], 0, fp->ofdm_symbol_size * (fp->symbols_per_tti) * sizeof (int32_t)); } if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) { @@ -556,7 +561,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, ul_frame = pdcch_alloc2ul_frame (fp, frame, subframe); // clear previous allocation information for all UEs - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (volatile int i = 0; i < NUMBER_OF_DLSCH_MAX; i++) { if (eNB->dlsch[i][0]) eNB->dlsch[i][0]->subframe_tx[subframe] = 0; } @@ -565,7 +570,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, //if ((ul_subframe < 10)&& // (subframe_select(fp,ul_subframe)==SF_UL)) { // This means that there is a potential UL subframe that will be scheduled here if (ul_subframe < 10) { // This means that there is a potential UL subframe that will be scheduled here - for (i=0; iulsch[i] && eNB->ulsch[i]->ue_type >0) harq_pid = 0; else @@ -651,9 +656,9 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, // Now scan UE specific DLSCH LTE_eNB_DLSCH_t *dlsch0,*dlsch1; - for (UE_id=0; UE_iddlsch[(uint8_t)UE_id][0]; - dlsch1 = eNB->dlsch[(uint8_t)UE_id][1]; + for (int DLSCH_id=0; DLSCH_iddlsch[(uint8_t)DLSCH_id][0]; + dlsch1 = eNB->dlsch[(uint8_t)DLSCH_id][1]; if ((dlsch0)&&(dlsch0->rnti>0)&& #ifdef PHY_TX_THREAD @@ -663,12 +668,13 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, #endif ) { // get harq_pid - harq_pid = dlsch0->harq_ids[frame%2][subframe]; + harq_pid = dlsch0->harq_ids[frame%2][subframe]; //AssertFatal(harq_pid>=0,"harq_pid is negative\n"); if((harq_pid < 0) || (harq_pid >= dlsch0->Mdlharq)) { + if (dlsch0->ue_type==0) - LOG_E(PHY,"harq_pid:%d corrupt must be 0-7 UE_id:%d frame:%d subframe:%d rnti:%x [ %1d.%1d.%1d.%1d.%1d.%1d.%1d.%1d\n", harq_pid,UE_id,frame,subframe,dlsch0->rnti, + LOG_E(PHY,"harq_pid:%d corrupt must be 0-7 DLSCH_id:%d frame:%d subframe:%d rnti:%x [ %1d.%1d.%1d.%1d.%1d.%1d.%1d.%1d\n", harq_pid,DLSCH_id,frame,subframe,dlsch0->rnti, dlsch0->harq_ids[frame%2][0], dlsch0->harq_ids[frame%2][1], dlsch0->harq_ids[frame%2][2], @@ -682,7 +688,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, proc, harq_pid, dlsch0, - &eNB->UE_stats[(uint32_t)UE_id])) { + &eNB->UE_stats[(uint32_t)DLSCH_id])) { // if we generate dlsch, we must generate pdsch pdsch_procedures(eNB, proc, @@ -717,6 +723,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB, if (do_meas==1) stop_meas(&eNB->phy_proc_tx); } +/* This has to be updated with FAPI structures*/ void srs_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; @@ -728,7 +735,7 @@ void srs_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { // Do SRS processing // check if there is SRS and we have to use shortened format // TODO: check for exceptions in transmission of SRS together with ACK/NACK - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < NUMBER_OF_SRS_MAX; i++) { if (eNB->soundingrs_ul_config_dedicated[i].active == 1) { if (lte_srs_channel_estimation (fp, &eNB->common_vars, &eNB->srs_vars[i], &eNB->soundingrs_ul_config_dedicated[i], subframe, 0 /*eNB_id */ )) { LOG_E (PHY, "problem processing SRS\n"); @@ -793,7 +800,7 @@ uci_procedures(PHY_VARS_eNB *eNB, calc_pucch_1x_interference(eNB, frame, subframe, 0); - for (int i = 0; i < NUMBER_OF_UCI_VARS_MAX; i++) { + for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) { uci = &(eNB->uci_vars[i]); if ((uci->active == 1) && (uci->frame == frame) && (uci->subframe == subframe)) { @@ -850,7 +857,7 @@ uci_procedures(PHY_VARS_eNB *eNB, int pucch1_thres = (uci->ue_type == 0) ? eNB->pucch1_DTX_threshold : eNB->pucch1_DTX_threshold_emtc[0]; metric_SR = rx_pucch(eNB, uci->pucch_fmt, - uci->ue_id, + i,//uci->ue_id, uci->n_pucch_1_0_sr[0], 0, // n2_pucch uci->srs_active, // shortened format @@ -1275,7 +1282,7 @@ uci_procedures(PHY_VARS_eNB *eNB, #ifdef DEBUG_PHY_PROC LOG_D (PHY, "[eNB %d][PDSCH %x] Frame %d subframe %d ACK/NAK metric 0 %d, metric 1 %d, (%d,%d)\n", eNB->Mod_id, - eNB->dlsch[UE_id][0]->rnti, frame, subframe, metric0, metric1, pucch_b0b1[0], pucch_b0b1[1]); + eNB->dlsch[DLSCH_id][0]->rnti, frame, subframe, metric0, metric1, pucch_b0b1[0], pucch_b0b1[1]); #endif } @@ -1298,7 +1305,7 @@ uci_procedures(PHY_VARS_eNB *eNB, } } } // end if ((uci->active == 1) && (uci->frame == frame) && (uci->subframe == subframe)) { - } // end loop for (int i = 0; i < NUMBER_OF_UE_MAX; i++) { + } // end loop for (int i = 0; i < NUMBER_OF_UCI_MAX; i++) { } void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req) { @@ -1325,7 +1332,7 @@ void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req) { int nb=abortTpool(proc->threadPool, req->key); nb+=abortNotifiedFIFO(proc->respDecode, req->key); proc->nbDecode-=nb; - LOG_I(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb); + LOG_D(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb); AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n", ulsch_harq->processedSegments, nb, rdata->nbSegments); ulsch_harq->processedSegments=rdata->nbSegments; @@ -1381,6 +1388,15 @@ void postDecode(L1_rxtx_proc_t *proc, notifiedFIFO_elt_t *req) { fill_rx_indication(eNB,i,rdata->frame,rdata->subframe); // indicate SDU to MAC ulsch_harq->status = SCH_IDLE; ulsch->harq_mask &= ~(1 << rdata->harq_pid); + for (int j=0;julsch_stats[j].rnti == ulsch->rnti) { + eNB->ulsch_stats[j].total_bytes_rx+=ulsch_harq->TBS; + for (int aa=0;aaframe_parms.nb_antennas_rx;aa++) { + eNB->ulsch_stats[j].ulsch_power[aa] = dB_fixed_x10(eNB->pusch_vars[rdata->UEid]->ulsch_power[aa]); + eNB->ulsch_stats[j].ulsch_noise_power[aa] = dB_fixed_x10(eNB->pusch_vars[rdata->UEid]->ulsch_noise_power[aa]); + } + break; + } T (T_ENB_PHY_ULSCH_UE_ACK, T_INT(eNB->Mod_id), T_INT(rdata->frame), T_INT(rdata->subframe), T_INT(ulsch->rnti), T_INT(rdata->harq_pid)); } // ulsch not in error @@ -1401,8 +1417,9 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { const int frame = proc->frame_rx; uint32_t harq_pid0 = subframe2harq_pid(&eNB->frame_parms,frame,subframe); - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + for (i = 0; i < NUMBER_OF_ULSCH_MAX; i++) { ulsch = eNB->ulsch[i]; + if (!ulsch) continue; if (ulsch->ue_type > 0) harq_pid = 0; else harq_pid=harq_pid0; @@ -1411,10 +1428,9 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { if (ulsch->rnti>0) LOG_D(PHY,"eNB->ulsch[%d]->harq_processes[harq_pid:%d] SFN/SF:%04d%d: PUSCH procedures, UE %d/%x ulsch_harq[status:%d SFN/SF:%04d%d handled:%d]\n", i, harq_pid, frame,subframe,i,ulsch->rnti, - ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled); + ulsch_harq->status, ulsch_harq->frame, ulsch_harq->subframe, ulsch_harq->handled); - if ((ulsch) && - (ulsch->rnti>0) && + if ((ulsch->rnti>0) && (ulsch_harq->status == ACTIVE) && ((ulsch_harq->frame == frame) || (ulsch_harq->repetition_number >1) ) && ((ulsch_harq->subframe == subframe) || (ulsch_harq->repetition_number >1) ) && @@ -1459,6 +1475,17 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { ulsch_harq->V_UL_DAI, ulsch_harq->nb_rb>20 ? 1 : 0); stop_meas(&eNB->ulsch_decoding_stats); +/* + int ulsch_id=-1; + for (ulsch_id=0;ulsch_idrnti == eNB->ulsch_stats[ulsch_id].rnti) break; + AssertFatal(ulsch_id>=0,"no ulsch_id found\n"); + + if (eNB->ulsch_stats[ulsch_id].round_trials[0]>100) { + dump_ulsch(eNB,frame,subframe,i,ulsch_harq->round); + AssertFatal(1==0,"exiting\n"); + } +*/ } else if ((ulsch) && (ulsch->rnti>0) && @@ -1472,7 +1499,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { ulsch->harq_mask &= ~(1 << harq_pid); LOG_W (PHY, "Removing stale ULSCH config for UE %x harq_pid %d (harq_mask is now 0x%2.2x)\n", ulsch->rnti, harq_pid, ulsch->harq_mask); } - } // for (i=0; inbDecode > 0) { notifiedFIFO_elt_t *req=pullTpool(proc->respDecode, proc->threadPool); @@ -1537,7 +1564,7 @@ void kill_te_thread(PHY_VARS_eNB *eNB) { } void fill_rx_indication(PHY_VARS_eNB *eNB, - int UE_id, + int ULSCH_id, int frame, int subframe) { nfapi_rx_indication_pdu_t *pdu; @@ -1545,7 +1572,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, int sync_pos; uint32_t harq_pid; - if (eNB->ulsch[UE_id]->ue_type > 0) harq_pid = 0; + if (eNB->ulsch[ULSCH_id]->ue_type > 0) harq_pid = 0; else { harq_pid = subframe2harq_pid (&eNB->frame_parms, frame, subframe); @@ -1555,19 +1582,22 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, eNB->UL_INFO.rx_ind.sfn_sf = frame<<4| subframe; eNB->UL_INFO.rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG; pdu = &eNB->UL_INFO.rx_ind.rx_indication_body.rx_pdu_list[eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus]; - // pdu->rx_ue_information.handle = eNB->ulsch[UE_id]->handle; + // pdu->rx_ue_information.handle = eNB->ulsch[ULSCH_id]->handle; pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; - pdu->rx_ue_information.rnti = eNB->ulsch[UE_id]->rnti; + pdu->rx_ue_information.rnti = eNB->ulsch[ULSCH_id]->rnti; pdu->rx_indication_rel8.tl.tag = NFAPI_RX_INDICATION_REL8_TAG; - pdu->rx_indication_rel8.length = eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS>>3; + pdu->rx_indication_rel8.length = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->TBS>>3; pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation - pdu->data = eNB->ulsch[UE_id]->harq_processes[harq_pid]->decodedBytes; + pdu->data = eNB->ulsch[ULSCH_id]->harq_processes[harq_pid]->decodedBytes; // estimate timing advance for MAC - sync_pos = lte_est_timing_advance_pusch(&eNB->frame_parms, eNB->pusch_vars[UE_id]->drs_ch_estimates_time); - timing_advance_update = sync_pos; // - eNB->frame_parms.nb_prefix_samples/4; //to check + sync_pos = lte_est_timing_advance_pusch(&eNB->frame_parms, eNB->pusch_vars[ULSCH_id]->drs_ch_estimates_time); + timing_advance_update = sync_pos; - // if (timing_advance_update > 10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);} - // if (timing_advance_update < -10) { dump_ulsch(eNB,frame,subframe,UE_id); exit(-1);} + for (int i=0;iulsch_stats[i].rnti == eNB->ulsch[ULSCH_id]->rnti) + eNB->ulsch_stats[i].timing_offset = sync_pos; + // if (timing_advance_update > 10) { dump_ulsch(eNB,frame,subframe,ULSCH_id); exit(-1);} + // if (timing_advance_update < -10) { dump_ulsch(eNB,frame,subframe,ULSCH_id); exit(-1);} switch (eNB->frame_parms.N_RB_DL) { case 6: /* nothing to do */ break; @@ -1607,7 +1637,13 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, pdu->rx_indication_rel8.timing_advance = timing_advance_update; // estimate UL_CQI for MAC - int SNRtimes10 = dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_power[0] + ((eNB->frame_parms.nb_antennas_rx>1) ?eNB->pusch_vars[UE_id]->ulsch_power[1] : 0 ) ) - dB_fixed_x10(eNB->pusch_vars[UE_id]->ulsch_interference_power[0]+((eNB->frame_parms.nb_antennas_rx>1) ?eNB->pusch_vars[UE_id]->ulsch_interference_power[1] : 0 ) ); + int total_power=0, avg_noise_power=0; + for (int i=0;iframe_parms.nb_antennas_rx;i++) { + total_power+=(eNB->pusch_vars[ULSCH_id]->ulsch_power[i]); + avg_noise_power+=(eNB->pusch_vars[ULSCH_id]->ulsch_noise_power[i])/eNB->frame_parms.nb_antennas_rx; + } + int SNRtimes10 = dB_fixed_x10(total_power) - + dB_fixed_x10(avg_noise_power); if (SNRtimes10 < -640) pdu->rx_indication_rel8.ul_cqi = 0; @@ -1616,9 +1652,11 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, else pdu->rx_indication_rel8.ul_cqi = (640 + SNRtimes10) / 5; - LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d,%d), timing_advance %d (update %d)\n", - harq_pid,frame,subframe,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,eNB->measurements.n0_subband_power_avg_dB,pdu->rx_indication_rel8.timing_advance, - timing_advance_update); + LOG_D(PHY,"[PUSCH %d] Frame %d Subframe %d Filling RX_indication with SNR %d (%d,%d,%d), timing_advance %d (update %d,sync_pos %d)\n", + harq_pid,frame,subframe,SNRtimes10,pdu->rx_indication_rel8.ul_cqi,dB_fixed_x10(total_power),dB_fixed_x10(avg_noise_power),pdu->rx_indication_rel8.timing_advance,timing_advance_update,sync_pos); + for (int i=0;iframe_parms.nb_antennas_rx;i++) + LOG_D(PHY,"antenna %d: ulsch_power %d, noise_power %d\n",i,dB_fixed_x10(eNB->pusch_vars[ULSCH_id]->ulsch_power[i]),dB_fixed_x10(eNB->pusch_vars[ULSCH_id]->ulsch_noise_power[i])); + eNB->UL_INFO.rx_ind.rx_indication_body.number_of_pdus++; eNB->UL_INFO.rx_ind.sfn_sf = frame<<4 | subframe; pthread_mutex_unlock(&eNB->UL_INFO_mutex); @@ -1629,7 +1667,7 @@ void fill_rx_indication(PHY_VARS_eNB *eNB, * Release the harq process if its round is >= 'after_rounds' */ static void do_release_harq(PHY_VARS_eNB *eNB, - int UE_id, + int DLSCH_id, int tb, uint16_t frame, uint8_t subframe, @@ -1644,10 +1682,10 @@ static void do_release_harq(PHY_VARS_eNB *eNB, int harq_pid; int subframe_tx; int frame_tx; - AssertFatal(UE_id != -1, "No existing dlsch context\n"); - AssertFatal(UE_id < NUMBER_OF_UE_MAX, "Returned UE_id %d >= %d (NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX); - dlsch0 = eNB->dlsch[UE_id][0]; - dlsch1 = eNB->dlsch[UE_id][1]; + AssertFatal(DLSCH_id != -1, "No existing dlsch context\n"); + AssertFatal(DLSCH_id < NUMBER_OF_DLSCH_MAX, "Returned DLSCH_id %d >= %d (NUMBER_OF_DLSCH_MAX)\n", DLSCH_id, NUMBER_OF_DLSCH_MAX); + dlsch0 = eNB->dlsch[DLSCH_id][0]; + dlsch1 = eNB->dlsch[DLSCH_id][1]; if (eNB->frame_parms.frame_type == FDD) { subframe_tx = (subframe + 6) % 10; @@ -1746,13 +1784,13 @@ static void do_release_harq(PHY_VARS_eNB *eNB, } // end if TDD } -static void release_harq(PHY_VARS_eNB *eNB,int UE_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask, int is_ack) { +static void release_harq(PHY_VARS_eNB *eNB,int DLSCH_id,int tb,uint16_t frame,uint8_t subframe,uint16_t mask, int is_ack) { /* * Maximum number of DL transmissions = 4. * TODO: get the value from configuration. * If is_ack is true then we release immediately. The value -1 can be used for that. */ - do_release_harq(eNB, UE_id, tb, frame, subframe, mask, is_ack ? -1 : 4); + do_release_harq(eNB, DLSCH_id, tb, frame, subframe, mask, is_ack ? -1 : 4); } int getM(PHY_VARS_eNB *eNB,int frame,int subframe) { @@ -1832,14 +1870,14 @@ void fill_ulsch_cqi_indication (PHY_VARS_eNB *eNB, uint16_t frame, uint8_t subfr } void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_harq, uint16_t rnti, int frame, int subframe, int bundling) { - int UE_id = find_dlsch(rnti,eNB,SEARCH_EXIST); + int DLSCH_id = find_dlsch(rnti,eNB,SEARCH_EXIST); - if( (UE_id<0) || (UE_id>=NUMBER_OF_UE_MAX) ) { - LOG_E(PHY,"illegal UE_id found!!! rnti %04x UE_id %d\n",rnti,UE_id); + if( (DLSCH_id<0) || (DLSCH_id>=NUMBER_OF_DLSCH_MAX) ) { + LOG_E(PHY,"illegal DLSCH_id found!!! rnti %04x DLSCH_id %d\n",rnti,DLSCH_id); return; } - //AssertFatal(UE_id>=0,"UE_id doesn't exist\n"); + //AssertFatal(DLSCH_id>=0,"DLSCH_id doesn't exist\n"); pthread_mutex_lock(&eNB->UL_INFO_mutex); nfapi_harq_indication_pdu_t *pdu = &eNB->UL_INFO.harq_ind.harq_indication_body.harq_pdu_list[eNB->UL_INFO.harq_ind.harq_indication_body.number_of_harqs]; int M; @@ -1861,7 +1899,7 @@ void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_har AssertFatal (ulsch_harq->o_ACK[i] == 0 || ulsch_harq->o_ACK[i] == 1, "harq_ack[%d] is %d, should be 1,2 or 4\n", i, ulsch_harq->o_ACK[i]); pdu->harq_indication_fdd_rel13.harq_tb_n[i] = 2 - ulsch_harq->o_ACK[i]; // release DLSCH if needed - release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); + release_harq(eNB,DLSCH_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); } } else { // TDD M = ul_ACK_subframe2_M (&eNB->frame_parms, subframe); @@ -1877,14 +1915,14 @@ void fill_ulsch_harq_indication (PHY_VARS_eNB *eNB, LTE_UL_eNB_HARQ_t *ulsch_har * We have to release the proper HARQ in case of ACK or NACK if max retransmission reached. * Basically, call release_harq with 1 as last argument when ACK and 0 when NACK. */ - release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); + release_harq(eNB,DLSCH_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); - if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,0,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); - else if (M==1 && ulsch_harq->O_ACK==2 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,UE_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); + if (M==1 && ulsch_harq->O_ACK==1 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); + else if (M==1 && ulsch_harq->O_ACK==2 && ulsch_harq->o_ACK[i] == 1) release_harq(eNB,DLSCH_id,i,frame,subframe,0xffff, ulsch_harq->o_ACK[i] == 1); else if (M>1 && ulsch_harq->o_ACK[i] == 1) { // spatial bundling - release_harq(eNB,UE_id,0,frame,subframe,1<o_ACK[i] == 1); - release_harq(eNB,UE_id,1,frame,subframe,1<o_ACK[i] == 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,1<o_ACK[i] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,1<o_ACK[i] == 1); } } } @@ -1900,10 +1938,10 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in return; } - int UE_id=find_dlsch(uci->rnti,eNB,SEARCH_EXIST); + int DLSCH_id=find_dlsch(uci->rnti,eNB,SEARCH_EXIST); - //AssertFatal(UE_id>=0,"UE_id doesn't exist rnti:%x\n", uci->rnti); - if (UE_id < 0) { + //AssertFatal(DLSCH_id>=0,"DLSCH_id doesn't exist rnti:%x\n", uci->rnti); + if (DLSCH_id < 0) { LOG_E(PHY,"SFN/SF:%04d%d Unable to find rnti:%x do not send HARQ\n", frame, subframe, uci->rnti); return; } @@ -1943,7 +1981,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in AssertFatal (harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n", harq_ack[0]); pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; // release DLSCH if needed - release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); } else if (uci->pucch_fmt == pucch_format1b) { pdu->harq_indication_fdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_FDD_REL13_TAG; pdu->harq_indication_fdd_rel13.mode = 0; @@ -1953,8 +1991,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in pdu->harq_indication_fdd_rel13.harq_tb_n[0] = harq_ack[0]; pdu->harq_indication_fdd_rel13.harq_tb_n[1] = harq_ack[1]; // release DLSCH if needed - release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); - release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); } else AssertFatal(1==0,"only format 1a/b for now, received %d\n",uci->pucch_fmt); } else { // TDD AssertFatal (tdd_mapping_mode == 0 || tdd_mapping_mode == 1 || tdd_mapping_mode == 2, "Illegal tdd_mapping_mode %d\n", tdd_mapping_mode); @@ -1972,7 +2010,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; // release all bundled DLSCH if needed - release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); } else if (uci->pucch_fmt == pucch_format1b) { pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2; AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[1] == 4, "harq_ack[0] is %d, should be 0,1 or 4\n",harq_ack[0]); @@ -1981,8 +2019,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = harq_ack[0]; pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = harq_ack[1]; // release all DLSCH if needed - release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); - release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); } break; @@ -1996,7 +2034,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in AssertFatal(harq_ack[0] == 1 || harq_ack[0] == 2 || harq_ack[0] == 4, "harq_ack[0] is %d, should be 1,2 or 4\n",harq_ack[0]); pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; // release all DLSCH if needed - release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); } else if (uci->num_pucch_resources == 1 && uci->pucch_fmt == pucch_format1b) { pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; pdu->harq_indication_tdd_rel13.number_of_ack_nack = 2; @@ -2005,8 +2043,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in pdu->harq_indication_tdd_rel13.harq_data[0].multiplex.value_0 = harq_ack[0]; pdu->harq_indication_tdd_rel13.harq_data[1].multiplex.value_0 = harq_ack[1]; // release all DLSCH if needed - release_harq(eNB,UE_id,0,frame,subframe,0xffff, harq_ack[0] == 1); - release_harq(eNB,UE_id,1,frame,subframe,0xffff, harq_ack[1] == 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, harq_ack[0] == 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, harq_ack[1] == 1); } else { // num_pucch_resources (M) > 1 pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; pdu->harq_indication_tdd_rel13.number_of_ack_nack = uci->num_pucch_resources; @@ -2018,8 +2056,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in if (uci->num_pucch_resources == 4) pdu->harq_indication_tdd_rel13.harq_data[3].multiplex.value_0 = harq_ack[3]; // spatial-bundling in this case so release both HARQ if necessary - release_harq(eNB,UE_id,0,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */); - release_harq(eNB,UE_id,1,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */); + release_harq(eNB,DLSCH_id,0,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */); + release_harq(eNB,DLSCH_id,1,frame,subframe,tdd_multiplexing_mask, 1 /* force release? previous code was unconditional */); } break; @@ -2043,8 +2081,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in if (uci->num_pucch_resources == 1 || uci->num_pucch_resources == 4 || tdd_config5_sf2scheds == 1 || tdd_config5_sf2scheds == 4 || tdd_config5_sf2scheds == 7) { pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1; - release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1); - release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, 1); } else { pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0; } @@ -2055,8 +2093,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in if (uci->num_pucch_resources == 2 || tdd_config5_sf2scheds == 2 || tdd_config5_sf2scheds == 5 || tdd_config5_sf2scheds == 8) { pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1; - release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1); - release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, 1); } else { pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0; } @@ -2067,8 +2105,8 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in if (uci->num_pucch_resources == 3 || tdd_config5_sf2scheds == 3 || tdd_config5_sf2scheds == 6 || tdd_config5_sf2scheds == 9) { pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1; - release_harq(eNB,UE_id,0,frame,subframe,0xffff, 1); - release_harq(eNB,UE_id,1,frame,subframe,0xffff, 1); + release_harq(eNB,DLSCH_id,0,frame,subframe,0xffff, 1); + release_harq(eNB,DLSCH_id,1,frame,subframe,0xffff, 1); } else { pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 0; } @@ -2085,7 +2123,7 @@ void fill_uci_harq_indication (int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, in pthread_mutex_unlock(&eNB->UL_INFO_mutex); } -void fill_crc_indication (PHY_VARS_eNB *eNB, int UE_id, int frame, int subframe, uint8_t crc_flag) { +void fill_crc_indication (PHY_VARS_eNB *eNB, int ULSCH_id, int frame, int subframe, uint8_t crc_flag) { pthread_mutex_lock(&eNB->UL_INFO_mutex); nfapi_crc_indication_pdu_t *pdu = &eNB->UL_INFO.crc_ind.crc_indication_body.crc_pdu_list[eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs]; eNB->UL_INFO.crc_ind.sfn_sf = frame<<4 | subframe; @@ -2094,7 +2132,7 @@ void fill_crc_indication (PHY_VARS_eNB *eNB, int UE_id, int frame, int subframe, pdu->instance_length = 0; // don't know what to do with this // pdu->rx_ue_information.handle = handle; pdu->rx_ue_information.tl.tag = NFAPI_RX_UE_INFORMATION_TAG; - pdu->rx_ue_information.rnti = eNB->ulsch[UE_id]->rnti; + pdu->rx_ue_information.rnti = eNB->ulsch[ULSCH_id]->rnti; pdu->crc_indication_rel8.tl.tag = NFAPI_CRC_INDICATION_REL8_TAG; pdu->crc_indication_rel8.crc_flag = crc_flag; eNB->UL_INFO.crc_ind.crc_indication_body.number_of_crcs++; @@ -2133,20 +2171,24 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) { } lte_eNB_I0_measurements (eNB, subframe, 0, eNB->first_run_I0_measurements); - int min_I0=1000,max_I0=0; - int amin=0,amax=0; - if ((frame==0) && (subframe==3)) { - for (int i=0; iframe_parms.N_RB_UL; i++) { - if (i==(eNB->frame_parms.N_RB_UL>>1) - 1) i+=2; - if (eNB->measurements.n0_subband_power_tot_dB[i]measurements.n0_subband_power_tot_dB[i]; amin=i;} - - if (eNB->measurements.n0_subband_power_tot_dB[i]>max_I0) {max_I0 = eNB->measurements.n0_subband_power_tot_dB[i]; amax=i;} - } - - LOG_I (PHY, "max_I0 %d (rb %d), min_I0 %d (rb %d), avg I0 %d\n", max_I0, amax, min_I0, amin, eNB->measurements.n0_subband_power_avg_dB); + // clear unused statistics after 2 seconds + for (int i=0;iulsch_stats[i].frame <= frame) { + if ((eNB->ulsch_stats[i].frame + 200) < frame) memset(&eNB->ulsch_stats[i],0,sizeof(eNB->ulsch_stats[i])); + } + else { + if (eNB->ulsch_stats[i].frame + 200 < (frame+1024)) memset(&eNB->ulsch_stats[i],0,sizeof(eNB->ulsch_stats[i])); + } + if (eNB->uci_stats[i].frame <= frame) { + if ((eNB->uci_stats[i].frame + 200) < frame) memset(&eNB->uci_stats[i],0,sizeof(eNB->uci_stats[i])); + } + else { + if (eNB->uci_stats[i].frame + 200 < (frame+1024)) memset(&eNB->uci_stats[i],0,sizeof(eNB->uci_stats[i])); + } } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC, 0 ); } @@ -2163,13 +2205,7 @@ void release_rnti_of_phy(module_id_t mod_id) { eNB_PHY = RC.eNB[mod_id][CC_id]; rnti = release_rntis.ue_release_request_TLVs_list[i].rnti; - for (j=0; julsch[j]; - - if((ulsch != NULL) && (ulsch->rnti == rnti)) { - LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti); - clean_eNb_ulsch(ulsch); - } + for (j=0; jdlsch[j][0]; @@ -2179,14 +2215,18 @@ void release_rnti_of_phy(module_id_t mod_id) { } } - ulsch = eNB_PHY->ulsch[j]; + for (j=0;julsch[j]; - if((ulsch != NULL) && (ulsch->rnti == rnti)) { - LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti); - clean_eNb_ulsch(ulsch); + if((ulsch != NULL) && (ulsch->rnti == rnti)) { + LOG_I(PHY, "clean_eNb_ulsch ulsch[%d] UE %x\n", j, rnti); + clean_eNb_ulsch(ulsch); + for (j=0;julsch_stats[j].rnti == rnti) {eNB_PHY->ulsch_stats[j].rnti=0; break;} + } } - for(j=0; juci_vars[j].rnti == rnti) { LOG_I(PHY, "clean eNb uci_vars[%d] UE %x \n",j, rnti); memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI)); diff --git a/openair1/SCHED/prach_procedures.c b/openair1/SCHED/prach_procedures.c index b99bb2ee7d..4d0fe428e8 100644 --- a/openair1/SCHED/prach_procedures.c +++ b/openair1/SCHED/prach_procedures.c @@ -31,8 +31,6 @@ */ #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" -#include "SCHED/sched_eNB.h" #include "nfapi_interface.h" #include "fapi_l1.h" #include "nfapi_pnf.h" @@ -46,7 +44,6 @@ #include -#include "intertask_interface.h" extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind); @@ -188,7 +185,7 @@ void prach_procedures(PHY_VARS_eNB *eNB, else { eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((avg_preamble_energy[0]*124)>>10); - if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10); + if (frame==0) LOG_D(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10); if (eNB->prach_energy_counter < 100) eNB->prach_energy_counter++; } diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index 70399f0a23..15eba7b5bc 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -54,7 +54,6 @@ #include "PHY/defs_eNB.h" -#include "PHY/phy_extern.h" #include "SCHED/sched_eNB.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/LTE_TRANSPORT/if4_tools.h" @@ -140,27 +139,26 @@ void feptx0(RU_t *ru, int num_symb = 7; if (subframe_select(fp,subframe) == SF_S) - num_symb = fp->dl_symbols_in_S_subframe+1; + num_symb = fp->dl_symbols_in_S_subframe+1; - if (ru->generate_dmrs_sync == 1 && slot == 0 && subframe == 1 && aa==0) { + if (ru->generate_dmrs_sync == 1 && slot == 2 && aa==0) { //int32_t dmrs[ru->frame_parms.ofdm_symbol_size*14] __attribute__((aligned(32))); //int32_t *dmrsp[2] ={dmrs,NULL}; //{&dmrs[(3-ru->frame_parms.Ncp)*ru->frame_parms.ofdm_symbol_size],NULL}; - - generate_drs_pusch((PHY_VARS_UE *)NULL, - (UE_rxtx_proc_t*)NULL, - fp, - ru->common.txdataF_BF, - 0, - AMP, - 0, - 0, - fp->N_RB_DL, - aa); + generate_drs_pusch((PHY_VARS_UE *)NULL, + (UE_rxtx_proc_t*)NULL, + fp, + ru->common.txdataF_BF, + 0, + AMP, + 0, + 0, + fp->N_RB_DL, + aa); } - normal_prefix_mod(&ru->common.txdataF_BF[aa][(slot&1)*slot_sizeF], - (int*)&ru->common.txdata[aa][slot_offset], - num_symb, - fp); + normal_prefix_mod(&ru->common.txdataF_BF[aa][(slot&1)*slot_sizeF], + (int*)&ru->common.txdata[aa][slot_offset], + num_symb, + fp); } } @@ -474,15 +472,16 @@ void feptx_prec(RU_t *ru, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+ru->idx , 1); for (aa=0;aanb_tx;aa++) { - memset(ru->common.txdataF_BF[aa],0,sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti); - for (int p=0;pdo_precoding == 0) { - if (p==0) - memcpy((void*)ru->common.txdataF_BF[aa], - (void*)&eNB->common_vars.txdataF[aa][subframe*fp->symbols_per_tti*fp->ofdm_symbol_size], - sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti); - } else { - if (pnb_antenna_ports_eNB) { + if (ru->do_precoding == 0) { + memcpy((void*)ru->common.txdataF_BF[aa], + (void*)&eNB->common_vars.txdataF[aa%fp->nb_antenna_ports_eNB][subframe*fp->symbols_per_tti*fp->ofdm_symbol_size], + sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti); + + } + else { + memset(ru->common.txdataF_BF[aa],0,sizeof(int32_t)*fp->ofdm_symbol_size*fp->symbols_per_tti); + for (int p=0;pnb_antenna_ports_eNB) { // For the moment this does nothing different than below, except ignore antenna ports 5,7,8. for (l=0;lnum_pdcch_symbols;l++) beam_precoding(eNB->common_vars.txdataF, @@ -494,10 +493,10 @@ void feptx_prec(RU_t *ru, aa, p, eNB->Mod_id); - } //if (pnb_antenna_ports_eNB) + } //if (pnb_antenna_ports_eNB) // PDSCH region - if (pnb_antenna_ports_eNB || p==5 || p==7 || p==8) { + if (pnb_antenna_ports_eNB || p==5 || p==7 || p==8) { for (l=pdcch_vars->num_pdcch_symbols;lsymbols_per_tti;l++) { beam_precoding(eNB->common_vars.txdataF, ru->common.txdataF_BF, @@ -510,8 +509,8 @@ void feptx_prec(RU_t *ru, eNB->Mod_id); } // for (l=pdcch_vars ....) } // if (pnb_antenna_ports_eNB) ... - } // ru->do_precoding!=0 - } // for (p=0...) + } // for (p=0...) + } // if do_precoding } // for (aa=0 ...) if(ru->idx<2) @@ -658,7 +657,7 @@ void ru_fep_full_2thread(RU_t *ru, struct timespec wait; - if ((fp->frame_type == TDD) && (subframe_select(fp,subframe) != SF_UL)) return; + if ((fp->frame_type == TDD) && (subframe_select(fp,subframe) == SF_DL)) return; if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 ); @@ -705,7 +704,7 @@ void ru_fep_full_2thread(RU_t *ru, if (proc->tti_rx/*proc->subframe_rx*/==1 && ru->is_slave==1/* && ru->state == RU_CHECK_SYNC*/) { - //LOG_I(PHY,"Running check synchronization procedure for frame %d\n", proc->frame_rx); + LOG_I(PHY,"Running check synchronization procedure for frame %d\n", proc->frame_rx); ulsch_extract_rbs_single(ru->common.rxdataF, calibration->rxdataF_ext, 0, @@ -731,9 +730,10 @@ void ru_fep_full_2thread(RU_t *ru, check_sync_pos = lte_est_timing_advance_pusch(ru->frame_parms, ru->calibration.drs_ch_estimates_time); if (ru->state == RU_CHECK_SYNC) { if ((check_sync_pos >= 0 && check_sync_pos<8) || (check_sync_pos < 0 && check_sync_pos>-8)) { - LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check); +// LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check); ru->wait_check++; } + LOG_I(PHY,"~~~~~~~~~~~ check_sync_pos %d, frame %d, cnt %d\n",check_sync_pos,proc->frame_rx,ru->wait_check); if (ru->wait_check==20) { ru->state = RU_RUN; @@ -743,10 +743,11 @@ void ru_fep_full_2thread(RU_t *ru, rru_config_msg.len = sizeof(RRU_CONFIG_msg_t); // TODO: set to correct msg len LOG_I(PHY,"Sending RRU_sync_ok to RAU\n"); AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RAU %d\n",ru->idx); +/* //LOG_I(PHY,"~~~~~~~~~ RU_RUN\n"); - /*LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], (fp->ofdm_symbol_size),1,1); + LOG_M("dmrs_time.m","dmrstime",calibration->drs_ch_estimates_time[0], (fp->ofdm_symbol_size),1,1); LOG_M("rxdataF_ext.m","rxdataFext",&calibration->rxdataF_ext[0][36*fp->N_RB_DL], 12*(fp->N_RB_DL),1,1); - LOG_M("drs_seq0.m","drsseq0",ul_ref_sigs_rx[0][0][23],600,1,1); + //LOG_M("drs_seq0.m","drsseq0",ul_ref_sigs_rx[0][0][23],600,1,1); LOG_M("rxdata.m","rxdata",&ru->common.rxdata[0][0], fp->samples_per_tti*2,1,1); exit(-1);*/ } diff --git a/openair1/SCHED/sched_common.h b/openair1/SCHED/sched_common.h index f3e43d516e..c9fc338686 100644 --- a/openair1/SCHED/sched_common.h +++ b/openair1/SCHED/sched_common.h @@ -311,7 +311,7 @@ void get_cqipmiri_params(PHY_VARS_UE *ue,uint8_t eNB_id); int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id, uint8_t eNB_index); -void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc); +void schedule_response(Sched_Rsp_t *Sched_INFO, void *proc); LTE_eNB_UE_stats* get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti); diff --git a/openair1/SCHED/sched_eNB.h b/openair1/SCHED/sched_eNB.h index f04bec2e5c..de987b0ac7 100644 --- a/openair1/SCHED/sched_eNB.h +++ b/openair1/SCHED/sched_eNB.h @@ -193,7 +193,7 @@ int8_t find_ue_ulsch(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB); -void schedule_response(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc); +void schedule_response(Sched_Rsp_t *Sched_INFO, void *proc); LTE_eNB_UE_stats *get_UE_stats(uint8_t Mod_id, uint8_t CC_id,uint16_t rnti); diff --git a/openair1/SCHED_NR/fapi_nr_l1.c b/openair1/SCHED_NR/fapi_nr_l1.c index 5909db8bea..3b9573bcbc 100644 --- a/openair1/SCHED_NR/fapi_nr_l1.c +++ b/openair1/SCHED_NR/fapi_nr_l1.c @@ -50,8 +50,15 @@ void handle_nr_nfapi_ssb_pdu(PHY_VARS_gNB *gNB,int frame,int slot, AssertFatal(dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag== 1, "bchPayloadFlat %d != 1\n", dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag); - LOG_D(PHY,"%d.%d : pbch_pdu: %x\n",frame,slot,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload); - memcpy((void*)&gNB->ssb_pdu,&dl_tti_pdu->ssb_pdu,sizeof(dl_tti_pdu->ssb_pdu)); + uint8_t i_ssb = dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex; + + LOG_D(PHY,"%d.%d : ssb index %d pbch_pdu: %x\n",frame,slot,i_ssb,dl_tti_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload); + if (gNB->ssb[i_ssb].active) + AssertFatal(1==0,"SSB PDU with index %d already active\n",i_ssb); + else { + gNB->ssb[i_ssb].active = true; + memcpy((void*)&gNB->ssb[i_ssb].ssb_pdu,&dl_tti_pdu->ssb_pdu,sizeof(dl_tti_pdu->ssb_pdu)); + } } /*void handle_nr_nfapi_pdsch_pdu(PHY_VARS_gNB *gNB,int frame,int subframe,gNB_L1_rxtx_proc_t *proc, @@ -160,19 +167,16 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ int pdcch_received=0; gNB->num_pdsch_rnti[slot]=0; - for (int i=0; inumber_of_nr_dlsch_max; i++) { gNB->dlsch[i][0]->rnti=0; gNB->dlsch[i][0]->harq_mask=0; } - gNB->pbch_configured=0; - for (int i=0;idl_tti_request_body.dl_tti_pdu_list[i]; LOG_D(PHY,"NFAPI: dl_pdu %d : type %d\n",i,dl_tti_pdu->PDUType); switch (dl_tti_pdu->PDUType) { case NFAPI_NR_DL_TTI_SSB_PDU_TYPE: - gNB->pbch_configured=1; if(NFAPI_MODE != NFAPI_MODE_VNF) handle_nr_nfapi_ssb_pdu(gNB,frame,slot, @@ -261,4 +265,4 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ } -} \ No newline at end of file +} diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 9a71f96815..c8042ecec3 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -31,15 +31,12 @@ */ #include "PHY/defs_gNB.h" -#include "PHY/phy_extern.h" #include "sched_nr.h" #include "PHY/MODULATION/modulation_common.h" #include "PHY/MODULATION/nr_modulation.h" #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/LTE_TRANSPORT/if5_tools.h" -#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h" -#include "LAYER2/MAC/mac.h" #include "common/utils/LOG/log.h" #include "common/utils/system.h" #include "common/utils/LOG/vcd_signal_dumper.h" @@ -208,6 +205,7 @@ void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx) { memcpy((void*)&ru->common.txdataF[i][j*fp->ofdm_symbol_size], (void*)&gNB->common_vars.txdataF[i][j*fp->ofdm_symbol_size + txdataF_offset], fp->ofdm_symbol_size*sizeof(int32_t)); + } }//num_gNB == 1 @@ -279,13 +277,12 @@ static void *nr_feptx_thread(void *param) { RU_feptx_t *feptx = (RU_feptx_t *)param; RU_t *ru; - int aa, slot, start, l, nb_antenna_ports, ret; + int aa, slot, start, l, ret; int i; int32_t ***bw; NR_DL_FRAME_PARMS *fp; int ofdm_mask_full; int txdataF_offset; - int32_t *txdataF; while (!oai_exit) { ret = 0; if (wait_on_condition(&feptx->mutex_feptx,&feptx->cond_feptx,&feptx->instance_cnt_feptx,"NR feptx thread")<0) break; @@ -299,31 +296,39 @@ static void *nr_feptx_thread(void *param) { l = feptx->symbol; fp = ru->nr_frame_parms; start = feptx->symbol; - nb_antenna_ports = feptx->nb_antenna_ports; ofdm_mask_full = (1<<(ru->nb_tx*2))-1; if(ru->num_gNB != 0){ txdataF_offset = ((slot%2)*fp->samples_per_slot_wCP); ////////////precoding//////////// VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->index+1 , 1); + start_meas(&ru->precoding_stats); + + for(i=0; inb_log_antennas; ++i) { + memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot+l], + (void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot+l], + (fp->symbols_per_slot>>1)*sizeof(uint8_t)); + } + + if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { - memcpy((void*)&ru->common.txdataF_BF[0][l*fp->ofdm_symbol_size], - (void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset + l*fp->ofdm_symbol_size], - (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); + memcpy((void*)&ru->common.txdataF_BF[0][l*fp->ofdm_symbol_size], + (void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset + l*fp->ofdm_symbol_size], + (fp->samples_per_slot_wCP>>1)*sizeof(int32_t)); } else { bw = ru->beam_weights[0]; - txdataF = &ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset]; for(i=0; isymbols_per_slot>>1; ++i){ - nr_beam_precoding(&txdataF, + nr_beam_precoding(ru->gNB_list[0]->common_vars.txdataF, ru->common.txdataF_BF, fp, bw, slot, l+i, aa, - nb_antenna_ports); + ru->nb_log_antennas, + txdataF_offset);//here } } stop_meas(&ru->precoding_stats); @@ -362,7 +367,8 @@ static void *nr_feptx_thread(void *param) { slot, l, aa, - nb_antenna_ports); + ru->nb_log_antennas, + 0); } stop_meas(&ru->precoding_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->index+1 , 0); @@ -459,10 +465,14 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { if (nr_slot_select(cfg,frame_tx,slot_tx) == NR_UPLINK_SLOT) return; - for(i=0; inb_log_antennas; ++i) + for(i=0; inb_log_antennas; ++i) { memcpy((void*)ru->common.txdataF[i], (void*)&gNB->common_vars.txdataF[i][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t)); + memcpy((void*)&ru->common.beam_id[i][slot_tx*fp->symbols_per_slot], + (void*)&gNB->common_vars.beam_id[i][slot_tx*fp->symbols_per_slot], + fp->symbols_per_slot*sizeof(uint8_t)); + } if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { @@ -485,7 +495,8 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { tti_tx, l, aa, - ru->nb_log_antennas); + ru->nb_log_antennas, + 0); }// for (aa=0;aanb_tx;aa++) }// for (l=0;lsymbols_per_slot;l++) }// if (ru->nb_tx == 1) diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c index d3b8c77eed..4c255e52aa 100644 --- a/openair1/SCHED_NR/phy_frame_config_nr.c +++ b/openair1/SCHED_NR/phy_frame_config_nr.c @@ -41,7 +41,7 @@ * * OUTPUT: table of uplink symbol for each slot for 2 frames * -* RETURN : 0 if tdd has been properly configurated +* RETURN : nb_periods_per_frame if tdd has been properly configurated * -1 tdd configuration can not be done * * DESCRIPTION : generate bit map for uplink symbol for each slot for several frames @@ -179,7 +179,7 @@ int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg, LOG_E(PHY,"set_tdd_configuration_nr: additionnal tdd configuration 2 is not supported for tdd configuration \n"); return (-1); }*/ - return (0); + return (nb_periods_per_frame); } /******************************************************************* diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 2617c4686e..2d3aec5137 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -67,74 +67,63 @@ void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME LOG_D(PHY, "SSB first subcarrier %d (%d,%d)\n", fp->ssb_start_subcarrier,cfg->ssb_table.ssb_offset_point_a.value,sco); } -void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { +void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu) { NR_DL_FRAME_PARMS *fp=&gNB->frame_parms; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; int **txdataF = gNB->common_vars.txdataF; uint8_t ssb_index, n_hf; - uint16_t ssb_start_symbol, rel_slot; + uint16_t ssb_start_symbol; int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; uint16_t slots_per_hf = (fp->slots_per_frame)>>1; - n_hf = fp->half_frame_bit; + if (slotssb_table.ssb_period.value == 0) { - if (slotsymbols_per_slot; // start symbol wrt slot + + nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier + + LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); + nr_generate_pss(gNB->d_pss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + + if (cfg->carrier_config.num_tx_ant.value <= 4) + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + else + nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); + + if (T_ACTIVE(T_GNB_PHY_MIB)) { + unsigned char bch[3]; + bch[0] = ssb_pdu.ssb_pdu_rel15.bchPayload & 0xff; + bch[1] = (ssb_pdu.ssb_pdu_rel15.bchPayload >> 8) & 0xff; + bch[2] = (ssb_pdu.ssb_pdu_rel15.bchPayload >> 16) & 0xff; + T(T_GNB_PHY_MIB, T_INT(0) /* module ID */, T_INT(frame), T_INT(slot), T_BUFFER(bch, 3)); } - // to set a effective slot number in the half frame where the SSB is supposed to be - rel_slot = (n_hf)? (slot-slots_per_hf) : slot; - - LOG_D(PHY,"common_signal_procedures: frame %d, slot %d\n",frame,slot); - - if(rel_slot<38 && rel_slot>=0) { // there is no SSB beyond slot 37 - - for (int i=0; i<2; i++) { // max two SSB per frame - - ssb_index = i + SSB_Table[rel_slot]; // computing the ssb_index - - if ((ssb_index<64) && ((fp->L_ssb >> (63-ssb_index)) & 0x01)) { // generating the ssb only if the bit of L_ssb at current ssb index is 1 - fp->ssb_index = ssb_index; - int ssb_start_symbol_abs = nr_get_ssb_start_symbol(fp); // computing the starting symbol for current ssb - ssb_start_symbol = ssb_start_symbol_abs % fp->symbols_per_slot; // start symbol wrt slot - - nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier - - LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); - nr_generate_pss(gNB->d_pss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - nr_generate_sss(gNB->d_sss, &txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - - if (cfg->carrier_config.num_tx_ant.value <= 4) - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - else - nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); - - if (T_ACTIVE(T_GNB_PHY_MIB)) { - unsigned char bch[3]; - bch[0] = gNB->ssb_pdu.ssb_pdu_rel15.bchPayload & 0xff; - bch[1] = (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload >> 8) & 0xff; - bch[2] = (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload >> 16) & 0xff; - T(T_GNB_PHY_MIB, T_INT(0) /* module ID */, T_INT(frame), T_INT(slot), T_BUFFER(bch, 3)); - } - - nr_generate_pbch(&gNB->pbch, - &gNB->ssb_pdu, - gNB->nr_pbch_interleaver, - &txdataF[0][txdataF_offset], - AMP, - ssb_start_symbol, - n_hf, frame, cfg, fp); - - } - } + // Beam_id is currently used only for FR2 + if (fp->freq_range==nr_FR2){ + LOG_D(PHY,"slot %d, ssb_index %d, beam %d\n",slot,ssb_index,cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value); + for (int j=0;jsymbols_per_slot;j++) + gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot+j] = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value; } + + nr_generate_pbch(&gNB->pbch, + &ssb_pdu, + gNB->nr_pbch_interleaver, + &txdataF[0][txdataF_offset], + AMP, + ssb_start_symbol, + n_hf, frame, cfg, fp); } + void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, int frame,int slot, int do_meas) { @@ -142,11 +131,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, NR_DL_FRAME_PARMS *fp=&gNB->frame_parms; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; int offset = gNB->CC_id; - uint8_t ssb_frame_periodicity = 1; // every how many frames SSB are generated int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP; - - if (cfg->ssb_table.ssb_period.value > 1) - ssb_frame_periodicity = 1 <<(cfg->ssb_table.ssb_period.value -1) ; if ((cfg->cell_config.frame_duplex_type.value == TDD) && (nr_slot_select(cfg,frame,slot) == NR_UPLINK_SLOT)) return; @@ -155,15 +140,20 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, if (do_meas==1) start_meas(&gNB->phy_proc_tx); - // clear the transmit data array for the current subframe + // clear the transmit data array and beam index for the current slot for (aa=0; aacarrier_config.num_tx_ant.value; aa++) { memset(&gNB->common_vars.txdataF[aa][txdataF_offset],0,fp->samples_per_slot_wCP*sizeof(int32_t)); + memset(&gNB->common_vars.beam_id[aa][slot*fp->symbols_per_slot],255,fp->symbols_per_slot*sizeof(uint8_t)); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1); if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_PNF) { - if ((!(frame%ssb_frame_periodicity))) // generate SSB only for given frames according to SSB periodicity - nr_common_signal_procedures(gNB,frame, slot); + for (int i=0; iLmax; i++) { + if (gNB->ssb[i].active) { + nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[i].ssb_pdu); + gNB->ssb[i].active = false; + } + } } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,0); @@ -204,10 +194,14 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,0); } + if (do_meas==1) stop_meas(&gNB->phy_proc_tx); + if ((frame&127) == 0) dump_pdsch_stats(gNB); //apply the OFDM symbol rotation here - apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[0][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14,fp->ofdm_symbol_size); + for (aa=0; aacarrier_config.num_tx_ant.value; aa++) { + apply_nr_rotation(fp,(int16_t*) &gNB->common_vars.txdataF[aa][txdataF_offset],slot,0,fp->Ncp==EXTENDED?12:14,fp->ofdm_symbol_size); + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX+offset,0); } @@ -454,7 +448,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { (pucch->frame == frame_rx) && (pucch->slot == slot_rx) ) { gNB->ulmask_symb = symbol; - nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch[i].pucch_pdu; + nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu; if ((symbol>=pucch_pdu->start_symbol_index) && (symbol<(pucch_pdu->start_symbol_index + pucch_pdu->nr_of_symbols))){ for (rb=0; rbprb_size; rb++) { @@ -466,7 +460,7 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { } } } - for (int ULSCH_id=0;ULSCH_idnumber_of_nr_ulsch_max;ULSCH_id++) { NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; int harq_pid; NR_UL_gNB_HARQ_t *ulsch_harq; @@ -529,7 +523,7 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) } -void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { +int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { /* those variables to log T_GNB_PHY_PUCCH_PUSCH_IQ only when we try to decode */ int pucch_decode_done = 0; int pusch_decode_done = 0; @@ -548,6 +542,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) int power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset],12*18); LOG_D(PHY,"frame %d, slot %d: UL signal energy %d\n",frame_rx,slot_rx,power_rxF); + start_meas(&gNB->phy_proc_rx); + for (int i=0;ipucch[i]; if (pucch) { @@ -571,6 +567,10 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_0_1_t); nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1; + offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12); + power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset],12); + LOG_D(PHY,"frame %d, slot %d: PUCCH signal energy %d\n",frame_rx,slot_rx,power_rxF); + nr_decode_pucch0(gNB, slot_rx, uci_pdu_format0, @@ -603,7 +603,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) } } - for (int ULSCH_id=0;ULSCH_idnumber_of_nr_ulsch_max;ULSCH_id++) { NR_gNB_ULSCH_t *ulsch = gNB->ulsch[ULSCH_id][0]; int harq_pid; int no_sig; @@ -652,19 +652,15 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) pusch_decode_done = 1; - uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index; - uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,1); - start_meas(&gNB->rx_pusch_stats); - for(uint8_t symbol = symbol_start; symbol < symbol_end; symbol++) { - no_sig = nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, symbol, harq_pid); - if (no_sig) { - LOG_I(PHY, "PUSCH not detected in symbol %d\n",symbol); - nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1); - return; - } - } - stop_meas(&gNB->rx_pusch_stats); + start_meas(&gNB->rx_pusch_stats); + no_sig = nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, harq_pid); + if (no_sig) { + LOG_I(PHY, "PUSCH not detected in frame %d, slot %d\n", frame_rx, slot_rx); + nr_fill_indication(gNB, frame_rx, slot_rx, ULSCH_id, harq_pid, 1); + return 1; + } + stop_meas(&gNB->rx_pusch_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH,0); //LOG_M("rxdataF_comp.m","rxF_comp",gNB->pusch_vars[0]->rxdataF_comp[0],6900,1,1); //LOG_M("rxdataF_ext.m","rxF_ext",gNB->pusch_vars[0]->rxdataF_ext[0],6900,1,1); @@ -676,12 +672,21 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) } } } + stop_meas(&gNB->phy_proc_rx); // figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS - if ((frame_rx&127) == 0 && slot_rx==19) dump_pusch_stats(gNB); + if ((frame_rx&127) == 0 && slot_rx==19) { + dump_pusch_stats(gNB); + LOG_I(PHY, "Number of bad PUCCH received: %lu\n", gNB->bad_pucch); + } + + if (pucch_decode_done || pusch_decode_done) { + T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4)); + } if (pucch_decode_done || pusch_decode_done) { T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4)); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,0); + return 0; } diff --git a/openair1/SCHED_NR/sched_nr.h b/openair1/SCHED_NR/sched_nr.h index 24885f1bb4..5e31c08d38 100644 --- a/openair1/SCHED_NR/sched_nr.h +++ b/openair1/SCHED_NR/sched_nr.h @@ -38,9 +38,9 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx); void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME_PARMS *fp); void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, int frame_tx, int slot_tx, int do_meas); void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx); -void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx); +int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx); void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot); -void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot); +void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu); void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx); void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx); void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa); diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index f7f44a520d..2675e46a04 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -115,14 +115,17 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t @param proc Pointer to proc information @param gNB_id Local id of eNB on which to act @param dlsch_parallel use multithreaded dlsch processing + @param txFifo Result fifo if PDSCH is run in parallel */ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, - uint8_t dlsch_parallel); + uint8_t dlsch_parallel, + notifiedFIFO_t *txFifo); int phy_procedures_slot_parallelization_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t eNB_id, uint8_t abstraction_flag, uint8_t do_pdcch_flag, relaying_type_t r_type); +void processSlotTX(void *arg); #ifdef UE_SLOT_PARALLELISATION void *UE_thread_slot1_dl_processing(void *arg); diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index bdbfae58e3..56efbdbad4 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -84,6 +84,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ } else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH){ dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_ra[0]; + dlsch0->rnti_type = _RA_RNTI_; + dlsch0->harq_processes[dlsch0->current_harq_pid]->status = ACTIVE; } else if (dl_config->dl_config_list[i].pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH){ dlsch0 = PHY_vars_UE_g[module_id][cc_id]->dlsch_SI[0]; @@ -126,6 +128,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ // dlsch0_harq->status not ACTIVE may be due to false retransmission. Reset the // following flag to skip PDSCH procedures in that case. dlsch0->active = 0; + dlsch0_harq->harq_ack.ack = 1; + dlsch0_harq->harq_ack.send_harq_status = 1; } dlsch0_harq->harq_ack.vDAI_DL = dlsch_config_pdu->dai; /* PTRS */ diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 14c174c2c0..ba81d9b205 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -142,7 +142,7 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, case FAPI_NR_RX_PDU_TYPE_MIB: rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.pdu = ue->pbch_vars[gNB_id]->decoded_output; rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.additional_bits = ue->pbch_vars[gNB_id]->xtra_byte; - rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_index = frame_parms->ssb_index; + rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_index = (frame_parms->ssb_index)&0x7; rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_length = frame_parms->Lmax; rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.cell_id = frame_parms->Nid_cell; break; @@ -234,7 +234,7 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){ ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling; - LOG_I(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n", + LOG_D(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n", __FUNCTION__, ue->Mod_id, frame_tx, @@ -275,26 +275,8 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, nr_ue_ulsch_procedures(ue, harq_pid, frame_tx, slot_tx, proc->thread_id, gNB_id); } - if (get_softmodem_params()->usim_test==0) { - LOG_D(PHY, "Generating PUCCH\n"); - pucch_procedures_ue_nr(ue, - gNB_id, - proc, - FALSE); - } - - LOG_D(PHY, "Sending Uplink data \n"); - nr_ue_pusch_common_procedures(ue, - slot_tx, - &ue->frame_parms,1); - } - if (ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) { - nr_ue_prach_procedures(ue, proc, gNB_id); - } - LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); #if UE_TIMING_TRACE stop_meas(&ue->phy_proc_tx); @@ -368,7 +350,7 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PBCH_PROCEDURES, VCD_FUNCTION_IN); - LOG_D(PHY,"[UE %d] Frame %d, Trying PBCH (NidCell %d, gNB_id %d)\n",ue->Mod_id,frame_rx,ue->frame_parms.Nid_cell,gNB_id); + LOG_D(PHY,"[UE %d] Frame %d Slot %d, Trying PBCH (NidCell %d, gNB_id %d)\n",ue->Mod_id,frame_rx,nr_slot_rx,ue->frame_parms.Nid_cell,gNB_id); ret = nr_rx_pbch(ue, proc, ue->pbch_vars[gNB_id], @@ -435,8 +417,13 @@ void nr_ue_pbch_procedures(uint8_t gNB_id, ue->pbch_vars[gNB_id]->pdu_errors++; if (ue->pbch_vars[gNB_id]->pdu_errors_conseq>=100) { - LOG_E(PHY,"More that 100 consecutive PBCH errors! Exiting!\n"); - exit_fun("More that 100 consecutive PBCH errors! Exiting!\n"); + if (get_softmodem_params()->non_stop) { + LOG_E(PHY,"More that 100 consecutive PBCH errors! Going back to Sync mode!\n"); + ue->lost_sync = 1; + } else { + LOG_E(PHY,"More that 100 consecutive PBCH errors! Exiting!\n"); + exit_fun("More that 100 consecutive PBCH errors! Exiting!\n"); + } } } @@ -771,15 +758,17 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ uint16_t pdsch_nb_rb = dlsch0_harq->nb_rb; uint16_t s0 = dlsch0_harq->start_symbol; uint16_t s1 = dlsch0_harq->nb_symbols; + bool is_SI = dlsch0->rnti_type == _SI_RNTI_; LOG_D(PHY,"[UE %d] PDSCH type %d active in nr_slot_rx %d, harq_pid %d (%d), rb_start %d, nb_rb %d, symbol_start %d, nb_symbols %d, DMRS mask %x\n",ue->Mod_id,pdsch,nr_slot_rx,harq_pid,dlsch0->harq_processes[harq_pid]->status,pdsch_start_rb,pdsch_nb_rb,s0,s1,dlsch0->harq_processes[harq_pid]->dlDmrsSymbPos); for (m = s0; m < (s0 +s1); m++) { if (((1<harq_processes[harq_pid]->dlDmrsSymbPos) > 0) { - for (uint8_t aatx=0; aatx<1; aatx++) {//for MIMO Config: it shall loop over no_layers + for (uint8_t aatx=0; aatxharq_processes[harq_pid]->Nl; aatx++) {//for MIMO Config: it shall loop over no_layers nr_pdsch_channel_estimation(ue, proc, 0 /*eNB_id*/, + is_SI, nr_slot_rx, aatx /*p*/, m, @@ -831,43 +820,24 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ slot = 1; start_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]); #endif - // process DLSCH received in first slot - // skip DMRS symbols (will have to check later if PDSCH/DMRS are multiplexed - if (((1<harq_processes[harq_pid]->dlDmrsSymbPos) == 0) { + // process DLSCH received symbols in the slot + // symbol by symbol processing (if data/DMRS are multiplexed is checked inside the function) + if (pdsch == PDSCH || pdsch == SI_PDSCH || pdsch == RA_PDSCH) { if (nr_rx_pdsch(ue, - proc, - pdsch, - eNB_id, - eNB_id_i, - frame_rx, - nr_slot_rx, - m, - first_symbol_flag, - dual_stream_UE, - i_mod, - dlsch0->current_harq_pid) < 0) - return -1; - } - else { // This is to adjust the llr offset in the case of skipping over a dmrs symbol (i.e. in case of no PDSCH REs in DMRS) - if (pdsch == RA_PDSCH) ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]=ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m-1]; - else if (pdsch == PDSCH || pdsch == SI_PDSCH) { - if (nr_rx_pdsch(ue, - proc, - pdsch, - eNB_id, - eNB_id_i, - frame_rx, - nr_slot_rx, - m, - first_symbol_flag, - dual_stream_UE, - i_mod, - dlsch0->current_harq_pid) < 0) - return -1; - } - else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); - } - if (pdsch == PDSCH) LOG_D(PHY,"Done processing symbol %d : llr_offset %d\n",m,ue->pdsch_vars[proc->thread_id][eNB_id]->llr_offset[m]); + proc, + pdsch, + eNB_id, + eNB_id_i, + frame_rx, + nr_slot_rx, + m, + first_symbol_flag, + dual_stream_UE, + i_mod, + dlsch0->current_harq_pid) < 0) + return -1; + } else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n"); + #if UE_TIMING_TRACE stop_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]); #if DISABLE_LOG_X @@ -877,10 +847,9 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int eNB_ #endif #endif - if(first_symbol_flag) - { - proc->first_symbol_available = 1; - } + if(first_symbol_flag) { + proc->first_symbol_available = 1; + } } // CRNTI active } return 0; @@ -901,7 +870,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, int harq_pid = dlsch0->current_harq_pid; int frame_rx = proc->frame_rx; int nr_slot_rx = proc->nr_slot_rx; - int ret=0, ret1=0; + uint32_t ret = UINT32_MAX, ret1 = UINT32_MAX; NR_UE_PDSCH *pdsch_vars; uint16_t dmrs_len = get_num_dmrs(dlsch0->harq_processes[dlsch0->current_harq_pid]->dlDmrsSymbPos); nr_downlink_indication_t dl_indication; @@ -1154,7 +1123,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS); } - LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ \n", frame_rx, nr_slot_rx); + LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ decoded in %d \n", frame_rx, nr_slot_rx, ret); LOG_D(PHY, "harq_pid: %d, TBS expected dlsch0: %d \n",harq_pid, dlsch0->harq_processes[harq_pid]->TBS); if(retmax_ldpc_iterations+1){ @@ -1633,7 +1602,8 @@ int is_pbch_in_slot(fapi_nr_config_request_t *config, int frame, int slot, NR_DL int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t gNB_id, - uint8_t dlsch_parallel + uint8_t dlsch_parallel, + notifiedFIFO_t *txFifo ) { int frame_rx = proc->frame_rx; @@ -1667,6 +1637,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // looking for pbch only in slot where it is supposed to be if (slot_ssb) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_IN); LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); for (int i=1; i<4; i++) { @@ -1704,25 +1675,25 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, LOG_D(PHY, "Doing N0 measurements in %s\n", __FUNCTION__); nr_ue_rrc_measurements(ue, proc, nr_slot_rx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_OUT); } } if ((frame_rx%64 == 0) && (nr_slot_rx==0)) { - printf("============================================\n"); + LOG_I(PHY,"============================================\n"); LOG_I(PHY,"Harq round stats for Downlink: %d/%d/%d/%d DLSCH errors: %d\n",ue->dl_stats[0],ue->dl_stats[1],ue->dl_stats[2],ue->dl_stats[3],ue->dl_stats[4]); - printf("============================================\n"); + LOG_I(PHY,"============================================\n"); } #ifdef NR_PDCCH_SCHED - nr_gold_pdcch(ue, 0, 2); LOG_D(PHY," ------ --> PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_IN); for (uint16_t l=0; lofdm_demod_stats); #endif - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_IN); nr_slot_fep(ue, proc, l, @@ -1744,7 +1715,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, coreset_nb_rb); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); #if UE_TIMING_TRACE stop_meas(&ue->ofdm_demod_stats); #endif @@ -1752,6 +1722,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc); } } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_OUT); if (dci_cnt > 0) { @@ -1767,32 +1738,35 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, } if (dlsch) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH, VCD_FUNCTION_IN); uint8_t harq_pid = dlsch->current_harq_pid; NR_DL_UE_HARQ_t *dlsch0_harq = dlsch->harq_processes[harq_pid]; uint16_t nb_symb_sch = dlsch0_harq->nb_symbols; uint16_t start_symb_sch = dlsch0_harq->start_symbol; - int symb_dmrs = -1; LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); //to update from pdsch config - for (int i=0;i<4;i++) if (((1<dlDmrsSymbPos) > 0) {symb_dmrs=i;break;} - AssertFatal(symb_dmrs>=0,"no dmrs in 0..3\n"); - LOG_D(PHY,"Initializing dmrs for slot %d DMRS mask %x\n", nr_slot_rx, dlsch0_harq->dlDmrsSymbPos); - nr_gold_pdsch(ue, nr_slot_rx, 0); - for (uint16_t m=start_symb_sch;m<(nb_symb_sch+start_symb_sch) ; m++){ nr_slot_fep(ue, proc, m, //to be updated from higher layer nr_slot_rx); } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH, VCD_FUNCTION_OUT); } } else { LOG_D(PHY,"[UE %d] Frame %d, nr_slot_rx %d: No DCIs found\n", ue->Mod_id, frame_rx, nr_slot_rx); } #endif //NR_PDCCH_SCHED + + // Start PUSCH processing here. It runs in parallel with PDSCH processing + notifiedFIFO_elt_t *newElt = newNotifiedFIFO_elt(sizeof(nr_rxtx_thread_data_t), proc->nr_slot_tx,txFifo,processSlotTX); + nr_rxtx_thread_data_t *curMsg=(nr_rxtx_thread_data_t *)NotifiedFifoData(newElt); + curMsg->proc = *proc; + curMsg->UE = ue; + pushTpool(&(get_nrUE_params()->Tpool), newElt); #if UE_TIMING_TRACE start_meas(&ue->generic_stat); @@ -1800,7 +1774,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // do procedures for C-RNTI int ret_pdsch = 0; if (ue->dlsch[proc->thread_id][gNB_id][0]->active == 1) { - //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN); ret_pdsch = nr_ue_pdsch_procedures(ue, proc, gNB_id, @@ -1809,6 +1783,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, NULL); nr_ue_measurement_procedures(2, ue, proc, gNB_id, nr_slot_rx); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_OUT); } // do procedures for SI-RNTI @@ -1857,7 +1832,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, // deactivate dlsch once dlsch proc is done ue->dlsch_p[gNB_id]->active = 0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_OUT); } @@ -1925,6 +1899,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } + #if UE_TIMING_TRACE start_meas(&ue->generic_stat); #endif @@ -2091,14 +2066,14 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t } - if (nr_prach == 1) { + if (nr_prach == GENERATE_PREAMBLE) { if (ue->mac_enabled == 1) { int16_t pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id); - int16_t ra_preamble_rx_power = (int16_t)(10*log10(pow(10, (double)(prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER)/10) + pow(10, (double)(pathloss)/10))); + int16_t ra_preamble_rx_power = (int16_t)(prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER - pathloss + 30); ue->tx_power_dBm[nr_slot_tx] = min(nr_get_Pcmax(mod_id), ra_preamble_rx_power); - LOG_I(PHY,"[UE %d][RAPROC][%d.%d]: Generating PRACH Msg1 (preamble %d, PL %d, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x)\n", + LOG_I(PHY,"DEBUG [UE %d][RAPROC][%d.%d]: Generating PRACH Msg1 (preamble %d, PL %d dB, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x)\n", mod_id, frame_tx, nr_slot_tx, @@ -2137,18 +2112,15 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t if (ue->mac_enabled == 1) nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id); - } else if (nr_prach == 2) { - + } else if (nr_prach == WAIT_CONTENTION_RESOLUTION) { + LOG_D(PHY, "In %s: [UE %d] RA waiting contention resolution\n", __FUNCTION__, mod_id); + ue->UE_mode[gNB_id] = RA_WAIT_CR; + } else if (nr_prach == RA_SUCCEEDED) { LOG_D(PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id); - ue->UE_mode[gNB_id] = PUSCH; - - } else if(nr_prach == 3){ - + } else if(nr_prach == RA_FAILED){ LOG_D(PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, mod_id); - ue->UE_mode[gNB_id] = PRACH; - } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT); diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index edb070f873..0455c481d5 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -40,6 +40,7 @@ #include #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h" +#include #ifndef NO_RAT_NR @@ -54,10 +55,172 @@ #endif +/* TS 36.213 Table 9.2.3-3: Mapping of values for one HARQ-ACK bit to sequences */ +static const int sequence_cyclic_shift_1_harq_ack_bit[2] +/* HARQ-ACK Value 0 1 */ +/* Sequence cyclic shift */ = { 0, 6 } +; + +/* TS 36.213 Table 9.2.5-2: Mapping of values for two HARQ-ACK bits and positive SR to sequences */ +static const int sequence_cyclic_shift_2_harq_ack_bits_positive_sr[4] +/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ +/* Sequence cyclic shift */ = { 1, 4, 10, 7 } +; + uint8_t nr_is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id); uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id); +static const uint16_t scheduling_request_periodicity[NB_SR_PERIOD] += { 0, 0, 1, 2, 4, 5, 8, 10, 16, 20, 40, 80, 160, 320, 640 } +; + +/* TS 38.213 9.2.5.2 UE procedure for multiplexing HARQ-ACK/SR and CSI in a PUCCH */ +/* this is a counter of number of pucch format 4 per subframe */ +static int nb_pucch_format_4_in_subframes[LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] = { 0 } ; + +/* TS 36.213 Table 9.2.5.2-1: Code rate corresponding to higher layer parameter PUCCH-F2-maximum-coderate, */ +/* or PUCCH-F3-maximum-coderate, or PUCCH-F4-maximum-coderate */ +/* add one additional element set to 0 for parsing the array until this end */ +/* stored values are code rates * 100 */ +//static const int code_rate_r_time_100[8] = { (0.08 * 100), (0.15 * 100), (0.25*100), (0.35*100), (0.45*100), (0.60*100), (0.80*100), 0 } ; + +/* TS 38.213 Table 9.2.3-4: Mapping of values for two HARQ-ACK bits to sequences */ +static const int sequence_cyclic_shift_2_harq_ack_bits[4] +/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ +/* Sequence cyclic shift */ = { 0, 3, 9, 6 } +; + +/* TS 38.211 Table 6.4.1.3.3.2-1: DM-RS positions for PUCCH format 3 and 4 */ +static const int nb_symbols_excluding_dmrs[NB_SYMBOL_MINUS_FOUR][2][2] += { +/* No additional DMRS Additional DMRS */ +/* PUCCH length No hopping hopping No hopping hopping */ +/* index 0 1 0 1 */ +/* 4 */ {{ 3 , 2 } , { 3 , 2 }}, +/* 5 */ {{ 3 , 3 } , { 3 , 3 }}, +/* 6 */ {{ 4 , 4 } , { 4 , 4 }}, +/* 7 */ {{ 5 , 5 } , { 5 , 5 }}, +/* 8 */ {{ 6 , 6 } , { 6 , 6 }}, +/* 9 */ {{ 7 , 7 } , { 7 , 7 }}, +/* 10 */ {{ 8 , 8 } , { 6 , 6 }}, +/* 11 */ {{ 9 , 9 } , { 7 , 7 }}, +/* 12 */ {{ 10 , 10 } , { 8 , 8 }}, +/* 13 */ {{ 11 , 11 } , { 9 , 9 }}, +/* 14 */ {{ 12 , 12 } , { 10 , 10 }}, +} +; + + +/* TS 36.213 Table 9.2.5-1: Mapping of values for one HARQ-ACK bit and positive SR to sequences */ +static const int sequence_cyclic_shift_1_harq_ack_bit_positive_sr[2] +/* HARQ-ACK Value 0 1 */ +/* Sequence cyclic shift */ = { 3, 9 } +; + +static float RSRP_meas_mapping_nr[98] += { + -140, + -139, + -138, + -137, + -136, + -135, + -134, + -133, + -132, + -131, + -130, + -129, + -128, + -127, + -126, + -125, + -124, + -123, + -122, + -121, + -120, + -119, + -118, + -117, + -116, + -115, + -114, + -113, + -112, + -111, + -110, + -109, + -108, + -107, + -106, + -105, + -104, + -103, + -102, + -101, + -100, + -99, + -98, + -97, + -96, + -95, + -94, + -93, + -92, + -91, + -90, + -89, + -88, + -87, + -86, + -85, + -84, + -83, + -82, + -81, + -80, + -79, + -78, + -77, + -76, + -75, + -74, + -73, + -72, + -71, + -70, + -69, + -68, + -67, + -66, + -65, + -64, + -63, + -62, + -61, + -60, + -59, + -58, + -57, + -56, + -55, + -54, + -53, + -52, + -51, + -50, + -49, + -48, + -47, + -46, + -45, + -44, + -43 + } + ; + long binary_search_float_nr( float elements[], @@ -202,6 +365,30 @@ void nr_generate_pucch3_4(int32_t **txdataF, * *********************************************************************/ +/* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ +const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE] += +{ +/* format first symbol Number of symbols PRB offset nb index for set of initial CS */ +/* 0 */ { pucch_format0_nr, 12, 2, 0, 2, { 0, 3, 0, 0 } }, +/* 1 */ { pucch_format0_nr, 12, 2, 0, 3, { 0, 4, 8, 0 } }, +/* 2 */ { pucch_format0_nr, 12, 2, 3, 3, { 0, 4, 8, 0 } }, +/* 3 */ { pucch_format1_nr, 10, 4, 0, 2, { 0, 6, 0, 0 } }, +/* 4 */ { pucch_format1_nr, 10, 4, 0, 4, { 0, 3, 6, 9 } }, +/* 5 */ { pucch_format1_nr, 10, 4, 2, 4, { 0, 3, 6, 9 } }, +/* 6 */ { pucch_format1_nr, 10, 4, 4, 4, { 0, 3, 6, 9 } }, +/* 7 */ { pucch_format1_nr, 4, 10, 0, 2, { 0, 6, 0, 0 } }, +/* 8 */ { pucch_format1_nr, 4, 10, 0, 4, { 0, 3, 6, 9 } }, +/* 9 */ { pucch_format1_nr, 4, 10, 2, 4, { 0, 3, 6, 9 } }, +/* 10 */ { pucch_format1_nr, 4, 10, 4, 4, { 0, 3, 6, 9 } }, +/* 11 */ { pucch_format1_nr, 0, 14, 0, 2, { 0, 6, 0, 0 } }, +/* 12 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, +/* 13 */ { pucch_format1_nr, 0, 14, 2, 4, { 0, 3, 6, 9 } }, +/* 14 */ { pucch_format1_nr, 0, 14, 4, 4, { 0, 3, 6, 9 } }, +/* 15 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, +} +; + bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t *proc, bool reset_harq) { uint8_t sr_payload = 0; @@ -788,7 +975,7 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t LOG_E(PHY,"PUCCH Downlink DAI has an invalid value : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); } else if (harq_status->send_harq_status == 0) { - LOG_D(PHY,"PUCCH Downlink ack can not be transmitted : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); + LOG_E(PHY,"PUCCH Downlink ack can not be transmitted : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME); } else { diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h index 9b53331f50..97d8d73282 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h @@ -60,214 +60,12 @@ /************** VARIABLES *****************************************/ -float RSRP_meas_mapping_nr[98] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { - -140, - -139, - -138, - -137, - -136, - -135, - -134, - -133, - -132, - -131, - -130, - -129, - -128, - -127, - -126, - -125, - -124, - -123, - -122, - -121, - -120, - -119, - -118, - -117, - -116, - -115, - -114, - -113, - -112, - -111, - -110, - -109, - -108, - -107, - -106, - -105, - -104, - -103, - -102, - -101, - -100, - -99, - -98, - -97, - -96, - -95, - -94, - -93, - -92, - -91, - -90, - -89, - -88, - -87, - -86, - -85, - -84, - -83, - -82, - -81, - -80, - -79, - -78, - -77, - -76, - -75, - -74, - -73, - -72, - -71, - -70, - -69, - -68, - -67, - -66, - -65, - -64, - -63, - -62, - -61, - -60, - -59, - -58, - -57, - -56, - -55, - -54, - -53, - -52, - -51, - -50, - -49, - -48, - -47, - -46, - -45, - -44, - -43 - } - #endif - ; - -/* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */ -const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= -{ -/* format first symbol Number of symbols PRB offset nb index for set of initial CS */ -/* 0 */ { pucch_format0_nr, 12, 2, 0, 2, { 0, 3, 0, 0 } }, -/* 1 */ { pucch_format0_nr, 12, 2, 0, 3, { 0, 4, 8, 0 } }, -/* 2 */ { pucch_format0_nr, 12, 2, 3, 3, { 0, 4, 8, 0 } }, -/* 3 */ { pucch_format1_nr, 10, 4, 0, 2, { 0, 6, 0, 0 } }, -/* 4 */ { pucch_format1_nr, 10, 4, 0, 4, { 0, 3, 6, 9 } }, -/* 5 */ { pucch_format1_nr, 10, 4, 2, 4, { 0, 3, 6, 9 } }, -/* 6 */ { pucch_format1_nr, 10, 4, 4, 4, { 0, 3, 6, 9 } }, -/* 7 */ { pucch_format1_nr, 4, 10, 0, 2, { 0, 6, 0, 0 } }, -/* 8 */ { pucch_format1_nr, 4, 10, 0, 4, { 0, 3, 6, 9 } }, -/* 9 */ { pucch_format1_nr, 4, 10, 2, 4, { 0, 3, 6, 9 } }, -/* 10 */ { pucch_format1_nr, 4, 10, 4, 4, { 0, 3, 6, 9 } }, -/* 11 */ { pucch_format1_nr, 0, 14, 0, 2, { 0, 6, 0, 0 } }, -/* 12 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, -/* 13 */ { pucch_format1_nr, 0, 14, 2, 4, { 0, 3, 6, 9 } }, -/* 14 */ { pucch_format1_nr, 0, 14, 4, 4, { 0, 3, 6, 9 } }, -/* 15 */ { pucch_format1_nr, 0, 14, 0, 4, { 0, 3, 6, 9 } }, -} -#endif -; - -/* TS 36.213 Table 9.2.3-3: Mapping of values for one HARQ-ACK bit to sequences */ -const int sequence_cyclic_shift_1_harq_ack_bit[2] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value 0 1 */ -/* Sequence cyclic shift */ = { 0, 6 } -#endif -; - -/* TS 38.213 Table 9.2.3-4: Mapping of values for two HARQ-ACK bits to sequences */ -const int sequence_cyclic_shift_2_harq_ack_bits[4] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ -/* Sequence cyclic shift */ = { 0, 3, 9, 6 } -#endif -; - -/* TS 36.213 Table 9.2.5-1: Mapping of values for one HARQ-ACK bit and positive SR to sequences */ -const int sequence_cyclic_shift_1_harq_ack_bit_positive_sr[2] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value 0 1 */ -/* Sequence cyclic shift */ = { 3, 9 } -#endif -; - -/* TS 36.213 Table 9.2.5-2: Mapping of values for two HARQ-ACK bits and positive SR to sequences */ -const int sequence_cyclic_shift_2_harq_ack_bits_positive_sr[4] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -/* HARQ-ACK Value (0,0) (0,1) (1,0) (1,1) */ -/* Sequence cyclic shift */ = { 1, 4, 10, 7 } -#endif -; - -/* TS 36.213 Table 9.2.5.2-1: Code rate corresponding to higher layer parameter PUCCH-F2-maximum-coderate, */ -/* or PUCCH-F3-maximum-coderate, or PUCCH-F4-maximum-coderate */ -/* add one additional element set to 0 for parsing the array until this end */ -/* stored values are code rates * 100 */ -const int code_rate_r_time_100[8] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { (0.08 * 100), (0.15 * 100), (0.25*100), (0.35*100), (0.45*100), (0.60*100), (0.80*100), 0 } -#endif -; - #define NB_SYMBOL_MINUS_FOUR (11) #define I_PUCCH_NO_ADDITIONAL_DMRS (0) #define I_PUCCH_ADDITIONAL_DMRS (1) #define I_PUCCH_NO_HOPPING (0) #define I_PUCCH_HOPING (1) -/* TS 38.211 Table 6.4.1.3.3.2-1: DM-RS positions for PUCCH format 3 and 4 */ -const int nb_symbols_excluding_dmrs[NB_SYMBOL_MINUS_FOUR][2][2] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { -/* No additional DMRS Additional DMRS */ -/* PUCCH length No hopping hopping No hopping hopping */ -/* index 0 1 0 1 */ -/* 4 */ {{ 3 , 2 } , { 3 , 2 }}, -/* 5 */ {{ 3 , 3 } , { 3 , 3 }}, -/* 6 */ {{ 4 , 4 } , { 4 , 4 }}, -/* 7 */ {{ 5 , 5 } , { 5 , 5 }}, -/* 8 */ {{ 6 , 6 } , { 6 , 6 }}, -/* 9 */ {{ 7 , 7 } , { 7 , 7 }}, -/* 10 */ {{ 8 , 8 } , { 6 , 6 }}, -/* 11 */ {{ 9 , 9 } , { 7 , 7 }}, -/* 12 */ {{ 10 , 10 } , { 8 , 8 }}, -/* 13 */ {{ 11 , 11 } , { 9 , 9 }}, -/* 14 */ {{ 12 , 12 } , { 10 , 10 }}, -} -#endif -; - -/* TS 38.213 9.2.5.2 UE procedure for multiplexing HARQ-ACK/SR and CSI in a PUCCH */ -/* this is a counter of number of pucch format 4 per subframe */ -int nb_pucch_format_4_in_subframes[LTE_NUMBER_OF_SUBFRAMES_PER_FRAME] -#ifdef INIT_VARIABLES_PUCCH_UE_NR_H -= { 0 } -#endif -; /*************** FUNCTIONS ****************************************/ diff --git a/openair1/SIMULATION/LTE_PHY/common_sim.h b/openair1/SIMULATION/LTE_PHY/common_sim.h index 796a576aed..5e0be3de89 100644 --- a/openair1/SIMULATION/LTE_PHY/common_sim.h +++ b/openair1/SIMULATION/LTE_PHY/common_sim.h @@ -46,13 +46,13 @@ void sumUpStatsSlot(time_stats_t *res, time_stats_t src[RX_NB_TH][2], int lastAc } double squareRoot(time_stats_t *ptr) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); return sqrt((double)ptr->diff_square*pow(timeBase,2)/ptr->trials - pow((double)ptr->diff/ptr->trials*timeBase,2)); } void printDistribution(time_stats_t *ptr, varArray_t *sortedList, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); printf("%-43s %6.2f us (%d trials)\n", txt, (double)ptr->diff/ptr->trials*timeBase, @@ -69,7 +69,7 @@ void printStatIndent(time_stats_t *ptr, char *txt) { } void printStatIndent2(time_stats_t *ptr, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); printf(" |__ %-34s %6.2f us (%3d trials)\n", txt, ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0, @@ -77,7 +77,7 @@ void printStatIndent2(time_stats_t *ptr, char *txt) { } void printStatIndent3(time_stats_t *ptr, char *txt) { - double timeBase=1/(1000*cpu_freq_GHz); + double timeBase=1/(1000*get_cpu_freq_GHz()); printf(" |__ %-30s %6.2f us (%3d trials)\n", txt, ptr->trials?((double)ptr->diff)/ptr->trials*timeBase:0, diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 667913d377..adfda7a0c8 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -60,16 +60,19 @@ #include "dummy_functions.c" #include "executables/thread-common.h" #include "executables/split_headers.h" - +#include "common/ran_context.h" void feptx_ofdm(RU_t *ru, int frame, int subframe); void feptx_prec(RU_t *ru, int frame, int subframe); double cpuf; -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) //#define MCS_COUNT 23//added for PHY abstraction #include int otg_enabled=0; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; + /*the following parameters are used to control the processing times calculations*/ double t_tx_max = -1000000000; /*!< \brief initial max process time for tx */ double t_rx_max = -1000000000; /*!< \brief initial max process time for rx */ @@ -82,6 +85,7 @@ double DS_TDL = .03; static int cmpdouble(const void *p1, const void *p2) { return *(double *)p1 > *(double *)p2; } +RAN_CONTEXT_t RC; int emulate_rf = 0; int split73=0; @@ -933,9 +937,10 @@ int main(int argc, char **argv) { NB_RB = conv_nprb(0,DLSCH_RB_ALLOC,N_RB_DL); } else { - if (rballocset==0) NB_RB = 8; + if (rballocset==0) NB_RB = 2+TPC; else NB_RB = DLSCH_RB_ALLOC; + printf("Common PDSCH: NB_RB = %d\n",NB_RB); AssertFatal(NB_RB <= N_RB_DL,"illegal NB_RB %d\n",NB_RB); } @@ -1179,7 +1184,7 @@ int main(int argc, char **argv) { DS_TDL, forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[0]->random_channel); reset_meas(&eNB2UE[0]->interp_time); @@ -1193,7 +1198,7 @@ int main(int argc, char **argv) { DS_TDL, forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[n]->random_channel); reset_meas(&eNB2UE[n]->interp_time); } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c index a585e8efc6..3b4e6782da 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm4.c @@ -988,7 +988,7 @@ int main(int argc, char **argv) N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); if(num_rounds>1) { for(n=1; n<8; n++) @@ -999,7 +999,7 @@ int main(int argc, char **argv) N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); } if (eNB2UE[0]==NULL) { diff --git a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c index 5973f80b55..bd164150c5 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim_tm7.c @@ -834,7 +834,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); if(num_rounds>1) { for(n=1; n<4; n++) @@ -845,7 +845,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); } if (eNB2UE[0]==NULL) { diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index b1f4d933b3..78fd1a293e 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -1290,7 +1290,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[0]->random_channel); reset_meas(&eNB2UE[0]->interp_time); @@ -1303,7 +1303,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), forgetting_factor, rx_sample_offset, - 0); + 0, 0); reset_meas(&eNB2UE[n]->random_channel); reset_meas(&eNB2UE[n]->interp_time); } diff --git a/openair1/SIMULATION/LTE_PHY/pbchsim.c b/openair1/SIMULATION/LTE_PHY/pbchsim.c index 00ad03c52d..71286faafb 100644 --- a/openair1/SIMULATION/LTE_PHY/pbchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pbchsim.c @@ -386,7 +386,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 0, - 0); + 0, 0); if (interf1>-20) eNB2UE1 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx, @@ -396,7 +396,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 4, - 0); + 0, 0); if (interf2>-20) eNB2UE2 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx, @@ -406,7 +406,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 8, - 0); + 0, 0); if (eNB2UE==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c index 004eb24243..bd2c2d66b9 100644 --- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c @@ -708,7 +708,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL), 0, 0, - 0); + 0, 0); L1_rxtx_proc_t *proc_rxtx = (subframe == 0)? &eNB->proc.L1_proc: &eNB->proc.L1_proc_tx; eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,N_RB_DL,0); UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0); diff --git a/openair1/SIMULATION/LTE_PHY/prachsim.c b/openair1/SIMULATION/LTE_PHY/prachsim.c index c997aa7639..229764a893 100644 --- a/openair1/SIMULATION/LTE_PHY/prachsim.c +++ b/openair1/SIMULATION/LTE_PHY/prachsim.c @@ -343,7 +343,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL), 0.0, delay, - 0); + 0, 0); if (UE2eNB==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/pucchsim.c b/openair1/SIMULATION/LTE_PHY/pucchsim.c index 127bfcb533..083a756afb 100644 --- a/openair1/SIMULATION/LTE_PHY/pucchsim.c +++ b/openair1/SIMULATION/LTE_PHY/pucchsim.c @@ -323,7 +323,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL), 0.0, 0, - 0); + 0, 0); if (UE2eNB==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/scansim.c b/openair1/SIMULATION/LTE_PHY/scansim.c index 5ceeee7f2f..839d30a8de 100644 --- a/openair1/SIMULATION/LTE_PHY/scansim.c +++ b/openair1/SIMULATION/LTE_PHY/scansim.c @@ -335,7 +335,7 @@ int main(int argc, char **argv) { N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL), 0, 0, - 0); + 0, 0); if (eNB2UE==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/syncsim.c b/openair1/SIMULATION/LTE_PHY/syncsim.c index 80598b37e4..e8ee7d3d5e 100644 --- a/openair1/SIMULATION/LTE_PHY/syncsim.c +++ b/openair1/SIMULATION/LTE_PHY/syncsim.c @@ -724,7 +724,7 @@ int main(int argc, char **argv) { BW, 0, 0, - 0); + 0, 0); if (interf1>-20) eNB2UE1 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx, @@ -733,7 +733,7 @@ int main(int argc, char **argv) { BW, 0, 0, - 0); + 0, 0); if (interf2>-20) eNB2UE2 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx, @@ -742,7 +742,7 @@ int main(int argc, char **argv) { BW, 0, 0, - 0); + 0, 0); if (eNB2UE==NULL) { msg("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 80beee4bed..0d39e6e533 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -55,9 +55,11 @@ #include "executables/thread-common.h" #include "targets/RT/USER/lte-softmodem.h" #include "executables/split_headers.h" +#include "common/ran_context.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" double cpuf; -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) //#define MCS_COUNT 23//added for PHY abstraction #include channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX]; @@ -70,6 +72,9 @@ node_desc_t *ue_data[NUMBER_OF_UE_MAX]; extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16]; //extern char* namepointer_chMag ; int xforms=0; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; + FD_lte_phy_scope_enb *form_enb; char title[255]; @@ -84,7 +89,7 @@ static int cmpdouble(const void *p1, const void *p2) { return *(double *)p1 > *(double *)p2; } - +RAN_CONTEXT_t RC; int split73=0; void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) { AssertFatal(false, "Must not be called in this context\n"); @@ -342,7 +347,6 @@ int main(int argc, char **argv) { int UE_id = 0; static int nb_rb=25,first_rb=0,mcs=0,round=0; //unsigned char l; - static int awgn_flag = 0 ; SCM_t channel_model=Rice1; unsigned char *input_buffer=0,harq_pid; unsigned short input_buffer_length; @@ -404,7 +408,7 @@ int main(int argc, char **argv) { printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz); AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) != NULL, "Cannot load configuration module, exiting\n"); logInit(); - set_glog(OAILOG_WARNING); + set_glog(OAILOG_INFO); T_stdout = 1; // enable these lines if you need debug info // however itti will catch all signals, so ctrl-c won't work anymore @@ -734,7 +738,7 @@ int main(int argc, char **argv) { 30e-9, forgetting_factor, delay, - 0); + 0, 0); // set Doppler UE2eNB->max_Doppler = maxDoppler; @@ -1086,14 +1090,12 @@ int main(int argc, char **argv) { } } - if (awgn_flag == 0) { - if (UE2eNB->max_Doppler == 0) { - multipath_channel(UE2eNB,s_re,s_im,r_re,r_im, - eNB->frame_parms.samples_per_tti,hold_channel,0); - } else { - multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im, - 2*eNB->frame_parms.samples_per_tti,hold_channel); - } + if (UE2eNB->max_Doppler == 0) { + multipath_channel(UE2eNB,s_re,s_im,r_re,r_im, + eNB->frame_parms.samples_per_tti,hold_channel,0); + } else { + multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im, + 2*eNB->frame_parms.samples_per_tti,hold_channel); } if(abstx) { @@ -1136,6 +1138,15 @@ int main(int argc, char **argv) { sqrt(sigma2/2)*gaussdouble(0.0,1.0)); } } + if (n_frames==1) + for (i=0; iframe_parms.samples_per_tti; i++) { + for (aa=0; aaframe_parms.nb_antennas_rx; aa++) { + ((short *) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*(subframe+1)%10])[2*i] = + (short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0)); + ((short *) &ru->common.rxdata[aa][eNB->frame_parms.samples_per_tti*(subframe+1)%10])[2*i+1] = + (short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0)); + } + } if (n_frames<=10) { printf("rx_level Null symbol %f\n",10*log10((double)signal_energy((int *) @@ -1161,9 +1172,10 @@ int main(int argc, char **argv) { start_meas(&eNB->phy_proc_rx); ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? ru_fep_full_2thread : fep_full; ru->feprx(ru,subframe); + if (n_frames==1) lte_eNB_I0_measurements(eNB,(subframe+1)%10,0,1); + phy_procedures_eNB_uespec_RX(eNB,proc_rxtx); stop_meas(&eNB->phy_proc_rx); - if (cqi_flag > 0) { cqi_error = 0; @@ -1203,6 +1215,9 @@ int main(int argc, char **argv) { eNB->ulsch[0]->harq_processes[harq_pid]->uci_format,0,eNB->frame_parms.N_RB_DL); dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round); + dump_I0_stats(stdout,eNB); + dump_ulsch_stats(stdout,eNB,0); + exit(-1); } @@ -1263,14 +1278,16 @@ int main(int argc, char **argv) { if (t_rx > 2000 ) n_rx_dropped++; - appendVarArray(table_tx, &t_tx); - appendVarArray(table_tx_ifft, &t_tx_ifft); - appendVarArray(table_tx_mod, &t_tx_mod ); - appendVarArray(table_tx_enc, &t_tx_enc ); - appendVarArray(table_rx, &t_rx ); - appendVarArray(table_rx_fft, &t_rx_fft ); - appendVarArray(table_rx_demod, &t_rx_demod ); - appendVarArray(table_rx_dec, &t_rx_dec ); + if (trials < 1000) { + appendVarArray(table_tx, &t_tx); + appendVarArray(table_tx_ifft, &t_tx_ifft); + appendVarArray(table_tx_mod, &t_tx_mod ); + appendVarArray(table_tx_enc, &t_tx_enc ); + appendVarArray(table_rx, &t_rx ); + appendVarArray(table_rx_fft, &t_rx_fft ); + appendVarArray(table_rx_demod, &t_rx_demod ); + appendVarArray(table_rx_dec, &t_rx_dec ); + } } //trials // sort table @@ -1289,6 +1306,7 @@ int main(int argc, char **argv) { LOG_UDUMPMSG(SIM,dataArray(table_rx),table_rx->size,LOG_DUMP_DOUBLE,"The receiver raw data: \n"); } + dump_ulsch_stats(stdout,eNB,0); printf("\n**********rb: %d ***mcs : %d *********SNR = %f dB (%f): TX %u dB (gain %f dB), N0W %f dB, I0 %u dB, delta_IF %d [ (%d,%d) dB / (%u,%u) dB ]**************************\n", nb_rb,mcs,SNR,SNR2, tx_lev_dB, diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 00983553d8..633a214699 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -339,7 +339,7 @@ int main(int argc, char **argv) 61.44e6, //N_RB2sampling_rate(N_RB_DL), 40e6, //N_RB2channel_bandwidth(N_RB_DL), DS_TDL, - 0, 0, 0); + 0, 0, 0, 0); if (gNB2UE == NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -357,7 +357,7 @@ int main(int argc, char **argv) frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL; crcTableInit(); nr_phy_config_request_sim(gNB, N_RB_DL, N_RB_DL, mu, Nid_cell,SSB_positions); - phy_init_nr_gNB(gNB, 0, 0); + phy_init_nr_gNB(gNB, 0, 1); //lowmem //init_eNB_afterRU(); frame_length_complex_samples = frame_parms->samples_per_subframe; //frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 4c6a02b69f..21bc041f52 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -63,12 +63,14 @@ //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #include "PHY/NR_REFSIG/ptrs_nr.h" #include "NR_RRCReconfiguration.h" -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" #include #include +#include + LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; rlc_info_t Rlc_info_um,Rlc_info_am_config; @@ -83,16 +85,38 @@ uint16_t sf_ahead=4 ; uint16_t sl_ahead=0; //uint8_t nfapi_mode = 0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; +msc_interface_t msc_interface; + // dummy functions int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const int8_t channel, - const uint8_t* pduP, - const sdu_size_t pdu_len) +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, + const int CC_id, + const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, + const channel_t channel, + const uint8_t* pduP, + const sdu_size_t pdu_len) +{ + return 0; +} + +void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) +{ + return; +} + +int8_t nr_mac_rrc_data_req_ue(const module_id_t Mod_idP, + const int CC_id, + const uint8_t gNB_id, + const frame_t frameP, + const rb_id_t Srb_id, + uint8_t *buffer_pP) { return 0; } @@ -173,7 +197,9 @@ int nr_derive_key(int alg_type, uint8_t alg_id, } void config_common(int Mod_idP, - int pdsch_AntennaPorts, + int ssb_SubcarrierOffset, + int pdsch_AntennaPorts, + int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc ); @@ -193,6 +219,8 @@ int is_x2ap_enabled(void) return 0; } +void processSlotTX(void *arg) {} + //nFAPI P7 dummy functions int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } @@ -227,13 +255,38 @@ void nr_dlsim_preprocessor(module_id_t module_id, sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); sched_ctrl->cce_index = 0; - sched_ctrl->rbStart = g_rbStart; - sched_ctrl->rbSize = g_rbSize; - sched_ctrl->mcs = g_mcsIndex; - sched_ctrl->time_domain_allocation = 2; - sched_ctrl->mcsTableIdx = g_mcsTableIdx; + NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; + nr_set_pdsch_semi_static(scc, + UE_info->secondaryCellGroup[0], + sched_ctrl->active_bwp, + /* tda = */ 2, + /* num_dmrs_cdm_grps_no_data = */ 1, + ps); + + NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; + sched_pdsch->rbStart = g_rbStart; + sched_pdsch->rbSize = g_rbSize; + sched_pdsch->mcs = g_mcsIndex; + /* the following might override the table that is mandated by RRC + * configuration */ + ps->mcsTableIdx = g_mcsTableIdx; + + sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); + sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx); + sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm, + sched_pdsch->R, + sched_pdsch->rbSize, + ps->nrOfSymbols, + ps->N_PRB_DMRS * ps->N_DMRS_SLOT, + 0 /* N_PRB_oh, 0 for initialBWP */, + 0 /* tb_scaling */, + 1 /* nrOfLayers */) + >> 3; + /* the simulator assumes the HARQ PID is equal to the slot number */ - sched_ctrl->dl_harq_pid = slot; + sched_pdsch->dl_harq_pid = slot; + /* The scheduler uses lists to track whether a HARQ process is * free/busy/awaiting retransmission, and updates the HARQ process states. * However, in the simulation, we never get ack or nack for any HARQ process, @@ -246,13 +299,26 @@ void nr_dlsim_preprocessor(module_id_t module_id, else add_front_nr_list(&sched_ctrl->retrans_dl_harq, slot); // ... make PID retransmission sched_ctrl->harq_processes[slot].is_waiting = false; - AssertFatal(sched_ctrl->rbStart >= 0, "invalid rbStart %d\n", sched_ctrl->rbStart); - AssertFatal(sched_ctrl->rbSize > 0, "invalid rbSize %d\n", sched_ctrl->rbSize); - AssertFatal(sched_ctrl->mcs >= 0, "invalid sched_ctrl->mcs %d\n", sched_ctrl->mcs); - AssertFatal(sched_ctrl->mcsTableIdx >= 0 && sched_ctrl->mcsTableIdx <= 2, "invalid sched_ctrl->mcsTableIdx %d\n", sched_ctrl->mcsTableIdx); - sched_ctrl->numDmrsCdmGrpsNoData = 1; + AssertFatal(sched_pdsch->rbStart >= 0, "invalid rbStart %d\n", sched_pdsch->rbStart); + AssertFatal(sched_pdsch->rbSize > 0, "invalid rbSize %d\n", sched_pdsch->rbSize); + AssertFatal(sched_pdsch->mcs >= 0, "invalid mcs %d\n", sched_pdsch->mcs); + AssertFatal(ps->mcsTableIdx >= 0 && ps->mcsTableIdx <= 2, "invalid mcsTableIdx %d\n", ps->mcsTableIdx); } +typedef struct { + uint64_t optmask; //mask to store boolean config options + uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization + tpool_t Tpool; // thread pool +} nrUE_params_t; + +nrUE_params_t nrUE_params; + +nrUE_params_t *get_nrUE_params(void) { + return &nrUE_params; +} + +void do_nothing(void *args) { +} int main(int argc, char **argv) { @@ -268,7 +334,7 @@ int main(int argc, char **argv) //float psnr; float eff_tp_check = 0.7; uint8_t snrRun; - uint32_t TBS; + uint32_t TBS = 0; int **txdata; double **s_re,**s_im,**r_re,**r_im; //double iqim = 0.0; @@ -297,7 +363,7 @@ int main(int argc, char **argv) //uint8_t frame_mod4,num_pdcch_symbols = 0; - SCM_t channel_model=AWGN;//Rayleigh1_anticorr; + SCM_t channel_model = AWGN; // AWGN Rayleigh1 Rayleigh1_anticorr; NB_UE_INST = 1; //double pbch_sinr; @@ -456,7 +522,7 @@ int main(int argc, char **argv) case 'y': n_tx=atoi(optarg); - if ((n_tx==0) || (n_tx>2)) { + if ((n_tx==0) || (n_tx>4)) {//extend gNB to support n_tx = 4 printf("Unsupported number of tx antennas %d\n",n_tx); exit(-1); } @@ -466,7 +532,7 @@ int main(int argc, char **argv) case 'z': n_rx=atoi(optarg); - if ((n_rx==0) || (n_rx>2)) { + if ((n_rx==0) || (n_rx>4)) {//extend UE to support n_tx = 4 printf("Unsupported number of rx antennas %d\n",n_rx); exit(-1); } @@ -601,7 +667,8 @@ int main(int argc, char **argv) InitSinLUT(); get_softmodem_params()->phy_test = 1; - + get_softmodem_params()->do_ra = 0; + if (snr1set==0) snr1 = snr0+10; init_dlsch_tpool(dlsch_threads); @@ -624,7 +691,6 @@ int main(int argc, char **argv) RC.nb_nr_mac_CC[i] = 1; mac_top_init_gNB(); gNB_mac = RC.nrmac[0]; - gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; gNB_RRC_INST rrc; memset((void*)&rrc,0,sizeof(rrc)); @@ -677,20 +743,14 @@ int main(int argc, char **argv) NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); NR_CellGroupConfig_t *secondaryCellGroup=calloc(1,sizeof(*secondaryCellGroup)); prepare_scc(rrc.carrier.servingcellconfigcommon); - uint64_t ssb_bitmap; + uint64_t ssb_bitmap = 1; fill_scc(rrc.carrier.servingcellconfigcommon,&ssb_bitmap,N_RB_DL,N_RB_DL,mu,mu); - + ssb_bitmap = 1;// Enable only first SSB with index ssb_indx=0 fix_scc(scc,ssb_bitmap); prepare_scd(scd); - fill_default_secondaryCellGroup(scc, - scd, - secondaryCellGroup, - 0, - 1, - n_tx, - 0); + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0); /* RRC parameter validation for secondaryCellGroup */ fix_scd(scd); @@ -709,10 +769,13 @@ int main(int argc, char **argv) AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); + rrc_mac_config_req_gNB(0,0,n_tx,1,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); // UE dedicated configuration - rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); - phy_init_nr_gNB(gNB,0,0); + rrc_mac_config_req_gNB(0,0,n_tx,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); + // reset preprocessor to the one of DLSIM after it has been set during + // rrc_mac_config_req_gNB + gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; + phy_init_nr_gNB(gNB,0,1); N_RB_DL = gNB->frame_parms.N_RB_DL; NR_UE_info_t *UE_info = &RC.nrmac[0]->UE_info; UE_info->num_UEs=1; @@ -759,12 +822,12 @@ int main(int argc, char **argv) gNB2UE = new_channel_desc_scm(n_tx, n_rx, channel_model, - fs, + fs/1e6,//sampling frequency in MHz bw, 30e-9, 0, 0, - 0); + 0, 0); if (gNB2UE==NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -774,28 +837,28 @@ int main(int argc, char **argv) frame_length_complex_samples = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME; //frame_length_complex_samples_no_prefix = frame_parms->samples_per_subframe_wCP*NR_NUMBER_OF_SUBFRAMES_PER_FRAME; - s_re = malloc(2*sizeof(double*)); - s_im = malloc(2*sizeof(double*)); - r_re = malloc(2*sizeof(double*)); - r_im = malloc(2*sizeof(double*)); - txdata = malloc(2*sizeof(int*)); - - for (i=0; i<2; i++) { + s_re = malloc(n_tx*sizeof(double*)); + s_im = malloc(n_tx*sizeof(double*)); + r_re = malloc(n_rx*sizeof(double*)); + r_im = malloc(n_rx*sizeof(double*)); + txdata = malloc(n_tx*sizeof(int*)); + for (i=0; iframe_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS)); + UE->frame_parms.nb_antennas_rx = n_rx; if (run_initial_sync==1) UE->is_synchronized = 0; else {UE->is_synchronized = 1; UE->UE_mode[0]=PUSCH;} @@ -828,7 +892,7 @@ int main(int argc, char **argv) init_nr_ue_transport(UE,0); nr_gold_pbch(UE); - nr_gold_pdcch(UE,0,2); + nr_gold_pdcch(UE,0); nr_l2_init_ue(NULL); UE_mac = get_mac_inst(0); @@ -848,6 +912,7 @@ int main(int argc, char **argv) unsigned int errors_bit = 0; uint32_t errors_scrambling = 0; + initTpool("N", &(nrUE_params.Tpool), false); test_input_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384); estimated_output_bit = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384); @@ -855,7 +920,8 @@ int main(int argc, char **argv) // generate signal AssertFatal(input_fd==NULL,"Not ready for input signal file\n"); gNB->pbch_configured = 1; - gNB->ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234; + gNB->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234; + gNB->ssb[0].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0; //Configure UE rrc.carrier.MIB = (uint8_t*) malloc(4); @@ -879,7 +945,7 @@ int main(int argc, char **argv) scheduled_response.CC_id = 0; scheduled_response.frame = frame; scheduled_response.slot = slot; - scheduled_response.thread_id = UE_proc.thread_id; + scheduled_response.thread_id = 0; nr_ue_phy_config_request(&UE_mac->phy_config); //NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels; @@ -981,16 +1047,16 @@ int main(int argc, char **argv) printf("[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb ); } if (run_initial_sync) - nr_common_signal_procedures(gNB,frame,slot); + nr_common_signal_procedures(gNB,frame,slot,gNB->ssb[0].ssb_pdu); else - phy_procedures_gNB_TX(gNB,frame,slot,0); + phy_procedures_gNB_TX(gNB,frame,slot,1); int txdataF_offset = (slot%2) * frame_parms->samples_per_slot_wCP; if (n_trials==1) { - LOG_M("txsigF0.m","txsF0", &gNB->common_vars.txdataF[0][txdataF_offset],frame_parms->samples_per_slot_wCP,1,1); + LOG_M("txsigF0.m","txsF0=", &gNB->common_vars.txdataF[0][txdataF_offset+2*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1); if (gNB->frame_parms.nb_antennas_tx>1) - LOG_M("txsigF1.m","txsF1", &gNB->common_vars.txdataF[1][txdataF_offset],frame_parms->samples_per_slot_wCP,1,1); + LOG_M("txsigF1.m","txsF1=", &gNB->common_vars.txdataF[1][txdataF_offset+2*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1); } int tx_offset = frame_parms->get_samples_slot_timestamp(slot,frame_parms,0); if (n_trials==1) printf("tx_offset %d, txdataF_offset %d \n", tx_offset,txdataF_offset); @@ -1014,45 +1080,79 @@ int main(int argc, char **argv) } if (n_trials==1) { - LOG_M("txsig0.m","txs0", &txdata[0][tx_offset],frame_parms->get_samples_slot_timestamp(slot,frame_parms,0),1,1); - if (gNB->frame_parms.nb_antennas_tx>1) - LOG_M("txsig1.m","txs1", &txdata[1][tx_offset],frame_parms->get_samples_slot_timestamp(slot,frame_parms,0),1,1); + char filename[100];//LOG_M + for (aa=0;aaofdm_symbol_size+frame_parms->nb_prefix_samples0],6*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples),1,1); + } } if (output_fd) { printf("writing txdata to binary file\n"); fwrite(txdata[0],sizeof(int32_t),frame_length_complex_samples,output_fd); } - int txlev = signal_energy(&txdata[0][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+5*frame_parms->ofdm_symbol_size + 4*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); - - // if (n_trials==1) printf("txlev %d (%f)\n",txlev,10*log10((double)txlev)); + int txlev[n_tx]; + int txlev_sum = 0; + int l_ofdm = 6; + for (aa=0; aaofdm_symbol_size + (l_ofdm-1)*frame_parms->nb_prefix_samples + frame_parms->nb_prefix_samples0], + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); + txlev_sum += txlev[aa]; + if (n_trials==1) printf("txlev[%d] = %d (%f dB) txlev_sum %d\n",aa,txlev[aa],10*log10((double)txlev[aa]),txlev_sum); + } for (i=(frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)); i<(frame_parms->get_samples_slot_timestamp(slot+1,frame_parms,0)); i++) { for (aa=0; aanb_antennas_tx; aa++) { - r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]); - r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]); + s_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]); + s_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]); } } + double ts = 1.0/(frame_parms->subcarrier_spacing * frame_parms->ofdm_symbol_size); - //AWGN - sigma2_dB = 10 * log10((double)txlev * ((double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize))) - SNR; + //Compute AWGN variance + sigma2_dB = 10 * log10((double)txlev_sum * ((double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize))) - SNR; sigma2 = pow(10, sigma2_dB/10); - if (n_trials==1) printf("sigma2 %f (%f dB), txlev %f (factor %f)\n",sigma2,sigma2_dB,10*log10((double)txlev),(double)(double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize)); + if (n_trials==1) printf("sigma2 %f (%f dB), txlev_sum %f (factor %f)\n",sigma2,sigma2_dB,10*log10((double)txlev_sum),(double)(double)UE->frame_parms.ofdm_symbol_size/(12*rel15->rbSize)); + + for (aa=0; aaget_samples_slot_timestamp(slot,frame_parms,0); iget_samples_slot_timestamp(slot+1,frame_parms,0); i++) { - for (aa=0; aanb_antennas_rx; aa++) { - ((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); - ((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); + for (int aa_rx=0; aa_rxcommon_vars.rxdata[aa_rx])[2*i] = (short) ((r_re[aa_rx][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); + ((short*) UE->common_vars.rxdata[aa_rx])[2*i+1] = (short) ((r_im[aa_rx][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); /* Add phase noise if enabled */ if (pdu_bit_map & 0x1) { - phase_noise(ts, &((short*) UE->common_vars.rxdata[aa])[2*i], - &((short*) UE->common_vars.rxdata[aa])[2*i+1]); + phase_noise(ts, &((short*) UE->common_vars.rxdata[aa_rx])[2*i], + &((short*) UE->common_vars.rxdata[aa_rx])[2*i+1]); } } } @@ -1063,7 +1163,8 @@ int main(int argc, char **argv) phy_procedures_nrUE_RX(UE, &UE_proc, 0, - dlsch_threads); + dlsch_threads, + NULL); //printf("dlsim round %d ends\n",round); round++; @@ -1092,10 +1193,10 @@ int main(int argc, char **argv) available_bits-= (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2); printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) ); } - + for (i = 0; i < available_bits; i++) { - - if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) || + + if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) || ((gNB_dlsch->harq_process.f[i] == 1) && (UE_llr[i] >= 0))) { if(errors_scrambling == 0) { @@ -1104,7 +1205,7 @@ int main(int argc, char **argv) } errors_scrambling++; } - + } for (i = 0; i < TBS; i++) { @@ -1232,12 +1333,16 @@ int main(int argc, char **argv) } }*/ - for (i = 0; i < 2; i++) { + free_channel_desc_scm(gNB2UE); + + for (i = 0; i < n_tx; i++) { free(s_re[i]); free(s_im[i]); + free(txdata[i]); + } + for (i = 0; i < n_rx; i++) { free(r_re[i]); free(r_im[i]); - free(txdata[i]); } free(s_re); @@ -1314,15 +1419,62 @@ void update_dmrs_config(NR_CellGroupConfig_t *scg,PHY_VARS_NR_UE *ue, int8_t* dm } else if (dmrs_arg[0] == 1) { mapping_type = typeB; + } else { + AssertFatal(1==0,"Incorrect Mappingtype, valid options 0-typeA, 1-typeB\n"); } - /* Additional DMRS positions 0 ,1 and 2 */ - if(dmrs_arg[1] >= 0 && dmrs_arg[1] <3 ) { + + /* Additional DMRS positions 0 ,1 ,2 and 3 */ + if(dmrs_arg[1] >= 0 && dmrs_arg[1] <4 ) { add_pos = dmrs_arg[1]; + } else { + AssertFatal(1==0,"Incorrect Additional Position, valid options 0-pos1, 1-pos1, 2-pos2, 3-pos3\n"); } if(scg != NULL) { NR_BWP_Downlink_t *bwp = scg->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[0]; - *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = add_pos; + + AssertFatal((bwp->bwp_Dedicated->pdsch_Config != NULL && bwp->bwp_Dedicated->pdsch_Config->choice.setup != NULL), "Base RRC reconfig structures are not allocated.\n"); + + if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA == NULL) { + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;//calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; + printf("DLSIM: Allocated Mapping TypeA in RRC reconfig message\n"); + } else if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB == NULL) { + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type=NULL;//calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type)); + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->maxLength=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->scramblingID0=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->scramblingID1=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->phaseTrackingRS=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_AdditionalPosition = NULL; + printf("DLSIM: Allocated Mapping TypeB in RRC reconfig message\n"); + } + + struct NR_SetupRelease_DMRS_DownlinkConfig *dmrs_MappingtypeA = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA; + struct NR_SetupRelease_DMRS_DownlinkConfig *dmrs_MappingtypeB = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeB; + + + NR_DMRS_DownlinkConfig_t *dmrs_config = (mapping_type == typeA) ? dmrs_MappingtypeA->choice.setup : dmrs_MappingtypeB->choice.setup; + + if (add_pos != 2) { // pos0,pos1,pos3 + if (dmrs_config->dmrs_AdditionalPosition == NULL) { + dmrs_config->dmrs_AdditionalPosition = calloc(1,sizeof(*dmrs_MappingtypeA->choice.setup->dmrs_AdditionalPosition)); + } + *dmrs_config->dmrs_AdditionalPosition = add_pos; + } else { // if NULL, Value pos2 + free(dmrs_config->dmrs_AdditionalPosition); + dmrs_config->dmrs_AdditionalPosition = NULL; + } + for (int i=0;ibwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;i++) { bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType = mapping_type; } diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c index 32b6b10412..24ed8a930c 100644 --- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c +++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c @@ -1,3 +1,5 @@ +#include "nfapi/oai_integration/vendor_ext.h" + int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0); } int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); } int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) { return(0); } diff --git a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h index b78b42db91..8d4acd1af1 100644 --- a/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h +++ b/openair1/SIMULATION/NR_PHY/nr_unitary_defs.h @@ -149,13 +149,13 @@ void fill_scc(NR_ServingCellConfigCommon_t *scc,uint64_t *ssb_bitmap,int N_RB_DL scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.present=NR_RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139; scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139=0; scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig=NR_RACH_ConfigCommon__restrictedSetConfig_unrestrictedSet; - *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2=2; + *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->k2=6; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[0]->startSymbolAndLength=55; - *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->k2=2; + *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->k2=6; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[1]->startSymbolAndLength=69; - *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->k2=2; + *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->k2=6; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->mappingType=NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB; scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[2]->startSymbolAndLength=55; *scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[3]->k2=33; diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index a3c2501197..548b76db69 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -47,7 +47,7 @@ #include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" #include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #include "openair1/PHY/MODULATION/nr_modulation.h" - +#include //#define DEBUG_NR_PBCHSIM PHY_VARS_gNB *gNB; @@ -66,6 +66,7 @@ uint8_t const nr_rv_round_map[4] = {0, 2, 1, 3}; uint8_t const nr_rv_round_map_ue[4] = {0, 2, 1, 3}; uint64_t get_softmodem_optmask(void) {return 0;} +softmodem_params_t *get_softmodem_params(void) {return 0;} void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} @@ -119,7 +120,7 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, int main(int argc, char **argv) { char c; - int i,aa;//,l; + int i,aa,start_symbol; double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0; double cfo=0; uint8_t snr1set=0; @@ -414,7 +415,7 @@ int main(int argc, char **argv) frame_parms->ssb_type = nr_ssb_type_C; nr_phy_config_request_sim_pbchsim(gNB,N_RB_DL,N_RB_DL,mu,Nid_cell,SSB_positions); - phy_init_nr_gNB(gNB,0,0); + phy_init_nr_gNB(gNB,0,1); nr_set_ssb_first_subcarrier(&gNB->gNB_config,frame_parms); uint8_t n_hf = 0; @@ -426,29 +427,28 @@ int main(int argc, char **argv) switch (mu) { case 1: - scs = 30000; - if (N_RB_DL == 217) { - fs = 122.88e6; - bw = 80e6; - - } - else if (N_RB_DL == 245) { - fs = 122.88e6; - bw = 90e6; - } - else if (N_RB_DL == 273) { - fs = 122.88e6; - bw = 100e6; - } - else if (N_RB_DL == 106) { - fs = 61.44e6; - bw = 40e6; - } - else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); - break; - - + scs = 30000; + frame_parms->Lmax = 8; + if (N_RB_DL == 217) { + fs = 122.88e6; + bw = 80e6; + } + else if (N_RB_DL == 245) { + fs = 122.88e6; + bw = 90e6; + } + else if (N_RB_DL == 273) { + fs = 122.88e6; + bw = 100e6; + } + else if (N_RB_DL == 106) { + fs = 61.44e6; + bw = 40e6; + } + else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); + break; case 3: + frame_parms->Lmax = 64; scs = 120000; if (N_RB_DL == 66) { fs = 122.88e6; @@ -457,6 +457,7 @@ int main(int argc, char **argv) else AssertFatal(1==0,"Unsupported numerology for mu %d, N_RB %d\n",mu, N_RB_DL); break; } + // cfo with respect to sub-carrier spacing eps = cfo/scs; @@ -479,7 +480,7 @@ int main(int argc, char **argv) 300e-9, 0, 0, - 0); + 0, 0); if (gNB2UE==NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -510,7 +511,6 @@ int main(int argc, char **argv) printf("Allocating %d samples for txdata\n",frame_length_complex_samples); txdata[i] = malloc(frame_length_complex_samples*sizeof(int)); bzero(r_re[i],frame_length_complex_samples*sizeof(int)); - } if (pbch_file_fd!=NULL) { @@ -536,60 +536,68 @@ int main(int argc, char **argv) } nr_gold_pbch(UE); + // generate signal if (input_fd==NULL) { - gNB->pbch_configured = 1; - - gNB->ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33; - for (int slot=0;slotslots_per_frame;slot++) { - for (aa=0; aaframe_parms.nb_antennas_tx; aa++) - memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t)); - - nr_common_signal_procedures (gNB,frame,slot); + for (i=0; iLmax; i++) { + if((SSB_positions >> i) & 0x01) { - for (aa=0; aaframe_parms.nb_antennas_tx; aa++) { - if (cyclic_prefix_type == 1) { - PHY_ofdm_mod(gNB->common_vars.txdataF[aa], - &txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], - frame_parms->ofdm_symbol_size, - 12, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); - } else { - /* nr_normal_prefix_mod(gNB->common_vars.txdataF[aa], - &txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], - 14, - frame_parms);*/ - PHY_ofdm_mod(gNB->common_vars.txdataF[aa], - (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], - frame_parms->ofdm_symbol_size, - 1, - frame_parms->nb_prefix_samples0, - CYCLIC_PREFIX); - - apply_nr_rotation(frame_parms, - (int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], - slot, - 0, - 1, - frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples0); - PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size], - (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size], - frame_parms->ofdm_symbol_size, - 13, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); - apply_nr_rotation(frame_parms, - (int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size], - slot, - 1, - 13, - frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); - } - } + gNB->ssb[i].ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33; + gNB->ssb[i].ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = i; + + start_symbol = nr_get_ssb_start_symbol(frame_parms,i); + int slot = start_symbol/14; + + for (aa=0; aaframe_parms.nb_antennas_tx; aa++) + memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t)); + + nr_common_signal_procedures (gNB,frame,slot,gNB->ssb[i].ssb_pdu); + + for (aa=0; aaframe_parms.nb_antennas_tx; aa++) { + if (cyclic_prefix_type == 1) { + PHY_ofdm_mod(gNB->common_vars.txdataF[aa], + &txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], + frame_parms->ofdm_symbol_size, + 12, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); + } else { + /*nr_normal_prefix_mod(gNB->common_vars.txdataF[aa], + &txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], + 14, + frame_parms);*/ + PHY_ofdm_mod(gNB->common_vars.txdataF[aa], + (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], + frame_parms->ofdm_symbol_size, + 1, + frame_parms->nb_prefix_samples0, + CYCLIC_PREFIX); + + apply_nr_rotation(frame_parms, + (int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)], + slot, + 0, + 1, + frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples0); + + PHY_ofdm_mod(&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size], + (int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size], + frame_parms->ofdm_symbol_size, + 13, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); + + apply_nr_rotation(frame_parms, + (int16_t*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size], + slot, + 1, + 13, + frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples); + } + } + } } - LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1); if (gNB->frame_parms.nb_antennas_tx>1) LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1); @@ -598,9 +606,9 @@ int main(int argc, char **argv) printf("Reading %d samples from file to antenna buffer %d\n",frame_length_complex_samples,0); UE->UE_fo_compensation = 1; // perform fo compensation when samples from file are used if (fread(txdata[0], - sizeof(int32_t), - frame_length_complex_samples, - input_fd) != frame_length_complex_samples) { + sizeof(int32_t), + frame_length_complex_samples, + input_fd) != frame_length_complex_samples) { printf("error reading from file\n"); //exit(-1); } @@ -684,10 +692,9 @@ int main(int argc, char **argv) UE->rx_offset=0; uint8_t ssb_index = 0; while (!((SSB_positions >> ssb_index) & 0x01)) ssb_index++; // to select the first transmitted ssb - frame_parms->ssb_index = ssb_index; - UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms); + UE->symbol_offset = nr_get_ssb_start_symbol(frame_parms,ssb_index); - int ssb_slot = (ssb_index>>1)+(n_hf*frame_parms->slots_per_frame); + int ssb_slot = (UE->symbol_offset/14)+(n_hf*(frame_parms->slots_per_frame>>1)); for (int i=UE->symbol_offset+1; isymbol_offset+4; i++) { nr_slot_fep(UE, &proc, @@ -716,7 +723,7 @@ int main(int argc, char **argv) payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte); for (i=0;i<3;i++){ - payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((gNB->ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff)); + payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((gNB->ssb[ssb_index].ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff)); } //printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte); //printf("ret %d\n", payload_ret); diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 74ca8d9184..bba0a6996f 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -37,6 +37,7 @@ #include "SCHED_NR_UE/phy_frame_config_nr.h" #include "PHY/phy_vars_nr_ue.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" +#include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/modulation_eNB.h" #include "PHY/MODULATION/modulation_UE.h" #include "PHY/INIT/phy_init.h" @@ -47,9 +48,10 @@ #include "OCG_vars.h" #include #include +#include +#include //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" - #define NR_PRACH_DEBUG 1 #define PRACH_WRITE_OUTPUT_DEBUG 1 @@ -65,10 +67,12 @@ extern uint16_t prach_root_sequence_map0_3[838]; openair0_config_t openair0_cfg[MAX_CARDS]; //uint8_t nfapi_mode=0; uint16_t sl_ahead = 0; +msc_interface_t msc_interface; //void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe); /* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */ +msc_interface_t msc_interface; uint64_t get_softmodem_optmask(void) {return 0;} softmodem_params_t *get_softmodem_params(void) {return 0;} int oai_nfapi_dl_tti_req(nfapi_nr_dl_tti_request_t *dl_config_req) { return(0); } @@ -130,7 +134,18 @@ nr_rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP( return 0; } -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return 0;} +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, + const int CC_id, + const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, + const channel_t channel, + const uint8_t* pduP, + const sdu_size_t pdu_len) +{ + return 0; +} void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { @@ -159,13 +174,27 @@ int nr_derive_key(int alg_type, uint8_t alg_id, return 0; } +typedef struct { + uint64_t optmask; //mask to store boolean config options + uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization + tpool_t Tpool; // thread pool +} nrUE_params_t; + +nrUE_params_t nrUE_params; + +nrUE_params_t *get_nrUE_params(void) { + return &nrUE_params; +} + +void processSlotTX(void *arg) {} + int main(int argc, char **argv){ char c; double sigma2, sigma2_dB = 0, SNR, snr0 = -2.0, snr1 = 0.0, ue_speed0 = 0.0, ue_speed1 = 0.0; double **s_re, **s_im, **r_re, **r_im, iqim = 0.0, delay_avg = 0, ue_speed = 0, fs, bw; - int i, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1; + int i, l, aa, aarx, **txdata, trial, n_frames = 1, prach_start, rx_prach_start; //, ntrials=1; int N_RB_UL = 106, delay = 0, NCS_config = 13, rootSequenceIndex = 1, threequarter_fs = 0, mu = 1, fd_occasion = 0, loglvl = OAILOG_INFO, numRA = 0, prachStartSymbol = 0; uint8_t snr1set = 0, ue_speed1set = 0, transmission_mode = 1, n_tx = 1, n_rx = 1, awgn_flag = 0, msg1_frequencystart = 0, num_prach_fd_occasions = 1, prach_format=0; uint8_t frame = 1, slot=19, slot_gNB=19, config_index = 98, prach_sequence_length = 1, restrictedSetConfig = 0, N_dur, N_t_slot, start_symbol; @@ -205,7 +234,7 @@ int main(int argc, char **argv){ randominit(0); - while ((c = getopt (argc, argv, "hHaA:Cc:r:p:g:m:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) { + while ((c = getopt (argc, argv, "hHaA:Cc:l:r:p:g:m:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) { switch (c) { case 'a': printf("Running AWGN simulation\n"); @@ -218,6 +247,10 @@ int main(int argc, char **argv){ config_index = atoi(optarg); break; + case 'l': + loglvl = atoi(optarg); + break; + case 'r': msg1_frequencystart = atoi(optarg); break; @@ -489,7 +522,8 @@ int main(int argc, char **argv){ ru->if_south = LOCAL_RF; ru->nb_tx = n_tx; ru->nb_rx = n_rx; - + ru->num_gNB = 1; + ru->gNB_list[0] = gNB; gNB->gNB_config.carrier_config.num_tx_ant.value = 1; gNB->gNB_config.carrier_config.num_rx_ant.value = 1; if (mu==1) @@ -590,7 +624,7 @@ int main(int argc, char **argv){ memcpy((void*)&ru->config,(void*)&RC.gNB[0]->gNB_config,sizeof(ru->config)); RC.nb_nr_L1_inst=1; - phy_init_nr_gNB(gNB,0,0); + phy_init_nr_gNB(gNB,0,1); //lowmem nr_phy_init_RU(ru); gNB->common_vars.rxdata = ru->common.rxdata; set_tdd_config_nr(&gNB->gNB_config, mu, 7, 6, 2, 4); @@ -658,7 +692,7 @@ int main(int argc, char **argv){ DS_TDL, 0.0, delay, - 0); + 0, 0); if (UE2gNB==NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -796,7 +830,17 @@ int main(int argc, char **argv){ } } - + for (l = 0; l < frame_parms->symbols_per_slot; l++) { + for (aa = 0; aa < frame_parms->nb_antennas_rx; aa++) { + nr_slot_fep_ul(frame_parms, + ru->common.rxdata[aa], + ru->common.rxdataF[aa], + l, + slot, + ru->N_TA_offset); + } + } + rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot); gNB->prach_vars.rxsigF = ru->prach_rxsigF[prachOccasion]; @@ -819,7 +863,8 @@ int main(int argc, char **argv){ LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0], N_ZC, 1, 1); LOG_M("rxsig0.m","rxs0", &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][subframe*frame_parms->samples_per_subframe], frame_parms->samples_per_subframe, 1, 1); - LOG_M("ru_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1); + LOG_M("ru_rxsigF0.m","rxsF0", ru->common.rxdataF[0], frame_parms->ofdm_symbol_size*frame_parms->symbols_per_slot, 1, 1); + LOG_M("ru_prach_rxsigF0.m","rxsF0", ru->prach_rxsigF[0][0], N_ZC, 1, 1); LOG_M("prach_preamble.m","prachp", &gNB->X_u[0], N_ZC, 1, 1); LOG_M("ue_prach_preamble.m","prachp", &UE->X_u[0], N_ZC, 1, 1); #endif diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c index 8d79633a6f..758afc6b3c 100644 --- a/openair1/SIMULATION/NR_PHY/pucchsim.c +++ b/openair1/SIMULATION/NR_PHY/pucchsim.c @@ -46,6 +46,7 @@ #include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" #include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" + PHY_VARS_gNB *gNB; PHY_VARS_NR_UE *UE; RAN_CONTEXT_t RC; @@ -418,7 +419,7 @@ int main(int argc, char **argv) printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO); } - UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0); + UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0, 0); if (UE2gNB==NULL) { printf("Problem generating channel model. Exiting.\n"); diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 6f2af73a1d..c889e6dcb9 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -364,7 +364,7 @@ int main(int argc, char **argv) 61.44e6, //N_RB2sampling_rate(N_RB_DL), 40e6, //N_RB2channel_bandwidth(N_RB_DL), DS_TDL, - 0,0,0); + 0,0,0, 0); if (gNB2UE == NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -394,7 +394,7 @@ int main(int argc, char **argv) nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions); - phy_init_nr_gNB(gNB, 0, 0); + phy_init_nr_gNB(gNB, 0, 1); //lowmem //configure UE UE = malloc(sizeof(PHY_VARS_NR_UE)); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index d8fef539ba..5dd05848c0 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -57,14 +57,14 @@ #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "common/utils/threadPool/thread-pool.h" #include "PHY/NR_REFSIG/ptrs_nr.h" -#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) +#define inMicroS(a) (((double)(a))/(get_cpu_freq_GHz()*1000.0)) #include "SIMULATION/LTE_PHY/common_sim.h" #include #include +#include #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" - //#define DEBUG_ULSIM LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; @@ -81,11 +81,25 @@ uint16_t sl_ahead=0; double cpuf; //uint8_t nfapi_mode = 0; uint64_t downlink_frequency[MAX_NUM_CCs][4]; +THREAD_STRUCT thread_struct; +nfapi_ue_release_request_body_t release_rntis; +msc_interface_t msc_interface; extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, - const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) { return 0; } +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, + const int CC_id, + const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, + const channel_t channel, + const uint8_t* pduP, + const sdu_size_t pdu_len) +{ + return 0; +} + int generate_dlsch_header(unsigned char *mac_header, unsigned char num_sdus, unsigned short *sdu_lengths, @@ -184,6 +198,19 @@ int nr_derive_key(int alg_type, uint8_t alg_id, return 0; } +typedef struct { + uint64_t optmask; //mask to store boolean config options + uint8_t nr_dlsch_parallel; // number of threads for dlsch decoding, 0 means no parallelization + tpool_t Tpool; // thread pool +} nrUE_params_t; + +void processSlotTX(void *arg) {} + +nrUE_params_t nrUE_params; + +nrUE_params_t *get_nrUE_params(void) { + return &nrUE_params; +} // needed for some functions uint16_t n_rnti = 0x1234; openair0_config_t openair0_cfg[MAX_CARDS]; @@ -195,6 +222,7 @@ double s_re1[122880],s_im1[122880],r_re1[122880],r_im1[122880]; double r_re2[122880],r_im2[122880]; double r_re3[122880],r_im3[122880]; + int main(int argc, char **argv) { char c; @@ -276,7 +304,7 @@ int main(int argc, char **argv) if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0 ) { exit_fun("[NR_ULSIM] Error, configuration module init failed\n"); } - + int ul_proc_error = 0; // uplink processing checking status flag //logInit(); randominit(0); @@ -593,7 +621,7 @@ int main(int argc, char **argv) sampling_frequency, bandwidth, DS_TDL, - 0, 0, 0); + 0, 0, 0, 0); if (UE2gNB == NULL) { printf("Problem generating channel model. Exiting.\n"); @@ -649,13 +677,7 @@ int main(int argc, char **argv) prepare_scd(scd); - fill_default_secondaryCellGroup(scc, - scd, - secondaryCellGroup, - 0, - 1, - n_tx, - 0); + fill_default_secondaryCellGroup(scc, scd, secondaryCellGroup, 0, 1, n_tx, 0, 0); // xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); @@ -666,10 +688,10 @@ int main(int argc, char **argv) gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - rrc_mac_config_req_gNB(0,0,n_rx,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); + rrc_mac_config_req_gNB(0,0,n_tx,n_rx,pusch_tgt_snrx10,pucch_tgt_snrx10,scc,0,0,NULL); // UE dedicated configuration - rrc_mac_config_req_gNB(0,0,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); - phy_init_nr_gNB(gNB,0,0); + rrc_mac_config_req_gNB(0,0,1,1,pusch_tgt_snrx10,pucch_tgt_snrx10,NULL,1,secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); + phy_init_nr_gNB(gNB,0,1); N_RB_DL = gNB->frame_parms.N_RB_DL; @@ -794,7 +816,7 @@ int main(int argc, char **argv) } uint8_t length_dmrs = pusch_len1; - uint16_t l_prime_mask = get_l_prime(nb_symb_sch, mapping_type, add_pos, length_dmrs); + uint16_t l_prime_mask = get_l_prime(nb_symb_sch, mapping_type, add_pos, length_dmrs, start_symbol, NR_MIB__dmrs_TypeA_Position_pos2); uint16_t number_dmrs_symbols = get_dmrs_symbols_in_slot(l_prime_mask, nb_symb_sch); uint8_t nb_re_dmrs = (dmrs_config_type == pusch_dmrs_type1) ? 6 : 4; @@ -980,7 +1002,7 @@ int main(int argc, char **argv) pusch_pdu->transform_precoding = transform_precoding; pusch_pdu->data_scrambling_id = *scc->physCellId; pusch_pdu->nrOfLayers = 1; - pusch_pdu->ul_dmrs_symb_pos = l_prime_mask << start_symbol; + pusch_pdu->ul_dmrs_symb_pos = l_prime_mask; pusch_pdu->dmrs_config_type = dmrs_config_type; pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId; pusch_pdu->scid = 0; @@ -1043,7 +1065,7 @@ int main(int argc, char **argv) ul_config.ul_config_list[0].pusch_config_pdu.rb_start = start_rb; ul_config.ul_config_list[0].pusch_config_pdu.nr_of_symbols = nb_symb_sch; ul_config.ul_config_list[0].pusch_config_pdu.start_symbol_index = start_symbol; - ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask << start_symbol; + ul_config.ul_config_list[0].pusch_config_pdu.ul_dmrs_symb_pos = l_prime_mask; ul_config.ul_config_list[0].pusch_config_pdu.dmrs_config_type = dmrs_config_type; ul_config.ul_config_list[0].pusch_config_pdu.mcs_index = Imcs; ul_config.ul_config_list[0].pusch_config_pdu.mcs_table = mcs_table; @@ -1087,6 +1109,11 @@ int main(int argc, char **argv) phy_procedures_nrUE_TX(UE, &UE_proc, gNB_id); + /* We need to call common sending function to send signal */ + LOG_D(PHY, "Sending Uplink data \n"); + nr_ue_pusch_common_procedures(UE, + slot, + &UE->frame_parms,1); if (n_trials==1) { LOG_M("txsig0.m","txs0", UE->common_vars.txdata[0],frame_parms->samples_per_subframe*10,1,1); @@ -1156,10 +1183,9 @@ int main(int argc, char **argv) gNB->UL_INFO.rx_ind.number_of_pdus = 0; gNB->UL_INFO.crc_ind.number_crcs = 0; - start_meas(&gNB->phy_proc_rx); phy_procedures_gNB_common_RX(gNB, frame, slot); - phy_procedures_gNB_uespec_RX(gNB, frame, slot); + ul_proc_error = phy_procedures_gNB_uespec_RX(gNB, frame, slot); if (n_trials==1 && round==0) { LOG_M("rxsig0.m","rx0",&gNB->common_vars.rxdata[0][slot_offset],slot_length,1,1); @@ -1188,11 +1214,10 @@ int main(int argc, char **argv) LOG_M("rxsigF0_llr.m","rxsF0_llr", &gNB->pusch_vars[0]->llr[0],(nb_symb_sch-1)*NR_NB_SC_PER_RB * pusch_pdu->rb_size * mod_order,1,0); } - start_meas(&gNB->phy_proc_rx); //////////////////////////////////////////////////////////// - - if (gNB->ulsch[0][0]->last_iteration_cnt >= - gNB->ulsch[0][0]->max_ldpc_iterations+1) { + + if ((gNB->ulsch[0][0]->last_iteration_cnt >= + gNB->ulsch[0][0]->max_ldpc_iterations+1) || ul_proc_error == 1) { error_flag = 1; n_errors[round]++; crc_status = 1; diff --git a/openair1/SIMULATION/TOOLS/DOC/arch.md b/openair1/SIMULATION/TOOLS/DOC/arch.md new file mode 100644 index 0000000000..30be337829 --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/arch.md @@ -0,0 +1,9 @@ +# Channel simulation source files + +1. [random_channel.c](../random_channel.c) +1. [sim.h](../sim.h) + + + +[channel simulation main page](channel_simulation.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md new file mode 100644 index 0000000000..be2b987b40 --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/channel_simulation.md @@ -0,0 +1,13 @@ +# OAI channel simulation feature + +oai includes a channel simulation feature that any component can use to alter time domain samples of a RF channel by applying pre-defined models as defined, for example, in 3GPP TR 36.873 or TR 38.901 + +Definition, configuration and run-time modification of a channel model are implemented in common code included in UEs, gNb, eNB and used when running with the rfsimulator or the L1 simulator. Phy simulators are also using channel simulation but configuration is done via dedicated command line options. The rfsimulator is the only option to get access to all the configurations and run-time modifications features of oai channel simulation. + +## Documentation + +* [runtime usage](rtusage.md) +* [developer usage](devusage.md) +* [module architecture](arch.md) + +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/openair1/SIMULATION/TOOLS/DOC/devusage.md b/openair1/SIMULATION/TOOLS/DOC/devusage.md new file mode 100644 index 0000000000..8fa6b3fe7a --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/devusage.md @@ -0,0 +1,7 @@ +### channel simulation developer usage + + +[Configuring the channel simulation](rtusage.md) + +[channel simulation main page](channel_simulation.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/openair1/SIMULATION/TOOLS/DOC/rtusage.md b/openair1/SIMULATION/TOOLS/DOC/rtusage.md new file mode 100644 index 0000000000..37fc62b496 --- /dev/null +++ b/openair1/SIMULATION/TOOLS/DOC/rtusage.md @@ -0,0 +1,69 @@ +## configuring the channel simulation +Oai channel simulation is using the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify some channel model parameters + +All channel simulation parameters are defined in the `channelmod` section. Most parameters are specific to a channel model and are only used by the rfsimulator. + +### global parameters + +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `max_chan` | integer | `25` | Maximum number of channel model that can be defined in the system. Must be greater than the number of model definitions in the model list loaded at init time. | +| `modellist` | character string | `DefaultChannelList` | Name of the channel models list to load at init time. | + +### Model lists + +Several model lists can be defined in the oai configuration file. One, defined by the `modellist` parameter is loaded at init time. In the configuration file each model list item describes a channel model using a group of parameters: + +| parameter name | type | default | description | +|:---:|:---:|:---:|:----| +| `model name` | character string | mandatory |name of the model, as used in the code to retrieve a model definition| +| `type` | | `AWGN` | name of the channel modelization algorithm applied on rf signal. The list of available model types can be listed via the [telnet server](../../telnetsrv/DOC/telnetsrv.md) or by entering an invalid type name | +| `ploss_dB` | real (float) | | path loss of the channel, in dB | +| `noise_power_dB` | real (double) | | noise of the channel in dB | +| `forgetfact` | real (double) | | | +| `offset` | integer | | | +| `ds_tdl` | real double | | | + +Channel simulation parameters can also be specified on the command line: + +```bash +./lte-softmodem -O ../../../ci-scripts/conf_files/enb.band7.tm1.50PRB.usrpb210.conf --noS1 --rfsim --rfsimulator.options chanmod --rfsimulator.serveraddr enb --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120 +``` +### Using the telnet server to modify channel simulator parameters +The telnet server includes a `channelmod` command which can be used to dynamically modify some channel model parameters. This command is only available when channel simulation is enabled (via `rfsimulator.options chanmod` option when running the rfsimulator. `channelmod` command has its own help: + +``` +$ telnet 127.0.0.1 9090 +Trying 127.0.0.1... +Connected to 127.0.0.1. +Escape character is '^]'. + +softmodem_enb> help +..................................... + module 6 = channelmod: + channelmod help + channelmod show + channelmod modify + module 7 = rfsimu: + rfsimu setmodel +softmodem_enb> channelmod help +channelmod commands can be used to display or modify channel models parameters +channelmod show predef: display predefined model algorithms available in oai +channelmod show current: display the currently used models in the running executable +channelmod modify : set the specified parameters in a current model to the given value + specifies the model, the show current model command can be used to list the current models indexes + can be one of "riceanf", "aoa", "randaoa", "ploss", "noise_power_dB", "offset", "forgetf" +softmodem_enb> + +``` + + + + + + + +The [rfsimulator documentation](../../../../targets/ARCH/rfsimulator/README.md ) has also some specific information when using the channel simulation via this tool. + +[channel simulation main page](channel_simulation.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/openair1/SIMULATION/TOOLS/multipath_channel.c b/openair1/SIMULATION/TOOLS/multipath_channel.c index 683526a8f0..3608eb7da2 100644 --- a/openair1/SIMULATION/TOOLS/multipath_channel.c +++ b/openair1/SIMULATION/TOOLS/multipath_channel.c @@ -39,13 +39,13 @@ uint8_t multipath_channel_nosigconv(channel_desc_t *desc) //#define CHANNEL_SSE #ifdef CHANNEL_SSE void multipath_channel(channel_desc_t *desc, - double tx_sig_re[2][30720*2], - double tx_sig_im[2][30720*2], - double rx_sig_re[2][30720*2], - double rx_sig_im[2][30720*2], + double tx_sig_re[NB_ANTENNAS_TX][30720*2], + double tx_sig_im[NB_ANTENANS_TX][30720*2], + double rx_sig_re[NB_ANTENNAS_RX][30720*2], + double rx_sig_im[NB_ANTENNAS_RX][30720*2], uint32_t length, uint8_t keep_channel, - int log_channel) + int log_channel) { int i,ii,j,l; @@ -146,13 +146,13 @@ void multipath_channel(channel_desc_t *desc, #else void multipath_channel(channel_desc_t *desc, - double *tx_sig_re[2], - double *tx_sig_im[2], - double *rx_sig_re[2], - double *rx_sig_im[2], + double *tx_sig_re[NB_ANTENNAS_TX], + double *tx_sig_im[NB_ANTENNAS_TX], + double *rx_sig_re[NB_ANTENNAS_RX], + double *rx_sig_im[NB_ANTENNAS_RX], uint32_t length, uint8_t keep_channel, - int log_channel) + int log_channel) { int i,ii,j,l; @@ -198,21 +198,22 @@ void multipath_channel(channel_desc_t *desc, rx_tmp.x += (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].x) - (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].y); rx_tmp.y += (tx.y * desc->ch[ii+(j*desc->nb_rx)][l].x) + (tx.x * desc->ch[ii+(j*desc->nb_rx)][l].y); - if (i==0 && log_channel == 1) { - printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].x,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].y,2.0)), - desc->ch[ii+(j*desc->nb_rx)][l].x, - desc->ch[ii+(j*desc->nb_rx)][l].y); - } + + if (i==0 && log_channel == 1) { + printf("channel[%d][%d][%d] = %f dB (%e,%e)\n",ii,j,l,10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].x,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].y,2.0)), + desc->ch[ii+(j*desc->nb_rx)][l].x, + desc->ch[ii+(j*desc->nb_rx)][l].y); + } } //l } // j rx_sig_re[ii][i+dd] = rx_tmp.x*path_loss; rx_sig_im[ii][i+dd] = rx_tmp.y*path_loss; - - /* if ((ii==0)&&((i%32)==0)) { - printf("%p %p %f,%f => %e,%e\n",rx_sig_re[ii],rx_sig_im[ii],rx_tmp.x,rx_tmp.y,rx_sig_re[ii][i-dd],rx_sig_im[ii][i-dd]); - }*/ - +#ifdef DEBUG_CHANNEL + if ((i%32)==0) { + printf("rx aa %d: %p %p %f,%f => %e,%e\n",ii,rx_sig_re[ii],rx_sig_im[ii],rx_tmp.x,rx_tmp.y,rx_sig_re[ii][i-dd],rx_sig_im[ii][i-dd]); + } +#endif //rx_sig_re[ii][i] = sqrt(.5)*(tx_sig_re[0][i] + tx_sig_re[1][i]); //rx_sig_im[ii][i] = sqrt(.5)*(tx_sig_im[0][i] + tx_sig_im[1][i]); diff --git a/openair1/SIMULATION/TOOLS/multipath_tv_channel.c b/openair1/SIMULATION/TOOLS/multipath_tv_channel.c index d344992586..c68ce73758 100644 --- a/openair1/SIMULATION/TOOLS/multipath_tv_channel.c +++ b/openair1/SIMULATION/TOOLS/multipath_tv_channel.c @@ -48,9 +48,9 @@ void multipath_tv_channel(channel_desc_t *desc, printf("[TV CHANNEL] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, dd %d, len %d max_doppler %g\n",keep_channel,path_loss,desc->path_loss_dB,desc->nb_rx,desc->nb_tx,dd,desc->channel_length, desc->max_Doppler); #endif - tx = (double complex **)malloc(desc->nb_tx*sizeof(double complex)); - rx = (double complex **)malloc(desc->nb_rx*sizeof(double complex)); - H_t= (double complex ** *) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **)); + tx = (double complex **)malloc(desc->nb_tx*sizeof(double complex *)); + rx = (double complex **)malloc(desc->nb_rx*sizeof(double complex *)); + H_t= (double complex ***) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **)); // tv_H_t = (double complex *) malloc(length*sizeof(double complex)); rx_temp= (double complex *) calloc(length,sizeof(double complex)); @@ -63,10 +63,10 @@ void multipath_tv_channel(channel_desc_t *desc, } for(i=0; inb_tx*desc->nb_rx; i++) { - H_t[i] = (double complex **) malloc(length*sizeof(double complex *)); + H_t[i] = (double complex **)malloc(desc->nb_taps*sizeof(double complex *)); - for(j=0; jnb_taps,sizeof(double complex)); + for(j=0; jnb_taps; j++) { + H_t[i][j] = (double complex *)calloc(length,sizeof(double complex)); } } @@ -116,7 +116,7 @@ void multipath_tv_channel(channel_desc_t *desc, free(rx); for(i=0; inb_rx*desc->nb_tx; i++) { - for(j=0; jnb_taps; j++) { free(H_t[i][j]); } @@ -131,14 +131,29 @@ void multipath_tv_channel(channel_desc_t *desc, void tv_channel(channel_desc_t *desc,double complex ***H,uint32_t length){ int i,j,p,l,k; - double *alpha,*phi_rad,pi=acos(-1),*w_Hz; + double *alpha,***phi_rad,pi=acos(-1),***w_Hz; alpha = (double *)calloc(desc->nb_paths,sizeof(double)); - phi_rad = (double *)calloc(desc->nb_paths,sizeof(double)); - w_Hz = (double *)calloc(desc->nb_paths,sizeof(double)); + phi_rad = (double ***)malloc(desc->nb_rx*desc->nb_tx*sizeof(double **)); + w_Hz = (double ***)malloc(desc->nb_rx*desc->nb_tx*sizeof(double **)); - for(i=0; inb_paths; i++) { - w_Hz[i]=desc->max_Doppler*cos(frand_a_b(0,2*pi)); - phi_rad[i]=frand_a_b(0,2*pi); + for(i=0; inb_tx*desc->nb_rx; i++) { + phi_rad[i] = (double **) malloc(desc->nb_taps*sizeof(double *)); + w_Hz[i] = (double **) malloc(desc->nb_taps*sizeof(double *)); + for(j=0; jnb_taps; j++) { + phi_rad[i][j] = (double *) malloc(desc->nb_paths*sizeof(double)); + w_Hz[i][j] = (double *) malloc(desc->nb_paths*sizeof(double)); + } + } + + for(i=0; inb_tx*desc->nb_rx; i++) { + for (j = 0; jnb_taps; j++) { + for(k=0; knb_paths; k++) { + w_Hz[i][j][k] = desc->max_Doppler*cos(frand_a_b(0,2*M_PI)); + phi_rad[i][j][k] = frand_a_b(0,2*M_PI); + //printf("w_hz[%d][%d][%d]=f_d*cos(theta) = %f\n",i,j,k,w_Hz[i][j][k]); + //printf("phi_rad[%d][%d][%d] = %f\n",i,j,k,phi_rad[i][j][k]); + } + } } if(desc->ricean_factor == 1) { @@ -153,44 +168,34 @@ void tv_channel(channel_desc_t *desc,double complex ***H,uint32_t length){ } } - /* - // This is the code when we only consider a SISO case - for(i=0;inb_taps;j++) - { - for(p=0;pnb_paths;p++) - { - H[i][j] += sqrt(desc->amps[j]/2)*alpha[p]*cexp(-I*(2*pi*w_Hz[p]*i*(1/(desc->sampling_rate*1e6))+phi_rad[p])); - } - } - } - for(j=0;jnb_paths;j++) - { - phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi); - } - */ - - // if MIMO + // SISO or MIMO for (i=0; inb_rx; i++) { for(j=0; jnb_tx; j++) { - for(k=0; knb_taps; l++) { - H[i+(j*desc->nb_rx)][k][l] = 0; - + for(k=0; knb_taps; k++) { + for(l=0; lnb_paths; p++) { - H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[l]/2)*alpha[p]*cexp(I*(2*pi*w_Hz[p]*k*(1/(desc->sampling_rate*1e6))+phi_rad[p])); + H[i+(j*desc->nb_rx)][k][l] += sqrt(desc->amps[k])*alpha[p]*cexp(I*(2*pi*w_Hz[i+(j*desc->nb_rx)][k][p]*l*(1/(desc->sampling_rate*1e6))+phi_rad[i+(j*desc->nb_rx)][k][p])); } } - } - - for(j=0; jnb_paths; j++) { - phi_rad[j] = fmod(2*pi*w_Hz[j]*(length-1)*(1/desc->sampling_rate)+phi_rad[j],2*pi); + //printf("H[tx%d][rx%d][k%d] = %f+j%f \n",j,i,k,creal(H[i+(j*desc->nb_rx)][k][0]),cimag(H[i+(j*desc->nb_rx)][k][0])); } } } - + //accumlate the phase + /*for(k=0; knb_taps; k++) { + * for(j=0; jnb_paths; j++) { + * desc->random_phase[k][j] = fmod(2*pi*w_Hz[k][j]*(length-1)*(1/(desc->sampling_rate*1e6))+phi_rad[k][j],2*pi); + * } + * }*/ free(alpha); + for(i=0; inb_rx*desc->nb_tx; i++) { + for (j=0; jnb_taps; j++) { + free(w_Hz[i][j]); + free(phi_rad[i][j]); + } + free(w_Hz[i]); + free(phi_rad[i]); + } free(w_Hz); free(phi_rad); } @@ -203,7 +208,7 @@ void tv_conv(double complex **h, double complex *x, double complex *y, uint32_t for(i=0; i<((int)nb_samples-dd); i++) { for(j=0; jj) - y[i+dd] += creal(h[i][j])*creal(x[i-j])-cimag(h[i][j])*cimag(x[i-j]) + I*(creal(h[i][j])*cimag(x[i-j])+cimag(h[i][j])*creal(x[i-j])); + y[i+dd] += creal(h[j][i])*creal(x[i-j])-cimag(h[j][i])*cimag(x[i-j]) + I*(creal(h[j][i])*cimag(x[i-j])+cimag(h[j][i])*creal(x[i-j])); } } } diff --git a/openair1/SIMULATION/TOOLS/phase_noise.c b/openair1/SIMULATION/TOOLS/phase_noise.c index 5958a0ccdd..6cc24f23db 100644 --- a/openair1/SIMULATION/TOOLS/phase_noise.c +++ b/openair1/SIMULATION/TOOLS/phase_noise.c @@ -26,6 +26,7 @@ #include "sim.h" +static uint16_t LUTSin[ResolSinCos+1]; /* linear phase noise model */ void phase_noise(double ts, int16_t * InRe, int16_t * InIm) { diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index 8c063fadc0..d2339954bd 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -50,7 +50,7 @@ static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt) static telnetshell_cmddef_t channelmod_cmdarray[] = { {"help","",channelmod_print_help}, {"show","",channelmod_show_cmd}, - {"modify"," ",channelmod_modify_cmd}, + {"modify"," ",channelmod_modify_cmd}, {"","",NULL}, }; @@ -61,14 +61,17 @@ static telnetshell_vardef_t channelmod_vardef[] = { static double snr_dB=25; static double sinr_dB=0; static unsigned int max_chan; -static channel_desc_t** defined_channels; +static channel_desc_t **defined_channels; +static char modellist_name[MAX_OPTNAME_SIZE]= {0}; + + void fill_channel_desc(channel_desc_t *chan_desc, uint8_t nb_tx, uint8_t nb_rx, uint8_t nb_taps, uint8_t channel_length, double *amps, - double *delays, + double *delays, struct complex **R_sqrt, double Td, double sampling_rate, @@ -136,8 +139,10 @@ void fill_channel_desc(channel_desc_t *chan_desc, if (R_sqrt == NULL) { chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_NTAPS ; + for (i = 0; iR_sqrt[i] = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); + chan_desc->R_sqrt[i] = (struct complex *) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); + for (j = 0; jR_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].y = 0.0; @@ -145,7 +150,7 @@ void fill_channel_desc(channel_desc_t *chan_desc, } } else { chan_desc->R_sqrt = (struct complex **) calloc(nb_taps,sizeof(struct complex *)); - + for (i = 0; iR_sqrt[i] = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex)); //chan_desc->R_sqrt = (struct complex*)&R_sqrt[i][0]; @@ -175,224 +180,229 @@ void fill_channel_desc(channel_desc_t *chan_desc, double mbsfn_delays[] = {0,.03,.15,.31,.37,1.09,12.490,12.52,12.64,12.80,12.86,13.58,27.49,27.52,27.64,27.80,27.86,28.58}; double mbsfn_amps_dB[] = {0,-1.5,-1.4,-3.6,-0.6,-7.0,-10,-11.5,-11.4,-13.6,-10.6,-17.0,-20,-21.5,-21.4,-23.6,-20.6,-27}; -double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250}; +double scm_c_delays[] = {0, 0.0125, 0.0250, 0.3625, 0.3750, 0.3875, 0.2500, 0.2625, 0.2750, 1.0375, 1.0500, 1.0625, 2.7250, 2.7375, 2.7500, 4.6000, 4.6125, 4.6250}; double scm_c_amps_dB[] = {0.00, -2.22, -3.98, -1.86, -4.08, -5.84, -1.08, -3.30, -5.06, -9.08, -11.30, -13.06, -15.14, -17.36, -19.12, -20.64, -22.85, -24.62}; double tdl_a_delays[] = {0.0000, - 0.3819, - 0.4025, - 0.5868, - 0.4610, - 0.5375, - 0.6708, - 0.5750, - 0.7618, - 1.5375, - 1.8978, - 2.2242, - 2.1718, - 2.4942, - 2.5119, - 3.0582, - 4.0810, - 4.4579, - 4.5695, - 4.7966, - 5.0066, - 5.3043, - 9.6586}; + 0.3819, + 0.4025, + 0.5868, + 0.4610, + 0.5375, + 0.6708, + 0.5750, + 0.7618, + 1.5375, + 1.8978, + 2.2242, + 2.1718, + 2.4942, + 2.5119, + 3.0582, + 4.0810, + 4.4579, + 4.5695, + 4.7966, + 5.0066, + 5.3043, + 9.6586 + }; double tdl_a_amps_dB[] = {-13.4, - 0, - -2.2, - -4, - -6, - -8.2, - -9.9, - -10.5, - -7.5, - -15.9, - -6.6, - -16.7, - -12.4, - -15.2, - -10.8, - -11.3, - -12.7, - -16.2, - -18.3, - -18.9, - -16.6, - -19.9, - -29.7}; -#define TDL_A_PATHS 23 + 0, + -2.2, + -4, + -6, + -8.2, + -9.9, + -10.5, + -7.5, + -15.9, + -6.6, + -16.7, + -12.4, + -15.2, + -10.8, + -11.3, + -12.7, + -16.2, + -18.3, + -18.9, + -16.6, + -19.9, + -29.7 + }; double tdl_b_delays[] = {0.0000, - 0.1072, - 0.2155, - 0.2095, - 0.2870, - 0.2986, - 0.3752, - 0.5055, - 0.3681, - 0.3697, - 0.5700, - 0.5283, - 1.1021, - 1.2756, - 1.5474, - 1.7842, - 2.0169, - 2.8294, - 3.0219, - 3.6187, - 4.1067, - 4.2790, - 4.7834}; + 0.1072, + 0.2155, + 0.2095, + 0.2870, + 0.2986, + 0.3752, + 0.5055, + 0.3681, + 0.3697, + 0.5700, + 0.5283, + 1.1021, + 1.2756, + 1.5474, + 1.7842, + 2.0169, + 2.8294, + 3.0219, + 3.6187, + 4.1067, + 4.2790, + 4.7834 + }; double tdl_b_amps_dB[] = {0, - -2.2, - -4, - -3.2, - -9.8, - -1.2, - -3.4, - -5.2, - -7.6, - -3, - -8.9, - -9, - -4.8, - -5.7, - -7.5, - -1.9, - -7.6, - -12.2, - -9.8, - -11.4, - -14.9, - -9.2, - -11.3}; -#define TDL_B_PATHS 23 + -2.2, + -4, + -3.2, + -9.8, + -1.2, + -3.4, + -5.2, + -7.6, + -3, + -8.9, + -9, + -4.8, + -5.7, + -7.5, + -1.9, + -7.6, + -12.2, + -9.8, + -11.4, + -14.9, + -9.2, + -11.3 + }; double tdl_c_delays[] = {0, - 0.2099, - 0.2219, - 0.2329, - 0.2176, - 0.6366, - 0.6448, - 0.6560, - 0.6584, - 0.7935, - 0.8213, - 0.9336, - 1.2285, - 1.3083, - 2.1704, - 2.7105, - 4.2589, - 4.6003, - 5.4902, - 5.6077, - 6.3065, - 6.6374, - 7.0427, - 8.6523}; + 0.2099, + 0.2219, + 0.2329, + 0.2176, + 0.6366, + 0.6448, + 0.6560, + 0.6584, + 0.7935, + 0.8213, + 0.9336, + 1.2285, + 1.3083, + 2.1704, + 2.7105, + 4.2589, + 4.6003, + 5.4902, + 5.6077, + 6.3065, + 6.6374, + 7.0427, + 8.6523 + }; double tdl_c_amps_dB[] = {-4.4, - -1.2, - -3.5, - -5.2, - -2.5, - 0, - -2.2, - -3.9, - -7.4, - -7.1, - -10.7, - -11.1, - -5.1, - -6.8, - -8.7, - -13.2, - -13.9, - -13.9, - -15.8, - -17.1, - -16, - -15.7, - -21.6, - -22.8}; -#define TDL_C_PATHS 24 + -1.2, + -3.5, + -5.2, + -2.5, + 0, + -2.2, + -3.9, + -7.4, + -7.1, + -10.7, + -11.1, + -5.1, + -6.8, + -8.7, + -13.2, + -13.9, + -13.9, + -15.8, + -17.1, + -16, + -15.7, + -21.6, + -22.8 + }; double tdl_d_delays[] = {//0, - 0, - 0.035, - 0.612, - 1.363, - 1.405, - 1.804, - 2.596, - 1.775, - 4.042, - 7.937, - 9.424, - 9.708, - 12.525}; + 0, + 0.035, + 0.612, + 1.363, + 1.405, + 1.804, + 2.596, + 1.775, + 4.042, + 7.937, + 9.424, + 9.708, + 12.525 +}; double tdl_d_amps_dB[] = {//-0.2, -//-13.5, - -.00147, - -18.8, - -21, - -22.8, - -17.9, - -20.1, - -21.9, - -22.9, - -27.8, - -23.6, - -24.8, - -30.0, - -27.7}; + //-13.5, + -.00147, + -18.8, + -21, + -22.8, + -17.9, + -20.1, + -21.9, + -22.9, + -27.8, + -23.6, + -24.8, + -30.0, + -27.7 + }; -#define TDL_D_PATHS 13 #define TDL_D_RICEAN_FACTOR .046774 double tdl_e_delays[] = {0, - 0.5133, - 0.5440, - 0.5630, - 0.5440, - 0.7112, - 1.9092, - 1.9293, - 1.9589, - 2.6426, - 3.7136, - 5.4524, - 12.0034, - 20.6519}; + 0.5133, + 0.5440, + 0.5630, + 0.5440, + 0.7112, + 1.9092, + 1.9293, + 1.9589, + 2.6426, + 3.7136, + 5.4524, + 12.0034, + 20.6519 + }; double tdl_e_amps_dB[] = {//-0.03, - //-22.03, - -.00433, - -15.8, - -18.1, - -19.8, - -22.9, - -22.4, - -18.6, - -20.8, - -22.6, - -22.3, - -25.6, - -20.2, - -29.8, - -29.2}; + //-22.03, + -.00433, + -15.8, + -18.1, + -19.8, + -22.9, + -22.4, + -18.6, + -20.8, + -22.6, + -22.3, + -25.6, + -20.2, + -29.8, + -29.2 + }; -#define TDL_E_PATHS 14 #define TDL_E_RICEAN_FACTOR 0.0063096 double epa_delays[] = { 0,.03,.07,.09,.11,.19,.41}; @@ -494,31 +504,101 @@ struct complex *R_sqrt_22_EPA_medium[1] = {R_sqrt_22_EPA_medium_tap}; //Rayleigh1_orth_eff_ch_TM4 +void tdlModel(int tdl_paths, double *tdl_delays, double *tdl_amps_dB, double DS_TDL, channel_desc_t *chan_desc ) { + int nb_rx=chan_desc-> nb_rx; + int nb_tx=chan_desc-> nb_tx; + int tdl_pathsby3 = tdl_paths/3; + + if ((tdl_paths%3)>0) + tdl_pathsby3++; + + chan_desc->nb_taps = tdl_paths; + chan_desc->Td = tdl_delays[tdl_paths-1]*DS_TDL; + printf("last path (%d) at %f * %e = %e\n",tdl_paths-1,tdl_delays[tdl_paths-1],DS_TDL,chan_desc->Td); + chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + + 1 + + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); + printf("TDL : %f Ms/s, nb_taps %d, Td %e, channel_length %d\n",chan_desc->sampling_rate,tdl_paths,chan_desc->Td,chan_desc->channel_length); + double sum_amps = 0; + chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); + + for (int i = 0; inb_taps; i++) { + chan_desc->amps[i] = pow(10,.1*tdl_amps_dB[i]); + sum_amps += chan_desc->amps[i]; + } + + for (int i = 0; inb_taps; i++) { + chan_desc->amps[i] /= sum_amps; + tdl_delays[i] *= DS_TDL; + } + + chan_desc->delays = tdl_delays; + chan_desc->aoa = 0; + chan_desc->random_aoa = 0; + chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); + chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); + chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *)); + + for (int i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex)); + + for (int i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); + + for (int i = 0; inb_taps; i++) + chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex)); + + chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); + + if (nb_tx==2 && nb_rx==2) { + for (int i = 0; i<(tdl_pathsby3); i++) + chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0]; + } else if (nb_tx==2 && nb_rx==1) { + for (int i = 0; i<(tdl_pathsby3); i++) + chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0]; + } else if (nb_tx==1 && nb_rx==2) { + for (int i = 0; i<(tdl_pathsby3); i++) + chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; + } else { + for (int i = 0; i<(tdl_pathsby3); i++) { + chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); + + for (int j = 0; jR_sqrt[i][j].x = 1.0; + chan_desc->R_sqrt[i][j].y = 0.0; + } + + LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx); + } + } +} + channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, double sampling_rate, double channel_bandwidth, - double DS_TDL, + double DS_TDL, double forgetting_factor, int32_t channel_offset, - double path_loss_dB) { + double path_loss_dB, + float noise_power_dB) { channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t)); - for(int i=0; ichan_idx=i; - break; - } - else { - AssertFatal(i<(max_chan-1), - "No more channel descriptors available, increase channelmod.max_chan parameter above %u\n",max_chan); - } + + for(int i=0; ichan_idx=i; + break; + } else { + AssertFatal(i<(max_chan-1), + "No more channel descriptors available, increase channelmod.max_chan parameter above %u\n",max_chan); + } } + uint16_t i,j; double sum_amps; double aoa,ricean_factor,Td,maxDoppler; - int channel_length,nb_taps; chan_desc->modelid = channel_model; chan_desc->nb_tx = nb_tx; @@ -530,13 +610,13 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->path_loss_dB = path_loss_dB; chan_desc->first_run = 1; chan_desc->ip = 0.0; + chan_desc->noise_power_dB = noise_power_dB; LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model); - int tdl_paths=0; - double tdl_ricean_factor = 1; double *tdl_amps_dB; double *tdl_delays; + /* Spatial Channel Models (SCM) channel model from TR 38.901 Section 7.7.2 */ switch (channel_model) { case SCM_A: LOG_W(OCM,"channel model not yet supported\n"); @@ -554,7 +634,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -592,10 +673,11 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, for (i = 0; i<6; i++) chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; } else { - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); - + for (j = 0; jR_sqrt[i][j].x = 1.0; chan_desc->R_sqrt[i][j].y = 0.0; @@ -615,6 +697,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*scm_c_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -652,7 +735,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, for (i = 0; i<6; i++) chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; } else { - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -666,99 +750,41 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } break; - + /* tapped delay line (TDL) channel model from TR 38.901 Section 7.7.2 */ +#define tdl_m(MoDel)\ + DevAssert(sizeof(tdl_ ## MoDel ## _amps_dB) == sizeof(tdl_ ## MoDel ## _delays)); \ + tdl_paths=sizeof(tdl_ ## MoDel ## _amps_dB)/sizeof(*tdl_ ## MoDel ## _amps_dB);\ + tdl_delays=tdl_ ## MoDel ## _delays;\ + tdl_amps_dB=tdl_ ## MoDel ## _amps_dB + case TDL_A: + chan_desc->ricean_factor = 1; + tdl_m(a); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; + case TDL_B: - case TDL_C: - case TDL_D: + chan_desc->ricean_factor = 1; + tdl_m(b); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; + + case TDL_C: + chan_desc->ricean_factor = 1; + tdl_m(c); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; + + case TDL_D: + chan_desc->ricean_factor = TDL_D_RICEAN_FACTOR; + tdl_m(d); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); + break; + case TDL_E: - if (channel_model == TDL_A) { - tdl_paths=TDL_A_PATHS; - tdl_delays=tdl_a_delays; - tdl_amps_dB=tdl_a_amps_dB; - }else if (channel_model == TDL_B) { - tdl_paths=TDL_B_PATHS; - tdl_delays=tdl_b_delays; - tdl_amps_dB=tdl_b_amps_dB; - } - else if (channel_model == TDL_C) { - tdl_paths=TDL_C_PATHS; - tdl_delays=tdl_c_delays; - tdl_amps_dB=tdl_c_amps_dB; - printf("Initializing TDL_C channel with %d paths\n",TDL_C_PATHS); - } else if (channel_model == TDL_D) { - tdl_paths=TDL_D_PATHS; - tdl_delays=tdl_d_delays; - tdl_amps_dB=tdl_d_amps_dB; - tdl_ricean_factor = TDL_D_RICEAN_FACTOR; - } else if (channel_model == TDL_E) { - tdl_paths=TDL_E_PATHS-1; - tdl_delays=tdl_e_delays+1; - tdl_amps_dB=tdl_e_amps_dB; - tdl_ricean_factor = TDL_E_RICEAN_FACTOR; - } - - int tdl_pathsby3 = tdl_paths/3; - if ((tdl_paths%3)>0) tdl_pathsby3++; - - chan_desc->nb_taps = tdl_paths; - chan_desc->Td = tdl_delays[tdl_paths-1]*DS_TDL; - printf("last path (%d) at %f * %e = %e\n",tdl_paths-1,tdl_delays[tdl_paths-1],DS_TDL,chan_desc->Td); - chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); - printf("TDL : %f Ms/s, nb_taps %d, Td %e, channel_length %d\n",chan_desc->sampling_rate,tdl_paths,chan_desc->Td,chan_desc->channel_length); - sum_amps = 0; - chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); - - for (i = 0; inb_taps; i++) { - chan_desc->amps[i] = pow(10,.1*tdl_amps_dB[i]); - sum_amps += chan_desc->amps[i]; - } - - for (i = 0; inb_taps; i++) { - chan_desc->amps[i] /= sum_amps; - tdl_delays[i] *= DS_TDL; - } - chan_desc->delays = tdl_delays; - chan_desc->ricean_factor = tdl_ricean_factor; - chan_desc->aoa = 0; - chan_desc->random_aoa = 0; - chan_desc->ch = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); - chan_desc->chF = (struct complex **) malloc(nb_tx*nb_rx*sizeof(struct complex *)); - chan_desc->a = (struct complex **) malloc(chan_desc->nb_taps*sizeof(struct complex *)); - - for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex)); - - for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); - - for (i = 0; inb_taps; i++) - chan_desc->a[i] = (struct complex *) malloc(nb_tx*nb_rx * sizeof(struct complex)); - - chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); - - if (nb_tx==2 && nb_rx==2) { - for (i = 0; i<(tdl_pathsby3); i++) - chan_desc->R_sqrt[i] = (struct complex *) &R22_sqrt[i][0]; - } else if (nb_tx==2 && nb_rx==1) { - for (i = 0; i<(tdl_pathsby3); i++) - chan_desc->R_sqrt[i] = (struct complex *) &R21_sqrt[i][0]; - } else if (nb_tx==1 && nb_rx==2) { - for (i = 0; i<(tdl_pathsby3); i++) - chan_desc->R_sqrt[i] = (struct complex *) &R12_sqrt[i][0]; - } else { - for (i = 0; i<(tdl_pathsby3); i++) { - chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); - - for (j = 0; jR_sqrt[i][j].x = 1.0; - chan_desc->R_sqrt[i][j].y = 0.0; - } - - LOG_W(OCM,"correlation matrix not implemented for nb_tx==%d and nb_rx==%d, using identity\n", nb_tx, nb_rx); - } - } - + chan_desc->ricean_factor = TDL_E_RICEAN_FACTOR; + tdl_m(e); + tdlModel(tdl_paths, tdl_delays, tdl_amps_dB, DS_TDL, chan_desc); break; case EPA: @@ -768,6 +794,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -786,7 +813,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, for (i = 0; ich[i] = (struct complex *) malloc(chan_desc->channel_length * sizeof(struct complex)); - + for (i = 0; ichF[i] = (struct complex *) malloc(1200 * sizeof(struct complex)); @@ -801,6 +828,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } else { chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -822,6 +850,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -867,7 +896,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, LOG_W(OCM,"correlation matrix only implemented for nb_tx==2 and nb_rx==2, using identity\n"); } }*/ - break; + break; case EPA_high: chan_desc->nb_taps = 7; @@ -876,6 +905,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -929,7 +959,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->channel_length = (int) (2*chan_desc->sampling_rate*chan_desc->Td + 1 + 2/(M_PI*M_PI)*log(4*M_PI*chan_desc->sampling_rate*chan_desc->Td)); sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); - chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*epa_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -984,6 +1015,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*eva_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -1017,7 +1049,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } else { chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; - for (i = 0; i<6; i++) { + + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); for (j = 0; jamps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*etu_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -1071,6 +1105,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, } else { chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex **)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6 ; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -1092,6 +1127,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, sum_amps = 0; chan_desc->amps = (double *) malloc(chan_desc->nb_taps*sizeof(double)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_AMPS ; + for (i = 0; inb_taps; i++) { chan_desc->amps[i] = pow(10,.1*mbsfn_amps_dB[i]); sum_amps += chan_desc->amps[i]; @@ -1119,6 +1155,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->R_sqrt = (struct complex **) malloc(6*sizeof(struct complex *)); chan_desc->free_flags=chan_desc->free_flags|CHANMODEL_FREE_RSQRT_6; + for (i = 0; i<6; i++) { chan_desc->R_sqrt[i] = (struct complex *) malloc(nb_tx*nb_rx*nb_tx*nb_rx * sizeof(struct complex)); @@ -1185,11 +1222,11 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, 1); break; - case Rayleigh1: + case Rayleigh1://MIMO Test uses Rayleigh1 nb_taps = 1; Td = 0; channel_length = 1; - ricean_factor = 1; + ricean_factor = 0.0; aoa = .03; maxDoppler = 0; fill_channel_desc(chan_desc,nb_tx, @@ -1628,38 +1665,65 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, chan_desc->nb_paths = 10; return(chan_desc); -} - +} /* channel_desc_t *new_channel_desc_scm */ + +channel_desc_t *find_channel_desc_fromname( char *modelname ) { + for(int i=0; imodel_name,modelname) == 0) + return defined_channels[i]; + } + } + + LOG_E(OCM,"Model %s not found \n", modelname); + return NULL; +} /* channel_desc_t * new_channel_desc_fromconfig */ + + + void free_channel_desc_scm(channel_desc_t *ch) { // Must be made cleanly, a lot of leaks... - defined_channels[ch->chan_idx]=NULL; + if (max_chan != 0) defined_channels[ch->chan_idx]=NULL; if(ch->free_flags&CHANMODEL_FREE_AMPS) free(ch->amps); - for (int i = 0; inb_tx*ch->nb_rx; i++) { + + for (int i = 0; inb_tx*ch->nb_rx; i++) { free(ch->ch[i]); free(ch->chF[i]); } - + for (int i = 0; inb_taps; i++) { - free(ch->a[i]); - } + free(ch->a[i]); + } + if(ch->free_flags&CHANMODEL_FREE_DELAY) - free(ch->delays); + free(ch->delays); + if(ch->free_flags&CHANMODEL_FREE_RSQRT_6) - for (int i = 0; i<6; i++) - free(ch->R_sqrt[i]); + for (int i = 0; i<6; i++) + free(ch->R_sqrt[i]); + if(ch->free_flags&CHANMODEL_FREE_RSQRT_NTAPS) - for (int i = 0; inb_taps;i++) - free(ch->R_sqrt[i]); - free(ch->R_sqrt); - free(ch->ch); + for (int i = 0; inb_taps; i++) + free(ch->R_sqrt[i]); + + free(ch->R_sqrt); + free(ch->ch); free(ch->chF); - free(ch->a); - free(ch); + free(ch->a); + free(ch->model_name); + free(ch); } void set_channeldesc_owner(channel_desc_t *cdesc, uint32_t module_id) { - cdesc->module_id=module_id; + cdesc->module_id=module_id; +} + +void set_channeldesc_name(channel_desc_t *cdesc,char *modelname) { + if(cdesc->model_name != NULL) + free(cdesc->model_name); + + cdesc->model_name=strdup(modelname); } int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { @@ -1780,14 +1844,14 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { desc->ch[aarx+(aatx*desc->nb_rx)][k].x += s*desc->a[l][aarx+(aatx*desc->nb_rx)].x; desc->ch[aarx+(aatx*desc->nb_rx)][k].y += s*desc->a[l][aarx+(aatx*desc->nb_rx)].y; - // printf("l %d : desc->ch.x %f, s %e, delay %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x,s,desc->delays[l]); + // printf("l %d : desc->ch.x %f, s %e, delay %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x,s,desc->delays[l]); } //nb_taps #ifdef DEBUG_CH printf("(%d,%d,%d)->(%e,%e)\n",k,aarx,aatx,desc->ch[aarx+(aatx*desc->nb_rx)][k].x,desc->ch[aarx+(aatx*desc->nb_rx)][k].y); #endif } //channel_length - } + } } //aatx } //aarx @@ -1799,7 +1863,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { return (0); } - + double N_RB2sampling_rate(uint16_t N_RB) { double sampling_rate; @@ -1848,128 +1912,143 @@ double N_RB2channel_bandwidth(uint16_t N_RB) { break; default: - LOG_E(PHY,"Unknown N_PRB\n"); + LOG_E(OCM,"Unknown N_PRB\n"); return(-1); } - return(channel_bandwidth); -} - + return(channel_bandwidth); +} + + static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt ) { - prnt("channelmod commands can be used to display or modify channel models parameters\n"); - prnt("channelmod show predef: display predefined model algorithms available in oai\n"); - prnt("channelmod show current: display the currently used models in the running executable\n"); - prnt("channelmod modify : set the specified parameters in a current model to the given value\n"); - prnt(" specifies the model, the show current model command can be used to list the current models indexes\n"); - prnt(" can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"offset\", \"forgetf\"\n"); - return CMDSTATUS_FOUND; + prnt("channelmod commands can be used to display or modify channel models parameters\n"); + prnt("channelmod show predef: display predefined model algorithms available in oai\n"); + prnt("channelmod show current: display the currently used models in the running executable\n"); + prnt("channelmod modify : set the specified parameters in a current model to the given value\n"); + prnt(" specifies the model, the show current model command can be used to list the current models indexes\n"); + prnt(" can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"noise_power_dB\", \"offset\", \"forgetf\"\n"); + return CMDSTATUS_FOUND; } static void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_t prnt) { - char *module_id_str[]=MODULEID_STR_INIT; - if (cd->module_id != 0) { - prnt("model owner: %s\n",module_id_str[cd->module_id]); - } - prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate); - prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n", - cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No")); - prnt("max Doppler: %lf path loss: %lf rchannel offset: %i forget factor; %lf\n", - cd->max_Doppler, cd->path_loss_dB, cd->channel_offset, cd->forgetting_factor); - prnt("Initial phase: %lf nb_path: %i \n", - cd->ip, cd->nb_paths); - for (int i=0; inb_taps ; i++) { - prnt("taps: %i lin. ampli. : %lf delay: %lf \n",i,cd->amps[i], cd->delays[i]); - } + char *module_id_str[]=MODULEID_STR_INIT; + prnt("model owner: %s\n",(cd->module_id != 0)?module_id_str[cd->module_id]:"not set"); + prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate); + prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n", + cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No")); + prnt("max Doppler: %lf path loss: %lf noise: %lf rchannel offset: %i forget factor; %lf\n", + cd->max_Doppler, cd->path_loss_dB, cd->noise_power_dB, cd->channel_offset, cd->forgetting_factor); + prnt("Initial phase: %lf nb_path: %i \n", + cd->ip, cd->nb_paths); + + for (int i=0; inb_taps ; i++) { + prnt("taps: %i lin. ampli. : %lf delay: %lf \n",i,cd->amps[i], cd->delays[i]); + } } - - + + static int channelmod_show_cmd(char *buff, int debug, telnet_printfunc_t prnt) { - char *subcmd=NULL; + char *subcmd=NULL; int s = sscanf(buff,"%ms\n",&subcmd); if (s>0) { if ( strcmp(subcmd,"predef") == 0) { for (int i=0; channelmod_names[i].name != NULL ; i++) { prnt(" %i %s\n", i, map_int_to_str(channelmod_names,i )); - } + } } else if ( strcmp(subcmd,"current") == 0) { for (int i=0; i < max_chan ; i++) { - if (defined_channels[i] != NULL) { - prnt("model %i %s: \n----------------\n", i, map_int_to_str(channelmod_names,defined_channels[i]->modelid)); - display_channelmodel(defined_channels[i],debug,prnt); + if (defined_channels[i] != NULL) { + prnt("model %i %s type %s: \n----------------\n", i, (defined_channels[i]->model_name !=NULL)?defined_channels[i]->model_name:"(no name set)", + map_int_to_str(channelmod_names,defined_channels[i]->modelid)); + display_channelmodel(defined_channels[i],debug,prnt); } } } else { - channelmod_print_help(buff, debug, prnt); + channelmod_print_help(buff, debug, prnt); } - free(subcmd); + + free(subcmd); } + return CMDSTATUS_FOUND; } - + static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt) { - char *param=NULL, *value=NULL; + char *param=NULL, *value=NULL; int cd_id= -1; int s = sscanf(buff,"%i %ms %ms \n",&cd_id,¶m, &value); + if (cd_id<0 || cd_id >= max_chan) { - prnt("ERROR, %i: Channel model id outof range (0-%i)\n",cd_id,max_chan-1); - return CMDSTATUS_FOUND; + prnt("ERROR, %i: Channel model id outof range (0-%i)\n",cd_id,max_chan-1); + return CMDSTATUS_FOUND; } + if (defined_channels[cd_id]==NULL) { - prnt("ERROR, %i: Channel model has not been set\n",cd_id); - return CMDSTATUS_FOUND; - } - + prnt("ERROR, %i: Channel model has not been set\n",cd_id); + return CMDSTATUS_FOUND; + } + if (s==3) { if ( strcmp(param,"riceanf") == 0) { - double dbl = atof(value); - if (dbl <0 || dbl > 1) - prnt("ERROR: ricean factor range: 0 to 1, %lf is outof range\n",dbl); - else - defined_channels[cd_id]->ricean_factor=dbl; + double dbl = atof(value); + + if (dbl <0 || dbl > 1) + prnt("ERROR: ricean factor range: 0 to 1, %lf is outof range\n",dbl); + else + defined_channels[cd_id]->ricean_factor=dbl; } else if ( strcmp(param,"aoa") == 0) { - double dbl = atof(value); - if (dbl <0 || dbl >6.28) - prnt("ERROR: angle of arrival range: 0 to 2*Pi, %lf is outof range\n",dbl); - else - defined_channels[cd_id]->aoa=dbl; + double dbl = atof(value); + + if (dbl <0 || dbl >6.28) + prnt("ERROR: angle of arrival range: 0 to 2*Pi, %lf is outof range\n",dbl); + else + defined_channels[cd_id]->aoa=dbl; } else if ( strcmp(param,"randaoa") == 0) { - int i = atoi(value); - if (i!=0 && i!=1) - prnt("ERROR: randaoa is a boolean, must be 0 or 1\n"); - else - defined_channels[cd_id]->random_aoa=i; + int i = atoi(value); + + if (i!=0 && i!=1) + prnt("ERROR: randaoa is a boolean, must be 0 or 1\n"); + else + defined_channels[cd_id]->random_aoa=i; } else if ( strcmp(param,"ploss") == 0) { - double dbl = atof(value); - defined_channels[cd_id]->path_loss_dB=dbl; + double dbl = atof(value); + defined_channels[cd_id]->path_loss_dB=dbl; + } else if ( strcmp(param,"noise_power_dB") == 0) { + double dbl = atof(value); + defined_channels[cd_id]->noise_power_dB=dbl; } else if ( strcmp(param,"offset") == 0) { - int i = atoi(value); - defined_channels[cd_id]->channel_offset=i; + int i = atoi(value); + defined_channels[cd_id]->channel_offset=i; } else if ( strcmp(param,"forgetf") == 0) { - double dbl = atof(value); - if (dbl <0 || dbl > 1) - prnt("ERROR: forgetting factor range: 0 to 1 (disable variation), %lf is outof range\n",dbl); - else - defined_channels[cd_id]->forgetting_factor=dbl; + double dbl = atof(value); + + if (dbl <0 || dbl > 1) + prnt("ERROR: forgetting factor range: 0 to 1 (disable variation), %lf is outof range\n",dbl); + else + defined_channels[cd_id]->forgetting_factor=dbl; } else { - prnt("ERROR: %s, unknown channel parameter\n",param); - return CMDSTATUS_FOUND; + prnt("ERROR: %s, unknown channel parameter\n",param); + return CMDSTATUS_FOUND; } - display_channelmodel(defined_channels[cd_id],debug,prnt); - free(param); - free(value); - random_channel(defined_channels[cd_id],false); + display_channelmodel(defined_channels[cd_id],debug,prnt); + free(param); + free(value); + random_channel(defined_channels[cd_id],false); } - return CMDSTATUS_FOUND; + + return CMDSTATUS_FOUND; } - -int modelid_fromname(char *modelname) { - int modelid=map_str_to_int(channelmod_names,modelname); - if (modelid < 0) - LOG_E(OCM,"random_channel.c: Error channel model %s unknown\n",modelname); + +int modelid_fromstrtype(char *modeltype) { + int modelid=map_str_to_int(channelmod_names,modeltype); + + if (modelid < 0) + LOG_E(OCM,"random_channel.c: Error channel model %s unknown\n",modeltype); + return modelid; } @@ -1983,18 +2062,61 @@ double channelmod_get_sinr_dB(void) { void init_channelmod(void) { paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC; - int ret = config_get( channelmod_params,sizeof(channelmod_params)/sizeof(paramdef_t),CHANNELMOD_SECTION); + int numparams=sizeof(channelmod_params)/sizeof(paramdef_t); + int ret = config_get( channelmod_params,numparams,CHANNELMOD_SECTION); AssertFatal(ret >= 0, "configuration couldn't be performed"); - defined_channels=calloc(max_chan,sizeof( channel_desc_t*)); + defined_channels=calloc(max_chan,sizeof( channel_desc_t *)); AssertFatal(defined_channels!=NULL, "couldn't allocate %u channel descriptors\n",max_chan); - /* look for telnet server, if it is loaded, add the channel modeling commands to it */ add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME); if (addcmd != NULL) { addcmd("channelmod",channelmod_vardef,channelmod_cmdarray); } -} +} /* init_channelmod */ + + +int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) { + paramdef_t achannel_params[] = CHANNELMOD_MODEL_PARAMS_DESC; + paramlist_def_t channel_list; + memset(&channel_list,0,sizeof(paramlist_def_t)); + memcpy(channel_list.listname,modellist_name,sizeof(channel_list.listname)-1); + int numparams = sizeof(achannel_params)/sizeof(paramdef_t); + config_getlist( &channel_list,achannel_params,numparams, CHANNELMOD_SECTION); + AssertFatal(channel_list.numelt>0, "List %s.%s not found in config file\n",CHANNELMOD_SECTION,channel_list.listname); + int pindex_NAME = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NAME_PNAME); + int pindex_DT = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_DT_PNAME ); + int pindex_FF = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_FF_PNAME ); + int pindex_CO = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_CO_PNAME ); + int pindex_PL = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_PL_PNAME ); + int pindex_NP = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_NP_PNAME ); + int pindex_TYPE = config_paramidx_fromname(achannel_params,numparams, CHANNELMOD_MODEL_TYPE_PNAME); + + for (int i=0; imodel_name = strdup(*(channel_list.paramarray[i][pindex_NAME].strptr)); + LOG_I(OCM,"Model %s type %s allocated from config file, list %s\n",*(channel_list.paramarray[i][pindex_NAME].strptr), + *(channel_list.paramarray[i][pindex_TYPE].strptr), modellist_name); + } /* for loop on channel_list */ + + return channel_list.numelt; +} /* load_channelist */ #ifdef RANDOM_CHANNEL_MAIN #define sampling_rate 5.0 diff --git a/openair1/SIMULATION/TOOLS/sim.h b/openair1/SIMULATION/TOOLS/sim.h index 55a78e9778..78e260b73f 100644 --- a/openair1/SIMULATION/TOOLS/sim.h +++ b/openair1/SIMULATION/TOOLS/sim.h @@ -89,6 +89,7 @@ typedef struct { double path_loss_dB; ///additional delay of channel in samples. int32_t channel_offset; + float noise_power_dB; ///This parameter (0...1) allows for simple 1st order temporal variation. 0 means a new channel every call, 1 means keep channel constant all the time double forgetting_factor; ///needs to be set to 1 for the first call, 0 otherwise. @@ -106,8 +107,10 @@ typedef struct { unsigned int chan_idx; /// id of the channel modeling algorithm int modelid; - /// identifies channel descriptor owner (the module which created this descriptor) + /// identifies channel descriptor owner (the module which created this descriptor channelmod_moduleid_t module_id; + /// name of this descriptor,used for model created from config file at init time + char *model_name; /// flags to properly trigger memory free unsigned int free_flags; } channel_desc_t; @@ -241,12 +244,37 @@ typedef enum { #define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n" #define CHANNELMOD_SECTION "channelmod" + +/* global channel modelization parameters */ +#define CHANNELMOD_MODELLIST_PARANAME "modellist" + +#define CHANNELMOD_HELP_MODELLIST " channel list name in config file describing the model type and its parameters\n" #define CHANNELMOD_PARAMS_DESC { \ - {"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\ - {"sinr_dB", NULL, 0 , dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\ - {"max_chan, CONFIG_HLP_MAX_CHAN", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\ + {"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0},\ + {"sinr_dB", NULL, 0, dblptr:&sinr_dB, defdblval:0 , TYPE_DOUBLE, 0},\ + {"max_chan", "Max number of runtime models", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\ + {CHANNELMOD_MODELLIST_PARANAME, CHANNELMOD_HELP_MODELLIST, 0, strptr:(char **)&modellist_name, defstrval:"DefaultChannelList", TYPE_STRING, 60 },\ } +/* parameters for one model */ +#define CHANNELMOD_MODEL_NAME_PNAME "model_name" +#define CHANNELMOD_MODEL_TYPE_PNAME "type" +#define CHANNELMOD_MODEL_PL_PNAME "ploss_dB" +#define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB" +#define CHANNELMOD_MODEL_FF_PNAME "forgetfact" +#define CHANNELMOD_MODEL_CO_PNAME "offset" +#define CHANNELMOD_MODEL_DT_PNAME "ds_tdl" + +#define CHANNELMOD_MODEL_PARAMS_DESC { \ + {CHANNELMOD_MODEL_NAME_PNAME, "name of the model\n", 0, strptr:NULL , defstrval:"", TYPE_STRING, 0 },\ + {CHANNELMOD_MODEL_TYPE_PNAME, "name of the model type\n", 0, strptr:NULL , defstrval:"AWGN", TYPE_STRING, 0 },\ + {CHANNELMOD_MODEL_PL_PNAME, "channel path loss in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_NP_PNAME, "channel noise in dB\n", 0, dblptr:NULL, defdblval:-50, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_FF_PNAME, "channel forget factor ((0 to 1)\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\ + {CHANNELMOD_MODEL_CO_PNAME, "channel offset in samps\n", 0, iptr:NULL, defintval:0, TYPE_INT, 0 },\ + {CHANNELMOD_MODEL_DT_PNAME, "delay spread for TDL models\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 }\ +} + #include "platform_constants.h" typedef struct { @@ -275,12 +303,17 @@ typedef struct { channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, uint8_t nb_rx, SCM_t channel_model, - double sampling_rate, + double sampling_rate, double channel_bandwidth, - double TDL_DS, + double TDL_DS, double forgetting_factor, int32_t channel_offset, - double path_loss_dB); + double path_loss_dB, + float noise_power_dB); + +channel_desc_t *find_channel_desc_fromname( char *modelname ); + + /** \brief free memory allocated for a model descriptor \param ch points to the model, which cannot be used after calling this fuction @@ -293,6 +326,12 @@ void free_channel_desc_scm(channel_desc_t *ch); \param module_id identifies the channel model. should be define as a macro in simu.h */ void set_channeldesc_owner(channel_desc_t *cdesc, channelmod_moduleid_t module_id); +/** +\brief This function set a model name to a model descriptor, can be later used to identify a allocated channel model +\param cdesc points to the model descriptor +\param module_name is the C string to use as model name for the channel pointed by cdesc +*/ +void set_channeldesc_name(channel_desc_t *cdesc,char *modelname); /** \fn void random_channel(channel_desc_t *desc) \brief This routine generates a random channel response (time domain) according to a tapped delay line model. \param desc Pointer to the channel descriptor @@ -300,10 +339,10 @@ void set_channeldesc_owner(channel_desc_t *cdesc, channelmod_moduleid_t module_i int random_channel(channel_desc_t *desc, uint8_t abstraction_flag); /**\fn void multipath_channel(channel_desc_t *desc, - double tx_sig_re[2], - double tx_sig_im[2], - double rx_sig_re[2], - double rx_sig_im[2], + double tx_sig_re[NB_ANTENNAS_TX], + double tx_sig_im[NB_ANTENANS_TX], + double rx_sig_re[NB_ANTENNAS_RX], + double rx_sig_im[NB_ANTENNAS_RX], uint32_t length, uint8_t keep_channel, int log_channel) @@ -320,10 +359,10 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag); */ void multipath_channel(channel_desc_t *desc, - double *tx_sig_re[2], - double *tx_sig_im[2], - double *rx_sig_re[2], - double *rx_sig_im[2], + double *tx_sig_re[NB_ANTENNAS_TX], + double *tx_sig_im[NB_ANTENNAS_TX], + double *rx_sig_re[NB_ANTENNAS_RX], + double *rx_sig_im[NB_ANTENNAS_RX], uint32_t length, uint8_t keep_channel, int log_channel); @@ -452,11 +491,11 @@ void multipath_tv_channel(channel_desc_t *desc, /**@} */ /**@} */ -int modelid_fromname(char *modelname); +int modelid_fromstrtype(char *modeltype); double channelmod_get_snr_dB(void); double channelmod_get_sinr_dB(void); void init_channelmod(void) ; - +int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) ; double N_RB2sampling_rate(uint16_t N_RB); double N_RB2channel_bandwidth(uint16_t N_RB); @@ -468,11 +507,9 @@ double N_RB2channel_bandwidth(uint16_t N_RB); */ //look-up table for the sine (cosine) function #define ResolSinCos 100 -uint16_t LUTSin[ResolSinCos+1]; void InitSinLUT( void ); void phase_noise(double ts, int16_t * InRe, int16_t * InIm); -#include "targets/RT/USER/rfsim.h" void do_DL_sig(sim_t *sim, uint16_t subframe, diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h index 8fde343000..f5b6314fe1 100644 --- a/openair2/COMMON/gtpv1_u_messages_types.h +++ b/openair2/COMMON/gtpv1_u_messages_types.h @@ -175,6 +175,8 @@ typedef struct gtpv1u_enb_end_marker_ind_s { typedef struct { in_addr_t enb_ip_address_for_S1u_S12_S4_up; tcp_udp_port_t enb_port_for_S1u_S12_S4_up; + char addrStr[256]; + char portStr[256]; } Gtpv1uS1Req; typedef struct { diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h index 4a0a6027bc..5a45f2f196 100644 --- a/openair2/COMMON/mac_rrc_primitives.h +++ b/openair2/COMMON/mac_rrc_primitives.h @@ -189,7 +189,7 @@ typedef struct MEAS_REQ_TABLE_ENTRY { MAC_MEAS_REQ Mac_meas_req; unsigned int Last_report_frame; unsigned int Next_check_frame; - uint8_t Status; + uint8_t StatusMeas; uint8_t Meas_req_status; uint8_t Rx_activity; //uint8_t Meas_Direction;//??? @@ -269,7 +269,7 @@ typedef struct { char Wideband_sinr; uint8_t Forg_fact; unsigned short Rep_interval; - uint8_t Status; + uint8_t StatusMeas; unsigned int Last_report_frame; unsigned int Next_check_frame; uint8_t Active; @@ -299,7 +299,7 @@ typedef struct { unsigned short Rep_interval; unsigned int Last_report_frame; unsigned int Next_check_frame; - uint8_t Status; //IDLE,NEED_rADIO_CONFIG, RADIO_CONFIG_TX, RADIO_CONFIG_ok + uint8_t StatusMeas; //IDLE,NEED_rADIO_CONFIG, RADIO_CONFIG_TX, RADIO_CONFIG_ok uint8_t Active; } __attribute__ ((__packed__)) DEFAULT_CH_MEAS; #define DEFAULT_eNB_MEAS_SIZE sizeof(DEFAULT_eNB_MEAS) diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 3915f12bb9..acfc0920aa 100644 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -28,12 +28,14 @@ ***************************************************************************/ -#include "LTE_asn_constant.h" -#include "NR_asn_constant.h" #ifndef __PLATFORM_CONSTANTS_H__ # define __PLATFORM_CONSTANTS_H__ +#include "LTE_asn_constant.h" +#include "NR_asn_constant.h" +#define NR_MAXDRB 14 + #ifdef JUMBO_FRAME #define NL_MAX_PAYLOAD 18000 /* this should cover the max mtu size*/ #else @@ -87,13 +89,6 @@ #define MAX_gNB 2 #endif -#define NUMBER_OF_NR_DLSCH_MAX 2//16 -#define NUMBER_OF_NR_ULSCH_MAX 2//16 -#define NUMBER_OF_NR_SCH_STATS_MAX 16 -#define NUMBER_OF_NR_PUCCH_MAX 16 -#define NUMBER_OF_NR_SR_MAX 16 -#define NUMBER_OF_NR_PDCCH_MAX 16 - #define MAX_MANAGED_ENB_PER_MOBILE 2 #define MAX_MANAGED_GNB_PER_MOBILE 2 diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 87f926b206..64c42eaf0e 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -409,6 +409,7 @@ typedef struct NRRrcConfigurationReq_s { NR_ServingCellConfig_t *scd; int ssb_SubcarrierOffset; int pdsch_AntennaPorts; + int pusch_AntennaPorts; int pusch_TargetSNRx10; int pucch_TargetSNRx10; } gNB_RrcConfigurationReq; diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h deleted file mode 100644 index 33b6d5f9d4..0000000000 --- a/openair2/COMMON/tasks_def.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -// This task is mandatory and must always be placed in first position -TASK_DEF(TASK_TIMER, TASK_PRIORITY_MAX, 10) - -// Other possible tasks in the process - -// Common tasks: - -/// Bearers Manager task -TASK_DEF(TASK_BM, TASK_PRIORITY_MED, 200) - -// eNodeB tasks and sub-tasks: - -/// Radio Resource Control task -TASK_DEF(TASK_RRC_ENB, TASK_PRIORITY_MED, 200) - -// Define here for now -TASK_DEF(TASK_RRC_ENB_NB_IoT, TASK_PRIORITY_MED, 200) - -TASK_DEF(TASK_RRC_GNB, TASK_PRIORITY_MED, 200) - -/// S1ap task -/// RAL task for ENB -TASK_DEF(TASK_RAL_ENB, TASK_PRIORITY_MED, 200) - -// UDP TASK -TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000) -// GTP_V1U task -TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000) -TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) -TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200) -TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200) -/// M3ap task, acts as both source and target -TASK_DEF(TASK_M3AP, TASK_PRIORITY_MED, 200) -/// M3ap task, acts as both source and target -TASK_DEF(TASK_M3AP_MME, TASK_PRIORITY_MED, 200) -/// M3ap task, acts as both source and target -TASK_DEF(TASK_M3AP_MCE, TASK_PRIORITY_MED, 200) -/// M2ap task, acts as both source and target -TASK_DEF(TASK_M2AP_MCE, TASK_PRIORITY_MED, 200) -TASK_DEF(TASK_M2AP_ENB, TASK_PRIORITY_MED, 200) -/// X2ap task, acts as both source and target -TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200) -/// Sctp task (Used by both S1AP and X2AP) -TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200) -/// eNB APP task -TASK_DEF(TASK_ENB_APP, TASK_PRIORITY_MED, 200) -/// gNB APP task -TASK_DEF(TASK_GNB_APP, TASK_PRIORITY_MED, 200) -/// eNB Agent task -TASK_DEF(TASK_FLEXRAN_AGENT, TASK_PRIORITY_MED, 200) -TASK_DEF(TASK_PROTO_AGENT, TASK_PRIORITY_MED, 200) -// UE tasks and sub-tasks: - -/// Radio Resource Control task -TASK_DEF(TASK_RRC_UE, TASK_PRIORITY_MED, 200) -TASK_DEF(TASK_RRC_NRUE, TASK_PRIORITY_MED, 200) -/// Non Access Stratum task -TASK_DEF(TASK_NAS_UE, TASK_PRIORITY_MED, 200) -TASK_DEF(TASK_RAL_UE, TASK_PRIORITY_MED, 200) - -//MESSAGE GENERATOR TASK -TASK_DEF(TASK_MSC, TASK_PRIORITY_MED, 200) - -#ifdef ITTI_SIM -TASK_DEF(TASK_RRC_GNB_SIM, TASK_PRIORITY_MED, 200) -TASK_DEF(TASK_RRC_UE_SIM, TASK_PRIORITY_MED, 200) -#endif - diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c index 7ca466e8ff..51e495b027 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c @@ -42,6 +42,9 @@ #include +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + /*Array containing the Agent-MAC interfaces*/ AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]; diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c index 42246c3ebf..e05fa98854 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c @@ -33,6 +33,9 @@ #include "flexran_agent_mac_internal.h" #include "flexran_agent_mac_slice_verification.h" +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + extern SLIST_HEAD(flexran_so_handle, flexran_agent_so_handle_s) flexran_handles[NUM_MAX_ENB]; diff --git a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h index 9db5d61a11..d6dd6e3b6f 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h +++ b/openair2/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.h @@ -51,8 +51,6 @@ typedef struct { pthread_mutex_t *mutex; } mac_stats_updates_context_t; -/*Array holding the last stats reports for each eNB. Used for continuous reporting*/ -mac_stats_updates_context_t mac_stats_context[NUM_MAX_ENB]; /*Functions to initialize and destroy the struct required for the *continuous stats update report*/ diff --git a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h index 5f6432732f..a9236af80b 100644 --- a/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h +++ b/openair2/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc_defs.h @@ -49,8 +49,6 @@ typedef struct /*To Be Extended*/ }rrc_meas_stats; -/* RRC CMI statistics */ -rrc_meas_stats * meas_stats; /* FLEXRAN AGENT-RRC Interface */ diff --git a/openair2/ENB_APP/MACRLC_paramdef.h b/openair2/ENB_APP/MACRLC_paramdef.h index fcee6142f0..11cbe445b8 100644 --- a/openair2/ENB_APP/MACRLC_paramdef.h +++ b/openair2/ENB_APP/MACRLC_paramdef.h @@ -56,10 +56,14 @@ #define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd" #define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd" #define CONFIG_STRING_MACRLC_SCHED_MODE "scheduler_mode" -#define CONFIG_MACRLC_PUSCH10xSNR "puSch10xSnr" -#define CONFIG_MACRLC_PUCCH10xSNR "puCch10xSnr" +#define CONFIG_STRING_MACRLC_PUSCH10xSNR "puSch10xSnr" +#define CONFIG_STRING_MACRLC_PUCCH10xSNR "puCch10xSnr" #define CONFIG_STRING_MACRLC_DEFAULT_SCHED_DL_ALGO "default_sched_dl_algo" - +#define CONFIG_STRING_MACRLC_UE_MULTIPLE_MAX "ue_multiple_max" +#define CONFIG_STRING_MACRLC_USE_MCS_OFFSET "use_mcs_offset" +#define CONFIG_STRING_MACRLC_BLER_TARGET_LOWER "bler_target_lower" +#define CONFIG_STRING_MACRLC_BLER_TARGET_UPPER "bler_target_upper" +#define CONFIG_STRING_MACRLC_MAX_UL_RB_INDEX "max_ul_rb_index" /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* MacRLC configuration parameters */ /* optname helpstr paramflags XXXptr defXXXval type numelt */ @@ -83,10 +87,15 @@ {CONFIG_STRING_MACRLC_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \ {CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \ {CONFIG_STRING_MACRLC_SCHED_MODE, NULL, 0, strptr:NULL, defstrval:"default", TYPE_STRING, 0}, \ -{CONFIG_MACRLC_PUSCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ -{CONFIG_MACRLC_PUCCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ -{CONFIG_STRING_MACRLC_DEFAULT_SCHED_DL_ALGO, NULL, 0, strptr:NULL, defstrval:"round_robin_dl", TYPE_STRING, 0}, \ -} +{CONFIG_STRING_MACRLC_PUSCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ +{CONFIG_STRING_MACRLC_PUCCH10xSNR, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ +{CONFIG_STRING_MACRLC_DEFAULT_SCHED_DL_ALGO, NULL, 0, strptr:NULL, defstrval:"round_robin_dl", TYPE_STRING, 0}, \ +{CONFIG_STRING_MACRLC_UE_MULTIPLE_MAX, NULL, 0, iptr:NULL, defintval:4, TYPE_INT, 0}, \ +{CONFIG_STRING_MACRLC_USE_MCS_OFFSET, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ +{CONFIG_STRING_MACRLC_BLER_TARGET_LOWER, NULL, 0, dblptr:NULL, defdblval:.5, TYPE_DOUBLE, 0}, \ +{CONFIG_STRING_MACRLC_BLER_TARGET_UPPER, NULL, 0, dblptr:NULL, defdblval:2, TYPE_DOUBLE, 0}, \ +{CONFIG_STRING_MACRLC_MAX_UL_RB_INDEX, NULL, 0, iptr:NULL, defintval:22, TYPE_INT, 0}} + #define MACRLC_CC_IDX 0 #define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1 #define MACRLC_LOCAL_N_IF_NAME_IDX 2 @@ -108,6 +117,11 @@ #define MACRLC_PUSCH10xSNR_IDX 18 #define MACRLC_PUCCH10xSNR_IDX 19 #define MACRLC_DEFAULT_SCHED_DL_ALGO_IDX 20 +#define MACRLC_UE_MULTIPLE_MAX_IDX 21 +#define MACRLC_USE_MCS_OFFSET_IDX 22 +#define MACRLC_BLER_TARGET_LOWER_IDX 23 +#define MACRLC_BLER_TARGET_UPPER_IDX 24 +#define MACRLC_MAX_UL_RB_INDEX_IDX 25 /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/ENB_APP/NB_IoT_interface.c b/openair2/ENB_APP/NB_IoT_interface.c index 7355233d71..8fc6de78af 100644 --- a/openair2/ENB_APP/NB_IoT_interface.c +++ b/openair2/ENB_APP/NB_IoT_interface.c @@ -35,6 +35,9 @@ #define NBIOT_INTERFACE_SOURCE #include "NB_IoT_interface.h" +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + diff --git a/openair2/ENB_APP/NB_IoT_interface.h b/openair2/ENB_APP/NB_IoT_interface.h index b3454b077b..c13f6dd1cb 100644 --- a/openair2/ENB_APP/NB_IoT_interface.h +++ b/openair2/ENB_APP/NB_IoT_interface.h @@ -31,6 +31,7 @@ #define NBIOT_MODULENAME "NB_IoT" +#include "common/ran_context.h" typedef void(*RCConfig_NbIoT_f_t)(RAN_CONTEXT_t *RC); #define NBIOT_RCCONFIG_FNAME "RCConfig_NbIoT" diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index 5080157c3f..9f134f826e 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -244,6 +244,8 @@ void *eNB_app_task(void *args_p) { } + LOG_I(ENB_APP,"TASK_ENB_APP is ready\n"); + do { // Wait for a message itti_receive_msg (TASK_ENB_APP, &msg_p); diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index d05fe7ac26..fe706b2143 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -57,12 +57,15 @@ #include "enb_paramdef.h" #include "proto_agent.h" #include "executables/thread-common.h" +#include extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw); extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw); extern char *parallel_config; extern char *worker_config; +RAN_CONTEXT_t RC; + void RCconfig_flexran() { /* get number of eNBs */ paramdef_t ENBSParams[] = ENBSPARAMS_DESC; @@ -217,13 +220,26 @@ void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) { for (j = 0; j < RC.nb_macrlc_inst; j++) { RC.mac[j]->puSch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUSCH10xSNR_IDX ].iptr); RC.mac[j]->puCch10xSnr = *(MacRLC_ParamList.paramarray[j][MACRLC_PUCCH10xSNR_IDX ].iptr); + RC.mac[j]->ue_multiple_max = *(MacRLC_ParamList.paramarray[j][MACRLC_UE_MULTIPLE_MAX_IDX ].iptr); + RC.mac[j]->use_mcs_offset = *(MacRLC_ParamList.paramarray[j][MACRLC_USE_MCS_OFFSET_IDX ].iptr); + RC.mac[j]->bler_lower = *(MacRLC_ParamList.paramarray[j][MACRLC_BLER_TARGET_LOWER_IDX ].dblptr); + RC.mac[j]->bler_upper = *(MacRLC_ParamList.paramarray[j][MACRLC_BLER_TARGET_UPPER_IDX ].dblptr); + RC.mac[j]->max_ul_rb_index = *(MacRLC_ParamList.paramarray[j][MACRLC_MAX_UL_RB_INDEX_IDX ].iptr); RC.nb_mac_CC[j] = *(MacRLC_ParamList.paramarray[j][MACRLC_CC_IDX].iptr); - + LOG_I(ENB_APP,"MAC instance %d parameters : pusch_snr %lf, pucch_snr %lf, ue_multiple_max %d, use_mcs_offset %d, bler_lower %lf, bler_upper %lf,max_ul_rb_index %d\n", + j, + RC.mac[j]->puSch10xSnr/10.0, + RC.mac[j]->puCch10xSnr/10.0, + RC.mac[j]->ue_multiple_max, + RC.mac[j]->use_mcs_offset, + RC.mac[j]->bler_lower, + RC.mac[j]->bler_upper, + RC.mac[j]->max_ul_rb_index); if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "local_RRC") == 0) { // check number of instances is same as RRC/PDCP - printf("Configuring local RRC for MACRLC\n"); + LOG_I(ENB_APP,"Configuring local RRC for MACRLC\n"); } else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_N_PREFERENCE_IDX].strptr), "f1") == 0) { - printf("Configuring F1 interfaces for MACRLC\n"); + LOG_I(ENB_APP,"Configuring F1 interfaces for MACRLC\n"); RC.mac[j]->eth_params_n.local_if_name = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_IF_NAME_IDX].strptr)); RC.mac[j]->eth_params_n.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_N_ADDRESS_IDX].strptr)); RC.mac[j]->eth_params_n.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_N_ADDRESS_IDX].strptr)); @@ -1992,7 +2008,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->carrier[0].mib.message.dl_Bandwidth; F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.num_frequency_bands = 1; F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_band[0] = rrc->carrier[0].sib1->freqBandIndicator; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; + F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.sul_active = 0; } else { LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); F1AP_SETUP_REQ (msg_p).fdd_flag = 1; @@ -2058,7 +2074,9 @@ int RCconfig_gtpu(void ) { IPV4_STR_ADDR_TO_INT_NWBO ( address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = enb_port_for_S1U; - itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) + strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address); + sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", enb_port_for_S1U); + itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) } else LOG_E(GTPU,"invalid address for S1U\n"); @@ -2776,12 +2794,13 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) { "value of X2ParamList.numelt %d must be lower than X2AP_MAX_NB_ENB_IP_ADDRESS %d value: reconsider to increase X2AP_MAX_NB_ENB_IP_ADDRESS\n", X2ParamList.numelt,X2AP_MAX_NB_ENB_IP_ADDRESS); X2AP_REGISTER_ENB_REQ (msg_p).nb_x2 = 0; - + LOG_I(X2AP,"X2ParamList.numelt %d\n",X2ParamList.numelt); for (l = 0; l < X2ParamList.numelt; l++) { X2AP_REGISTER_ENB_REQ (msg_p).nb_x2 += 1; strcpy(X2AP_REGISTER_ENB_REQ (msg_p).target_enb_x2_ip_address[l].ipv4_address,*(X2ParamList.paramarray[l][ENB_X2_IPV4_ADDRESS_IDX].strptr)); strcpy(X2AP_REGISTER_ENB_REQ (msg_p).target_enb_x2_ip_address[l].ipv6_address,*(X2ParamList.paramarray[l][ENB_X2_IPV6_ADDRESS_IDX].strptr)); + LOG_I(X2AP,"registering with ip : %s\n",*(X2ParamList.paramarray[l][ENB_X2_IPV4_ADDRESS_IDX].strptr)); if (strcmp(*(X2ParamList.paramarray[l][ENB_X2_IP_ADDRESS_PREFERENCE_IDX].strptr), "ipv4") == 0) { X2AP_REGISTER_ENB_REQ (msg_p).target_enb_x2_ip_address[l].ipv4 = 1; X2AP_REGISTER_ENB_REQ (msg_p).target_enb_x2_ip_address[l].ipv6 = 0; @@ -2961,7 +2980,7 @@ void extract_and_decode_SI(int inst,int si_ind,uint8_t *si_container,int si_cont eNB_RRC_INST *rrc = RC.rrc[inst]; rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0]; LTE_BCCH_DL_SCH_Message_t *bcch_message ; - AssertFatal(si_ind==0,"Can only handle a single SI block for now\n"); + AssertFatal(si_ind==2,"Can only handle a single SI block for now\n"); LOG_I(ENB_APP, "rrc inst %d: Trying to decode SI block %d @ %p, length %d\n",inst,si_ind,si_container,si_container_length); // point to first SI block bcch_message = &carrier->systemInformation; @@ -3148,15 +3167,19 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { (check_plmn_identity(carrier, resp->mcc[j], resp->mnc[j], resp->mnc_digit_length[j])>0 && resp->nrpci[j] == carrier->physCellId)) { // copy system information and decode it - for (si_ind=0; si_indnum_SI[j]; si_ind++) { + for (si_ind=2; si_ind<10; si_ind++) { //printf("SI %d size %d: ", si_ind, resp->SI_container_length[j][si_ind]); //for (int n=0;nSI_container_length[j][si_ind];n++) // printf("%02x ",resp->SI_container[j][si_ind][n]); //printf("\n"); - extract_and_decode_SI(i, - si_ind, - resp->SI_container[j][si_ind], - resp->SI_container_length[j][si_ind]); + if (si_ind==6) si_ind=9; + if (resp->SI_container[j][si_ind] != NULL) { + extract_and_decode_SI(i, + si_ind, + resp->SI_container[j][si_ind], + resp->SI_container_length[j][si_ind]); + } + } // perform MAC/L1 common configuration diff --git a/openair2/ENB_APP/enb_config.h b/openair2/ENB_APP/enb_config.h index 4bc4f5bf22..b95bf90f70 100644 --- a/openair2/ENB_APP/enb_config.h +++ b/openair2/ENB_APP/enb_config.h @@ -100,7 +100,6 @@ typedef struct ru_config_s { uint8_t if_compress; } ru_config_t; -extern void RCconfig_RU(void); extern void RCconfig_flexran(void); extern void RCconfig_L1(void); extern void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]); diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index 33182f3593..af7ff6ff6f 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -33,6 +33,9 @@ #include #include +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + int agent_task_created = 0; /* * enb agent task mainly wakes up the tx thread for periodic and oneshot messages to the controller diff --git a/openair2/ENB_APP/flexran_agent_common.c b/openair2/ENB_APP/flexran_agent_common.c index abb5b57e0c..55a1c61b25 100644 --- a/openair2/ENB_APP/flexran_agent_common.c +++ b/openair2/ENB_APP/flexran_agent_common.c @@ -53,6 +53,9 @@ #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rrc_eNB_UE_context.h" +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + /* * message primitives */ @@ -648,18 +651,6 @@ error: * ************************************ */ -int sort_ue_config(const void *a, const void *b) { - const Protocol__FlexUeConfig *fa = a; - const Protocol__FlexUeConfig *fb = b; - - if (fa->rnti < fb->rnti) - return -1; - else if (fa->rnti < fb->rnti) - return 1; - - return 0; -} - int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) { xid_t xid; Protocol__FlexHeader *header = NULL; diff --git a/openair2/ENB_APP/flexran_agent_common.h b/openair2/ENB_APP/flexran_agent_common.h index ae690c7124..18d32421dd 100644 --- a/openair2/ENB_APP/flexran_agent_common.h +++ b/openair2/ENB_APP/flexran_agent_common.h @@ -70,7 +70,6 @@ typedef struct { pthread_mutex_t *mutex; } stats_updates_context_t; -stats_updates_context_t stats_context[NUM_MAX_ENB]; /********************************** * FlexRAN protocol messages helper diff --git a/openair2/ENB_APP/flexran_agent_net_comm.c b/openair2/ENB_APP/flexran_agent_net_comm.c index 0d1c52096d..568a0e32cc 100644 --- a/openair2/ENB_APP/flexran_agent_net_comm.c +++ b/openair2/ENB_APP/flexran_agent_net_comm.c @@ -30,7 +30,7 @@ #include "common/utils/LOG/log.h" flexran_agent_channel_t *agent_channel[NUM_MAX_ENB][FLEXRAN_AGENT_MAX]; -flexran_agent_channel_instance_t channel_instance; +static flexran_agent_channel_instance_t channel_instance; int flexran_agent_channel_id = 0; int flexran_agent_msg_send(mid_t mod_id, agent_id_t agent_id, void *data, int size, int priority) { diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c index ff21971810..68d1f3311f 100644 --- a/openair2/ENB_APP/flexran_agent_ran_api.c +++ b/openair2/ENB_APP/flexran_agent_ran_api.c @@ -32,6 +32,9 @@ #include "s1ap_eNB_management_procedures.h" #include "openair2/LAYER2/MAC/slicing/slicing.h" +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + static inline int phy_is_present(mid_t mod_id, uint8_t cc_id) { return RC.eNB && RC.eNB[mod_id] && RC.eNB[mod_id][cc_id]; } @@ -885,7 +888,7 @@ uint8_t flexran_get_rrc_status(mid_t mod_id, rnti_t rnti) { if (!ue_context_p) return RRC_INACTIVE; - return ue_context_p->ue_context.Status; + return ue_context_p->ue_context.StatusRrc; } uint64_t flexran_get_ue_aggregated_max_bitrate_dl(mid_t mod_id, mid_t ue_id) { diff --git a/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c b/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c new file mode 100644 index 0000000000..a5eb850712 --- /dev/null +++ b/openair2/ENB_APP/flexran_agent_ran_api_to_fix.c @@ -0,0 +1,33 @@ +#include +#include +#include +pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; +uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; + +uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; + diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/38473-g31.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/38473-g31.asn new file mode 100644 index 0000000000..c821c52010 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/38473-g31.asn @@ -0,0 +1,10721 @@ +-- ASN1START +-- ************************************************************** +-- +-- Elementary Procedure definitions +-- +-- ************************************************************** + +F1AP-PDU-Descriptions { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Descriptions (0)} + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + ProcedureCode + +FROM F1AP-CommonDataTypes + Reset, + ResetAcknowledge, + F1SetupRequest, + F1SetupResponse, + F1SetupFailure, + GNBDUConfigurationUpdate, + GNBDUConfigurationUpdateAcknowledge, + GNBDUConfigurationUpdateFailure, + GNBCUConfigurationUpdate, + GNBCUConfigurationUpdateAcknowledge, + GNBCUConfigurationUpdateFailure, + UEContextSetupRequest, + UEContextSetupResponse, + UEContextSetupFailure, + UEContextReleaseCommand, + UEContextReleaseComplete, + UEContextModificationRequest, + UEContextModificationResponse, + UEContextModificationFailure, + UEContextModificationRequired, + UEContextModificationConfirm, + ErrorIndication, + UEContextReleaseRequest, + DLRRCMessageTransfer, + ULRRCMessageTransfer, + GNBDUResourceCoordinationRequest, + GNBDUResourceCoordinationResponse, + PrivateMessage, + UEInactivityNotification, + InitialULRRCMessageTransfer, + SystemInformationDeliveryCommand, + Paging, + Notify, + WriteReplaceWarningRequest, + WriteReplaceWarningResponse, + PWSCancelRequest, + PWSCancelResponse, + PWSRestartIndication, + PWSFailureIndication, + GNBDUStatusIndication, + RRCDeliveryReport, + UEContextModificationRefuse, + F1RemovalRequest, + F1RemovalResponse, + F1RemovalFailure, + NetworkAccessRateReduction, + TraceStart, + DeactivateTrace, + DUCURadioInformationTransfer, + CUDURadioInformationTransfer, + BAPMappingConfiguration, + BAPMappingConfigurationAcknowledge, + GNBDUResourceConfiguration, + GNBDUResourceConfigurationAcknowledge, + IABTNLAddressRequest, + IABTNLAddressResponse, + IABUPConfigurationUpdateRequest, + IABUPConfigurationUpdateResponse, + IABUPConfigurationUpdateFailure, + ResourceStatusRequest, + ResourceStatusResponse, + ResourceStatusFailure, + ResourceStatusUpdate, + AccessAndMobilityIndication, + ReferenceTimeInformationReportingControl, + ReferenceTimeInformationReport, + AccessSuccess, + CellTrafficTrace, + PositioningMeasurementRequest, + PositioningMeasurementResponse, + PositioningMeasurementFailure, + PositioningAssistanceInformationControl, + PositioningAssistanceInformationFeedback, + PositioningMeasurementReport, + PositioningMeasurementAbort, + PositioningMeasurementFailureIndication, + PositioningMeasurementUpdate, + TRPInformationRequest, + TRPInformationResponse, + TRPInformationFailure, + PositioningInformationRequest, + PositioningInformationResponse, + PositioningInformationFailure, + PositioningActivationRequest, + PositioningActivationResponse, + PositioningActivationFailure, + PositioningDeactivation, + PositioningInformationUpdate, + E-CIDMeasurementInitiationRequest, + E-CIDMeasurementInitiationResponse, + E-CIDMeasurementInitiationFailure, + E-CIDMeasurementFailureIndication, + E-CIDMeasurementReport, + E-CIDMeasurementTerminationCommand + + + +FROM F1AP-PDU-Contents + id-Reset, + id-F1Setup, + id-gNBDUConfigurationUpdate, + id-gNBCUConfigurationUpdate, + id-UEContextSetup, + id-UEContextRelease, + id-UEContextModification, + id-UEContextModificationRequired, + id-ErrorIndication, + id-UEContextReleaseRequest, + id-DLRRCMessageTransfer, + id-ULRRCMessageTransfer, + id-GNBDUResourceCoordination, + id-privateMessage, + id-UEInactivityNotification, + id-InitialULRRCMessageTransfer, + id-SystemInformationDeliveryCommand, + id-Paging, + id-Notify, + id-WriteReplaceWarning, + id-PWSCancel, + id-PWSRestartIndication, + id-PWSFailureIndication, + id-GNBDUStatusIndication, + id-RRCDeliveryReport, + id-F1Removal, + id-NetworkAccessRateReduction, + id-TraceStart, + id-DeactivateTrace, + id-DUCURadioInformationTransfer, + id-CUDURadioInformationTransfer, + id-BAPMappingConfiguration, + id-GNBDUResourceConfiguration, + id-IABTNLAddressAllocation, + id-IABUPConfigurationUpdate, + id-resourceStatusReportingInitiation, + id-resourceStatusReporting, + id-accessAndMobilityIndication, + id-ReferenceTimeInformationReportingControl, + id-ReferenceTimeInformationReport, + id-accessSuccess, + id-cellTrafficTrace, + id-PositioningMeasurementExchange, + id-PositioningAssistanceInformationControl, + id-PositioningAssistanceInformationFeedback, + id-PositioningMeasurementReport, + id-PositioningMeasurementAbort, + id-PositioningMeasurementFailureIndication, + id-PositioningMeasurementUpdate, + id-TRPInformationExchange, + id-PositioningInformationExchange, + id-PositioningActivation, + id-PositioningDeactivation, + id-PositioningInformationUpdate, + id-E-CIDMeasurementInitiation, + id-E-CIDMeasurementFailureIndication, + id-E-CIDMeasurementReport, + id-E-CIDMeasurementTermination + + +FROM F1AP-Constants + + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + + +-- ************************************************************** +-- +-- Interface Elementary Procedure Class +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURE ::= CLASS { + &InitiatingMessage , + &SuccessfulOutcome OPTIONAL, + &UnsuccessfulOutcome OPTIONAL, + &procedureCode ProcedureCode UNIQUE, + &criticality Criticality DEFAULT ignore +} +WITH SYNTAX { + INITIATING MESSAGE &InitiatingMessage + [SUCCESSFUL OUTCOME &SuccessfulOutcome] + [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] + PROCEDURE CODE &procedureCode + [CRITICALITY &criticality] +} + +-- ************************************************************** +-- +-- Interface PDU Definition +-- +-- ************************************************************** + +F1AP-PDU ::= CHOICE { + initiatingMessage InitiatingMessage, + successfulOutcome SuccessfulOutcome, + unsuccessfulOutcome UnsuccessfulOutcome, + choice-extension ProtocolIE-SingleContainer { { F1AP-PDU-ExtIEs} } +} + +F1AP-PDU-ExtIEs F1AP-PROTOCOL-IES ::= { -- this extension is not used + ... +} + +InitiatingMessage ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +SuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +UnsuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +-- ************************************************************** +-- +-- Interface Elementary Procedure List +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURES F1AP-ELEMENTARY-PROCEDURE ::= { + F1AP-ELEMENTARY-PROCEDURES-CLASS-1 | + F1AP-ELEMENTARY-PROCEDURES-CLASS-2, + ... +} + + +F1AP-ELEMENTARY-PROCEDURES-CLASS-1 F1AP-ELEMENTARY-PROCEDURE ::= { + reset | + f1Setup | + gNBDUConfigurationUpdate | + gNBCUConfigurationUpdate | + uEContextSetup | + uEContextRelease | + uEContextModification | + uEContextModificationRequired | + writeReplaceWarning | + pWSCancel | + gNBDUResourceCoordination | + f1Removal | + bAPMappingConfiguration | + gNBDUResourceConfiguration | + iABTNLAddressAllocation | + iABUPConfigurationUpdate | + resourceStatusReportingInitiation | + positioningMeasurementExchange | + tRPInformationExchange | + positioningInformationExchange | + positioningActivation | + e-CIDMeasurementInitiation, + ... +} + +F1AP-ELEMENTARY-PROCEDURES-CLASS-2 F1AP-ELEMENTARY-PROCEDURE ::= { + errorIndication | + uEContextReleaseRequest | + dLRRCMessageTransfer | + uLRRCMessageTransfer | + uEInactivityNotification | + privateMessage | + initialULRRCMessageTransfer | + systemInformationDelivery | + paging | + notify | + pWSRestartIndication | + pWSFailureIndication | + gNBDUStatusIndication | + rRCDeliveryReport | + networkAccessRateReduction | + traceStart | + deactivateTrace | + dUCURadioInformationTransfer | + cUDURadioInformationTransfer | + resourceStatusReporting | + accessAndMobilityIndication | + referenceTimeInformationReportingControl| + referenceTimeInformationReport | + accessSuccess | + cellTrafficTrace | + positioningAssistanceInformationControl | + positioningAssistanceInformationFeedback | + positioningMeasurementReport | + positioningMeasurementAbort | + positioningMeasurementFailureIndication | + positioningMeasurementUpdate | + positioningDeactivation | + e-CIDMeasurementFailureIndication | + e-CIDMeasurementReport | + e-CIDMeasurementTermination | + positioningInformationUpdate, + ... +} +-- ************************************************************** +-- +-- Interface Elementary Procedures +-- +-- ************************************************************** + +reset F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Reset + SUCCESSFUL OUTCOME ResetAcknowledge + PROCEDURE CODE id-Reset + CRITICALITY reject +} + +f1Setup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1SetupRequest + SUCCESSFUL OUTCOME F1SetupResponse + UNSUCCESSFUL OUTCOME F1SetupFailure + PROCEDURE CODE id-F1Setup + CRITICALITY reject +} + +gNBDUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUConfigurationUpdate + SUCCESSFUL OUTCOME GNBDUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBDUConfigurationUpdateFailure + PROCEDURE CODE id-gNBDUConfigurationUpdate + CRITICALITY reject +} + +gNBCUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBCUConfigurationUpdate + SUCCESSFUL OUTCOME GNBCUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBCUConfigurationUpdateFailure + PROCEDURE CODE id-gNBCUConfigurationUpdate + CRITICALITY reject +} + +uEContextSetup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextSetupRequest + SUCCESSFUL OUTCOME UEContextSetupResponse + UNSUCCESSFUL OUTCOME UEContextSetupFailure + PROCEDURE CODE id-UEContextSetup + CRITICALITY reject +} + +uEContextRelease F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseCommand + SUCCESSFUL OUTCOME UEContextReleaseComplete + PROCEDURE CODE id-UEContextRelease + CRITICALITY reject +} + +uEContextModification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequest + SUCCESSFUL OUTCOME UEContextModificationResponse + UNSUCCESSFUL OUTCOME UEContextModificationFailure + PROCEDURE CODE id-UEContextModification + CRITICALITY reject +} + +uEContextModificationRequired F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequired + SUCCESSFUL OUTCOME UEContextModificationConfirm + UNSUCCESSFUL OUTCOME UEContextModificationRefuse + PROCEDURE CODE id-UEContextModificationRequired + CRITICALITY reject +} + +writeReplaceWarning F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE WriteReplaceWarningRequest + SUCCESSFUL OUTCOME WriteReplaceWarningResponse + PROCEDURE CODE id-WriteReplaceWarning + CRITICALITY reject +} + +pWSCancel F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSCancelRequest + SUCCESSFUL OUTCOME PWSCancelResponse + PROCEDURE CODE id-PWSCancel + CRITICALITY reject +} + +errorIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + PROCEDURE CODE id-ErrorIndication + CRITICALITY ignore +} + +uEContextReleaseRequest F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseRequest + PROCEDURE CODE id-UEContextReleaseRequest + CRITICALITY ignore +} + + +initialULRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InitialULRRCMessageTransfer + PROCEDURE CODE id-InitialULRRCMessageTransfer + CRITICALITY ignore +} + +dLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DLRRCMessageTransfer + PROCEDURE CODE id-DLRRCMessageTransfer + CRITICALITY ignore +} + +uLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ULRRCMessageTransfer + PROCEDURE CODE id-ULRRCMessageTransfer + CRITICALITY ignore +} + + +uEInactivityNotification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEInactivityNotification + PROCEDURE CODE id-UEInactivityNotification + CRITICALITY ignore +} + +gNBDUResourceCoordination F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUResourceCoordinationRequest + SUCCESSFUL OUTCOME GNBDUResourceCoordinationResponse + PROCEDURE CODE id-GNBDUResourceCoordination + CRITICALITY reject +} + +privateMessage F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + PROCEDURE CODE id-privateMessage + CRITICALITY ignore +} + +systemInformationDelivery F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SystemInformationDeliveryCommand + PROCEDURE CODE id-SystemInformationDeliveryCommand + CRITICALITY ignore +} + + +paging F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Paging + PROCEDURE CODE id-Paging + CRITICALITY ignore +} + +notify F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Notify + PROCEDURE CODE id-Notify + CRITICALITY ignore +} + +networkAccessRateReduction F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE NetworkAccessRateReduction + PROCEDURE CODE id-NetworkAccessRateReduction + CRITICALITY ignore +} + + +pWSRestartIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSRestartIndication + PROCEDURE CODE id-PWSRestartIndication + CRITICALITY ignore +} + +pWSFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSFailureIndication + PROCEDURE CODE id-PWSFailureIndication + CRITICALITY ignore +} + +gNBDUStatusIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUStatusIndication + PROCEDURE CODE id-GNBDUStatusIndication + CRITICALITY ignore +} + + +rRCDeliveryReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RRCDeliveryReport + PROCEDURE CODE id-RRCDeliveryReport + CRITICALITY ignore +} + +f1Removal F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1RemovalRequest + SUCCESSFUL OUTCOME F1RemovalResponse + UNSUCCESSFUL OUTCOME F1RemovalFailure + PROCEDURE CODE id-F1Removal + CRITICALITY reject +} + +traceStart F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TraceStart + PROCEDURE CODE id-TraceStart + CRITICALITY ignore +} + +deactivateTrace F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DeactivateTrace + PROCEDURE CODE id-DeactivateTrace + CRITICALITY ignore +} + +dUCURadioInformationTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DUCURadioInformationTransfer + PROCEDURE CODE id-DUCURadioInformationTransfer + CRITICALITY ignore +} + +cUDURadioInformationTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CUDURadioInformationTransfer + PROCEDURE CODE id-CUDURadioInformationTransfer + CRITICALITY ignore +} + +bAPMappingConfiguration F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE BAPMappingConfiguration + SUCCESSFUL OUTCOME BAPMappingConfigurationAcknowledge + PROCEDURE CODE id-BAPMappingConfiguration + CRITICALITY reject +} + +gNBDUResourceConfiguration F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUResourceConfiguration + SUCCESSFUL OUTCOME GNBDUResourceConfigurationAcknowledge + PROCEDURE CODE id-GNBDUResourceConfiguration + CRITICALITY reject +} + +iABTNLAddressAllocation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE IABTNLAddressRequest + SUCCESSFUL OUTCOME IABTNLAddressResponse + PROCEDURE CODE id-IABTNLAddressAllocation + CRITICALITY reject +} + +iABUPConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE IABUPConfigurationUpdateRequest + SUCCESSFUL OUTCOME IABUPConfigurationUpdateResponse + UNSUCCESSFUL OUTCOME IABUPConfigurationUpdateFailure + PROCEDURE CODE id-IABUPConfigurationUpdate + CRITICALITY reject +} + +resourceStatusReportingInitiation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusRequest + SUCCESSFUL OUTCOME ResourceStatusResponse + UNSUCCESSFUL OUTCOME ResourceStatusFailure + PROCEDURE CODE id-resourceStatusReportingInitiation + CRITICALITY reject +} + +resourceStatusReporting F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusUpdate + PROCEDURE CODE id-resourceStatusReporting + CRITICALITY ignore +} + +accessAndMobilityIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AccessAndMobilityIndication + PROCEDURE CODE id-accessAndMobilityIndication + CRITICALITY ignore +} + +referenceTimeInformationReportingControl F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ReferenceTimeInformationReportingControl + PROCEDURE CODE id-ReferenceTimeInformationReportingControl + CRITICALITY ignore +} + +referenceTimeInformationReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ReferenceTimeInformationReport + PROCEDURE CODE id-ReferenceTimeInformationReport + CRITICALITY ignore +} + +accessSuccess F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AccessSuccess + PROCEDURE CODE id-accessSuccess + CRITICALITY ignore +} + +cellTrafficTrace F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellTrafficTrace + PROCEDURE CODE id-cellTrafficTrace + CRITICALITY ignore +} + +positioningAssistanceInformationControl F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningAssistanceInformationControl + PROCEDURE CODE id-PositioningAssistanceInformationControl + CRITICALITY ignore +} + +positioningAssistanceInformationFeedback F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningAssistanceInformationFeedback + PROCEDURE CODE id-PositioningAssistanceInformationFeedback + CRITICALITY ignore +} + +positioningMeasurementExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementRequest + SUCCESSFUL OUTCOME PositioningMeasurementResponse + UNSUCCESSFUL OUTCOME PositioningMeasurementFailure + PROCEDURE CODE id-PositioningMeasurementExchange + CRITICALITY reject +} + +positioningMeasurementReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementReport + PROCEDURE CODE id-PositioningMeasurementReport + CRITICALITY ignore +} + +positioningMeasurementAbort F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementAbort + PROCEDURE CODE id-PositioningMeasurementAbort + CRITICALITY ignore +} + +positioningMeasurementFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementFailureIndication + PROCEDURE CODE id-PositioningMeasurementFailureIndication + CRITICALITY ignore +} + +positioningMeasurementUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementUpdate + PROCEDURE CODE id-PositioningMeasurementUpdate + CRITICALITY ignore +} + + +tRPInformationExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TRPInformationRequest + SUCCESSFUL OUTCOME TRPInformationResponse + UNSUCCESSFUL OUTCOME TRPInformationFailure + PROCEDURE CODE id-TRPInformationExchange + CRITICALITY reject +} + +positioningInformationExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningInformationRequest + SUCCESSFUL OUTCOME PositioningInformationResponse + UNSUCCESSFUL OUTCOME PositioningInformationFailure + PROCEDURE CODE id-PositioningInformationExchange + CRITICALITY reject +} + +positioningActivation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningActivationRequest + SUCCESSFUL OUTCOME PositioningActivationResponse + UNSUCCESSFUL OUTCOME PositioningActivationFailure + PROCEDURE CODE id-PositioningActivation + CRITICALITY reject +} + +positioningDeactivation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningDeactivation + PROCEDURE CODE id-PositioningDeactivation + CRITICALITY ignore +} + +e-CIDMeasurementInitiation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementInitiationRequest + SUCCESSFUL OUTCOME E-CIDMeasurementInitiationResponse + UNSUCCESSFUL OUTCOME E-CIDMeasurementInitiationFailure + PROCEDURE CODE id-E-CIDMeasurementInitiation + CRITICALITY reject +} + +e-CIDMeasurementFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementFailureIndication + PROCEDURE CODE id-E-CIDMeasurementFailureIndication + CRITICALITY ignore +} + +e-CIDMeasurementReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementReport + PROCEDURE CODE id-E-CIDMeasurementReport + CRITICALITY ignore +} + +e-CIDMeasurementTermination F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementTerminationCommand + PROCEDURE CODE id-E-CIDMeasurementTermination + CRITICALITY ignore +} + +positioningInformationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningInformationUpdate + PROCEDURE CODE id-PositioningInformationUpdate + CRITICALITY ignore +} + + +END +-- ASN1STOP + +-- ASN1START +-- ************************************************************** +-- +-- PDU definitions for F1AP. +-- +-- ************************************************************** + +F1AP-PDU-Contents { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Contents (1) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Candidate-SpCell-Item, + Cause, + Cells-Failed-to-be-Activated-List-Item, + Cells-Status-Item, + Cells-to-be-Activated-List-Item, + Cells-to-be-Deactivated-List-Item, + CellULConfigured, + CriticalityDiagnostics, + C-RNTI, + CUtoDURRCInformation, + DRB-Activity-Item, + DRBID, + DRBs-FailedToBeModified-Item, + DRBs-FailedToBeSetup-Item, + DRBs-FailedToBeSetupMod-Item, + DRB-Notify-Item, + DRBs-ModifiedConf-Item, + DRBs-Modified-Item, + DRBs-Required-ToBeModified-Item, + DRBs-Required-ToBeReleased-Item, + DRBs-Setup-Item, + DRBs-SetupMod-Item, + DRBs-ToBeModified-Item, + DRBs-ToBeReleased-Item, + DRBs-ToBeSetup-Item, + DRBs-ToBeSetupMod-Item, + DRXCycle, + DRXConfigurationIndicator, + DUtoCURRCInformation, + EUTRANQoS, + ExecuteDuplication, + FullConfiguration, + GNB-CU-UE-F1AP-ID, + GNB-DU-UE-F1AP-ID, + GNB-DU-ID, + GNB-DU-Served-Cells-Item, + GNB-DU-System-Information, + GNB-CU-Name, + GNB-DU-Name, + InactivityMonitoringRequest, + InactivityMonitoringResponse, + LowerLayerPresenceStatusChange, + NotificationControl, + NRCGI, + NRPCI, + UEContextNotRetrievable, + Potential-SpCell-Item, + RAT-FrequencyPriorityInformation, + RequestedSRSTransmissionCharacteristics, + ResourceCoordinationTransferContainer, + RRCContainer, + RRCContainer-RRCSetupComplete, + RRCReconfigurationCompleteIndicator, + SCellIndex, + SCell-ToBeRemoved-Item, + SCell-ToBeSetup-Item, + SCell-ToBeSetupMod-Item, + SCell-FailedtoSetup-Item, + SCell-FailedtoSetupMod-Item, + ServCellIndex, + Served-Cell-Information, + Served-Cells-To-Add-Item, + Served-Cells-To-Delete-Item, + Served-Cells-To-Modify-Item, + ServingCellMO, + SRBID, + SRBs-FailedToBeSetup-Item, + SRBs-FailedToBeSetupMod-Item, + SRBs-Required-ToBeReleased-Item, + SRBs-ToBeReleased-Item, + SRBs-ToBeSetup-Item, + SRBs-ToBeSetupMod-Item, + SRBs-Modified-Item, + SRBs-Setup-Item, + SRBs-SetupMod-Item, + TimeToWait, + TransactionID, + TransmissionActionIndicator, + UE-associatedLogicalF1-ConnectionItem, + DUtoCURRCContainer, + PagingCell-Item, + SItype-List, + UEIdentityIndexValue, + GNB-CU-TNL-Association-Setup-Item, + GNB-CU-TNL-Association-Failed-To-Setup-Item, + GNB-CU-TNL-Association-To-Add-Item, + GNB-CU-TNL-Association-To-Remove-Item, + GNB-CU-TNL-Association-To-Update-Item, + MaskedIMEISV, + PagingDRX, + PagingPriority, + PagingIdentity, + Cells-to-be-Barred-Item, + PWSSystemInformation, + Broadcast-To-Be-Cancelled-Item, + Cells-Broadcast-Cancelled-Item, + NR-CGI-List-For-Restart-Item, + PWS-Failed-NR-CGI-Item, + RepetitionPeriod, + NumberofBroadcastRequest, + Cells-To-Be-Broadcast-Item, + Cells-Broadcast-Completed-Item, + Cancel-all-Warning-Messages-Indicator, + EUTRA-NR-CellResourceCoordinationReq-Container, + EUTRA-NR-CellResourceCoordinationReqAck-Container, + RequestType, + PLMN-Identity, + RLCFailureIndication, + UplinkTxDirectCurrentListInformation, + SULAccessIndication, + Protected-EUTRA-Resources-Item, + GNB-DUConfigurationQuery, + BitRate, + RRC-Version, + GNBDUOverloadInformation, + RRCDeliveryStatusRequest, + NeedforGap, + RRCDeliveryStatus, + ResourceCoordinationTransferInformation, + Dedicated-SIDelivery-NeededUE-Item, + Associated-SCell-Item, + IgnoreResourceCoordinationContainer, + PagingOrigin, + UAC-Assistance-Info, + RANUEID, + GNB-DU-TNL-Association-To-Remove-Item, + NotificationInformation, + TraceActivation, + TraceID, + Neighbour-Cell-Information-Item, + SymbolAllocInSlot, + NumDLULSymbols, + AdditionalRRMPriorityIndex, + DUCURadioInformationType, + CUDURadioInformationType, + Transport-Layer-Address-Info, + BHChannels-ToBeSetup-Item, + BHChannels-Setup-Item, + BHChannels-FailedToBeSetup-Item, + BHChannels-ToBeModified-Item, + BHChannels-ToBeReleased-Item, + BHChannels-ToBeSetupMod-Item, + BHChannels-FailedToBeModified-Item, + BHChannels-FailedToBeSetupMod-Item, + BHChannels-Modified-Item, + BHChannels-SetupMod-Item, + BHChannels-Required-ToBeReleased-Item, + BAPAddress, + BAPPathID, + BAPRoutingID, + BH-Routing-Information-Added-List-Item, + BH-Routing-Information-Removed-List-Item, + Child-Nodes-List, + Child-Nodes-List-Item, + Child-Node-Cells-List, + Child-Node-Cells-List-Item, + Activated-Cells-to-be-Updated-List, + Activated-Cells-to-be-Updated-List-Item, + UL-BH-Non-UP-Traffic-Mapping, + IABTNLAddressesRequested, + IABIPv6RequestType, + IAB-TNL-Addresses-To-Remove-Item, + IABTNLAddress, + IAB-Allocated-TNL-Address-Item, + IABv4AddressesRequested, + TrafficMappingInfo, + UL-UP-TNL-Information-to-Update-List-Item, + UL-UP-TNL-Address-to-Update-List-Item, + DL-UP-TNL-Address-to-Update-List-Item, + NRV2XServicesAuthorized, + LTEV2XServicesAuthorized, + NRUESidelinkAggregateMaximumBitrate, + LTEUESidelinkAggregateMaximumBitrate, + SLDRBs-SetupMod-Item, + SLDRBs-ModifiedConf-Item, + SLDRBID, + SLDRBs-FailedToBeModified-Item, + SLDRBs-FailedToBeSetup-Item, + SLDRBs-FailedToBeSetupMod-Item, + SLDRBs-Modified-Item, + SLDRBs-Required-ToBeModified-Item, + SLDRBs-Required-ToBeReleased-Item, + SLDRBs-Setup-Item, + SLDRBs-ToBeModified-Item, + SLDRBs-ToBeReleased-Item, + SLDRBs-ToBeSetup-Item, + SLDRBs-ToBeSetupMod-Item, + GNBCUMeasurementID, + GNBDUMeasurementID, + RegistrationRequest, + ReportCharacteristics, + CellToReportList, + HardwareLoadIndicator, + CellMeasurementResultList, + ReportingPeriodicity, + TNLCapacityIndicator, + RACHReportInformationList, + RLFReportInformationList, + ReportingRequestType, + TimeReferenceInformation, + ConditionalInterDUMobilityInformation, + ConditionalIntraDUMobilityInformation, + TargetCellList, + MDTPLMNList, + PrivacyIndicator, + TransportLayerAddress, + URI-address, + NID, + PosAssistance-Information, + PosBroadcast, + PositioningBroadcastCells, + RoutingID, + PosAssistanceInformationFailureList, + PosMeasurementQuantities, + PosMeasurementResultList, + PosMeasurementPeriodicity, + PosReportCharacteristics, + TRPInformationTypeItem, + TRPInformationItem, + LMF-MeasurementID, + RAN-MeasurementID, + SRSResourceSetID, + SRSSpatialRelation, + SRSResourceTrigger, + SRSConfiguration, + TRPList, + E-CID-MeasurementQuantities, + E-CID-MeasurementPeriodicity, + E-CID-MeasurementResult, + Cell-Portion-ID, + LMF-UE-MeasurementID, + RAN-UE-MeasurementID, + SFNInitialisationTime, + SystemFrameNumber, + SlotNumber, + AbortTransmission, + TRP-MeasurementRequestList, + MeasurementBeamInfoRequest, + E-CID-ReportCharacteristics, + Extended-GNB-CU-Name, + Extended-GNB-DU-Name + + + +FROM F1AP-IEs + + PrivateIE-Container{}, + ProtocolExtensionContainer{}, + ProtocolIE-Container{}, + ProtocolIE-ContainerPair{}, + ProtocolIE-SingleContainer{}, + F1AP-PRIVATE-IES, + F1AP-PROTOCOL-EXTENSION, + F1AP-PROTOCOL-IES, + F1AP-PROTOCOL-IES-PAIR + +FROM F1AP-Containers + + id-Candidate-SpCell-Item, + id-Candidate-SpCell-List, + id-Cause, + id-Cancel-all-Warning-Messages-Indicator, + id-Cells-Failed-to-be-Activated-List, + id-Cells-Failed-to-be-Activated-List-Item, + id-Cells-Status-Item, + id-Cells-Status-List, + id-Cells-to-be-Activated-List, + id-Cells-to-be-Activated-List-Item, + id-Cells-to-be-Deactivated-List, + id-Cells-to-be-Deactivated-List-Item, + id-ConfirmedUEID, + id-CriticalityDiagnostics, + id-C-RNTI, + id-CUtoDURRCInformation, + id-DRB-Activity-Item, + id-DRB-Activity-List, + id-DRBs-FailedToBeModified-Item, + id-DRBs-FailedToBeModified-List, + id-DRBs-FailedToBeSetup-Item, + id-DRBs-FailedToBeSetup-List, + id-DRBs-FailedToBeSetupMod-Item, + id-DRBs-FailedToBeSetupMod-List, + id-DRBs-ModifiedConf-Item, + id-DRBs-ModifiedConf-List, + id-DRBs-Modified-Item, + id-DRBs-Modified-List, + id-DRB-Notify-Item, + id-DRB-Notify-List, + id-DRBs-Required-ToBeModified-Item, + id-DRBs-Required-ToBeModified-List, + id-DRBs-Required-ToBeReleased-Item, + id-DRBs-Required-ToBeReleased-List, + id-DRBs-Setup-Item, + id-DRBs-Setup-List, + id-DRBs-SetupMod-Item, + id-DRBs-SetupMod-List, + id-DRBs-ToBeModified-Item, + id-DRBs-ToBeModified-List, + id-DRBs-ToBeReleased-Item, + id-DRBs-ToBeReleased-List, + id-DRBs-ToBeSetup-Item, + id-DRBs-ToBeSetup-List, + id-DRBs-ToBeSetupMod-Item, + id-DRBs-ToBeSetupMod-List, + id-DRXCycle, + id-DUtoCURRCInformation, + id-ExecuteDuplication, + id-FullConfiguration, + id-gNB-CU-UE-F1AP-ID, + id-gNB-DU-UE-F1AP-ID, + id-gNB-DU-ID, + id-GNB-DU-Served-Cells-Item, + id-gNB-DU-Served-Cells-List, + id-gNB-CU-Name, + id-gNB-DU-Name, + id-Extended-GNB-CU-Name, + id-Extended-GNB-DU-Name, + id-InactivityMonitoringRequest, + id-InactivityMonitoringResponse, + id-new-gNB-CU-UE-F1AP-ID, + id-new-gNB-DU-UE-F1AP-ID, + id-oldgNB-DU-UE-F1AP-ID, + id-PLMNAssistanceInfoForNetShar, + id-Potential-SpCell-Item, + id-Potential-SpCell-List, + id-RAT-FrequencyPriorityInformation, + id-RedirectedRRCmessage, + id-ResetType, + id-RequestedSRSTransmissionCharacteristics, + id-ResourceCoordinationTransferContainer, + id-RRCContainer, + id-RRCContainer-RRCSetupComplete, + id-RRCReconfigurationCompleteIndicator, + id-SCell-FailedtoSetup-List, + id-SCell-FailedtoSetup-Item, + id-SCell-FailedtoSetupMod-List, + id-SCell-FailedtoSetupMod-Item, + id-SCell-ToBeRemoved-Item, + id-SCell-ToBeRemoved-List, + id-SCell-ToBeSetup-Item, + id-SCell-ToBeSetup-List, + id-SCell-ToBeSetupMod-Item, + id-SCell-ToBeSetupMod-List, + id-SelectedPLMNID, + id-Served-Cells-To-Add-Item, + id-Served-Cells-To-Add-List, + id-Served-Cells-To-Delete-Item, + id-Served-Cells-To-Delete-List, + id-Served-Cells-To-Modify-Item, + id-Served-Cells-To-Modify-List, + id-ServCellIndex, + id-ServingCellMO, + id-SpCell-ID, + id-SpCellULConfigured, + id-SRBID, + id-SRBs-FailedToBeSetup-Item, + id-SRBs-FailedToBeSetup-List, + id-SRBs-FailedToBeSetupMod-Item, + id-SRBs-FailedToBeSetupMod-List, + id-SRBs-Required-ToBeReleased-Item, + id-SRBs-Required-ToBeReleased-List, + id-SRBs-ToBeReleased-Item, + id-SRBs-ToBeReleased-List, + id-SRBs-ToBeSetup-Item, + id-SRBs-ToBeSetup-List, + id-SRBs-ToBeSetupMod-Item, + id-SRBs-ToBeSetupMod-List, + id-SRBs-Modified-Item, + id-SRBs-Modified-List, + id-SRBs-Setup-Item, + id-SRBs-Setup-List, + id-SRBs-SetupMod-Item, + id-SRBs-SetupMod-List, + id-TimeToWait, + id-TransactionID, + id-TransmissionActionIndicator, + id-UEContextNotRetrievable, + id-UE-associatedLogicalF1-ConnectionItem, + id-UE-associatedLogicalF1-ConnectionListResAck, + id-DUtoCURRCContainer, + id-NRCGI, + id-PagingCell-Item, + id-PagingCell-List, + id-PagingDRX, + id-PagingPriority, + id-SItype-List, + id-UEIdentityIndexValue, + id-GNB-CU-TNL-Association-Setup-List, + id-GNB-CU-TNL-Association-Setup-Item, + id-GNB-CU-TNL-Association-Failed-To-Setup-List, + id-GNB-CU-TNL-Association-Failed-To-Setup-Item, + id-GNB-CU-TNL-Association-To-Add-Item, + id-GNB-CU-TNL-Association-To-Add-List, + id-GNB-CU-TNL-Association-To-Remove-Item, + id-GNB-CU-TNL-Association-To-Remove-List, + id-GNB-CU-TNL-Association-To-Update-Item, + id-GNB-CU-TNL-Association-To-Update-List, + id-MaskedIMEISV, + id-PagingIdentity, + id-Cells-to-be-Barred-List, + id-Cells-to-be-Barred-Item, + id-PWSSystemInformation, + id-RepetitionPeriod, + id-NumberofBroadcastRequest, + id-Cells-To-Be-Broadcast-List, + id-Cells-To-Be-Broadcast-Item, + id-Cells-Broadcast-Completed-List, + id-Cells-Broadcast-Completed-Item, + id-Broadcast-To-Be-Cancelled-List, + id-Broadcast-To-Be-Cancelled-Item, + id-Cells-Broadcast-Cancelled-List, + id-Cells-Broadcast-Cancelled-Item, + id-NR-CGI-List-For-Restart-List, + id-NR-CGI-List-For-Restart-Item, + id-PWS-Failed-NR-CGI-List, + id-PWS-Failed-NR-CGI-Item, + id-EUTRA-NR-CellResourceCoordinationReq-Container, + id-EUTRA-NR-CellResourceCoordinationReqAck-Container, + id-Protected-EUTRA-Resources-List, + id-RequestType, + id-ServingPLMN, + id-DRXConfigurationIndicator, + id-RLCFailureIndication, + id-UplinkTxDirectCurrentListInformation, + id-SULAccessIndication, + id-Protected-EUTRA-Resources-Item, + id-GNB-DUConfigurationQuery, + id-GNB-DU-UE-AMBR-UL, + id-GNB-CU-RRC-Version, + id-GNB-DU-RRC-Version, + id-GNBDUOverloadInformation, + id-NeedforGap, + id-RRCDeliveryStatusRequest, + id-RRCDeliveryStatus, + id-Dedicated-SIDelivery-NeededUE-List, + id-Dedicated-SIDelivery-NeededUE-Item, + id-ResourceCoordinationTransferInformation, + id-Associated-SCell-List, + id-Associated-SCell-Item, + id-IgnoreResourceCoordinationContainer, + id-UAC-Assistance-Info, + id-RANUEID, + id-PagingOrigin, + id-GNB-DU-TNL-Association-To-Remove-Item, + id-GNB-DU-TNL-Association-To-Remove-List, + id-NotificationInformation, + id-TraceActivation, + id-TraceID, + id-Neighbour-Cell-Information-List, + id-Neighbour-Cell-Information-Item, + id-SymbolAllocInSlot, + id-NumDLULSymbols, + id-AdditionalRRMPriorityIndex, + id-DUCURadioInformationType, + id-CUDURadioInformationType, + id-LowerLayerPresenceStatusChange, + id-Transport-Layer-Address-Info, + id-BHChannels-ToBeSetup-List, + id-BHChannels-ToBeSetup-Item, + id-BHChannels-Setup-List, + id-BHChannels-Setup-Item, + id-BHChannels-ToBeModified-Item, + id-BHChannels-ToBeModified-List, + id-BHChannels-ToBeReleased-Item, + id-BHChannels-ToBeReleased-List, + id-BHChannels-ToBeSetupMod-Item, + id-BHChannels-ToBeSetupMod-List, + id-BHChannels-FailedToBeSetup-Item, + id-BHChannels-FailedToBeSetup-List, + id-BHChannels-FailedToBeModified-Item, + id-BHChannels-FailedToBeModified-List, + id-BHChannels-FailedToBeSetupMod-Item, + id-BHChannels-FailedToBeSetupMod-List, + id-BHChannels-Modified-Item, + id-BHChannels-Modified-List, + id-BHChannels-SetupMod-Item, + id-BHChannels-SetupMod-List, + id-BHChannels-Required-ToBeReleased-Item, + id-BHChannels-Required-ToBeReleased-List, + id-BAPAddress, + id-ConfiguredBAPAddress, + id-BH-Routing-Information-Added-List, + id-BH-Routing-Information-Added-List-Item, + id-BH-Routing-Information-Removed-List, + id-BH-Routing-Information-Removed-List-Item, + id-UL-BH-Non-UP-Traffic-Mapping, + id-Child-Nodes-List, + id-Activated-Cells-to-be-Updated-List, + id-IABIPv6RequestType, + id-IAB-TNL-Addresses-To-Remove-List, + id-IAB-TNL-Addresses-To-Remove-Item, + id-IAB-Allocated-TNL-Address-List, + id-IAB-Allocated-TNL-Address-Item, + id-IABv4AddressesRequested, + id-TrafficMappingInformation, + id-UL-UP-TNL-Information-to-Update-List, + id-UL-UP-TNL-Information-to-Update-List-Item, + id-UL-UP-TNL-Address-to-Update-List, + id-UL-UP-TNL-Address-to-Update-List-Item, + id-DL-UP-TNL-Address-to-Update-List, + id-DL-UP-TNL-Address-to-Update-List-Item, + id-NRV2XServicesAuthorized, + id-LTEV2XServicesAuthorized, + id-NRUESidelinkAggregateMaximumBitrate, + id-LTEUESidelinkAggregateMaximumBitrate, + id-PC5LinkAMBR, + id-SLDRBs-FailedToBeModified-Item, + id-SLDRBs-FailedToBeModified-List, + id-SLDRBs-FailedToBeSetup-Item, + id-SLDRBs-FailedToBeSetup-List, + id-SLDRBs-Modified-Item, + id-SLDRBs-Modified-List, + id-SLDRBs-Required-ToBeModified-Item, + id-SLDRBs-Required-ToBeModified-List, + id-SLDRBs-Required-ToBeReleased-Item, + id-SLDRBs-Required-ToBeReleased-List, + id-SLDRBs-Setup-Item, + id-SLDRBs-Setup-List, + id-SLDRBs-ToBeModified-Item, + id-SLDRBs-ToBeModified-List, + id-SLDRBs-ToBeReleased-Item, + id-SLDRBs-ToBeReleased-List, + id-SLDRBs-ToBeSetup-Item, + id-SLDRBs-ToBeSetup-List, + id-SLDRBs-ToBeSetupMod-Item, + id-SLDRBs-ToBeSetupMod-List, + id-SLDRBs-SetupMod-List, + id-SLDRBs-FailedToBeSetupMod-List, + id-SLDRBs-SetupMod-Item, + id-SLDRBs-FailedToBeSetupMod-Item, + id-SLDRBs-ModifiedConf-List, + id-SLDRBs-ModifiedConf-Item, + id-gNBCUMeasurementID, + id-gNBDUMeasurementID, + id-RegistrationRequest, + id-ReportCharacteristics, + id-CellToReportList, + id-CellMeasurementResultList, + id-HardwareLoadIndicator, + id-ReportingPeriodicity, + id-TNLCapacityIndicator, + id-RACHReportInformationList, + id-RLFReportInformationList, + id-ReportingRequestType, + id-TimeReferenceInformation, + id-ConditionalInterDUMobilityInformation, + id-ConditionalIntraDUMobilityInformation, + id-targetCellsToCancel, + id-requestedTargetCellGlobalID, + id-TraceCollectionEntityIPAddress, + id-ManagementBasedMDTPLMNList, + id-PrivacyIndicator, + id-TraceCollectionEntityURI, + id-ServingNID, + id-PosAssistance-Information, + id-PosBroadcast, + id-PositioningBroadcastCells, + id-RoutingID, + id-PosAssistanceInformationFailureList, + id-PosMeasurementQuantities, + id-PosMeasurementResultList, + id-PosMeasurementPeriodicity, + id-PosReportCharacteristics, + id-TRPInformationTypeListTRPReq, + id-TRPInformationTypeItem, + id-TRPInformationListTRPResp, + id-TRPInformationItem, + id-LMF-MeasurementID, + id-RAN-MeasurementID, + id-SRSType, + id-ActivationTime, + id-AbortTransmission, + id-SRSConfiguration, + id-TRPList, + id-E-CID-MeasurementQuantities, + id-E-CID-MeasurementPeriodicity, + id-E-CID-MeasurementResult, + id-Cell-Portion-ID, + id-LMF-UE-MeasurementID, + id-RAN-UE-MeasurementID, + id-SFNInitialisationTime, + id-SystemFrameNumber, + id-SlotNumber, + id-TRP-MeasurementRequestList, + id-MeasurementBeamInfoRequest, + id-E-CID-ReportCharacteristics, + + maxCellingNBDU, + maxnoofCandidateSpCells, + maxnoofDRBs, + maxnoofErrors, + maxnoofIndividualF1ConnectionsToReset, + maxnoofPotentialSpCells, + maxnoofSCells, + maxnoofSRBs, + maxnoofPagingCells, + maxnoofTNLAssociations, + maxCellineNB, + maxnoofUEIDs, + maxnoofBHRLCChannels, + maxnoofRoutingEntries, + maxnoofChildIABNodes, + maxnoofServedCellsIAB, + maxnoofTLAsIAB, + maxnoofULUPTNLInformationforIAB, + maxnoofUPTNLAddresses, + maxnoofSLDRBs, + maxnoofTRPInfoTypes, + maxnoofTRPs + + + +FROM F1AP-Constants; + + +-- ************************************************************** +-- +-- RESET ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Reset +-- +-- ************************************************************** + +Reset ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetIEs} }, + ... +} + +ResetIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-ResetType CRITICALITY reject TYPE ResetType PRESENCE mandatory }, + ... +} + +ResetType ::= CHOICE { + f1-Interface ResetAll, + partOfF1-Interface UE-associatedLogicalF1-ConnectionListRes, + choice-extension ProtocolIE-SingleContainer { { ResetType-ExtIEs} } +} + +ResetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +ResetAll ::= ENUMERATED { + reset-all, + ... +} + +UE-associatedLogicalF1-ConnectionListRes ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemRes } } + +UE-associatedLogicalF1-ConnectionItemRes F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY reject TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- Reset Acknowledge +-- +-- ************************************************************** + +ResetAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetAcknowledgeIEs} }, + ... +} + +ResetAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UE-associatedLogicalF1-ConnectionListResAck CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionListResAck PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +UE-associatedLogicalF1-ConnectionListResAck ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemResAck } } + +UE-associatedLogicalF1-ConnectionItemResAck F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- ERROR INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Error Indication +-- +-- ************************************************************** + +ErrorIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ErrorIndicationIEs}}, + ... +} + +ErrorIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- F1 SETUP ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Setup Request +-- +-- ************************************************************** + +F1SetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupRequestIEs} }, + ... +} + +F1SetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE mandatory }| + { ID id-gNB-DU-Name CRITICALITY ignore TYPE GNB-DU-Name PRESENCE optional }| + { ID id-gNB-DU-Served-Cells-List CRITICALITY reject TYPE GNB-DU-Served-Cells-List PRESENCE optional }| + { ID id-GNB-DU-RRC-Version CRITICALITY reject TYPE RRC-Version PRESENCE mandatory }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-BAPAddress CRITICALITY ignore TYPE BAPAddress PRESENCE optional }| + { ID id-Extended-GNB-CU-Name CRITICALITY ignore TYPE Extended-GNB-CU-Name PRESENCE optional }, + ... +} + + +GNB-DU-Served-Cells-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { GNB-DU-Served-Cells-ItemIEs } } + +GNB-DU-Served-Cells-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-Served-Cells-Item CRITICALITY reject TYPE GNB-DU-Served-Cells-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- F1 Setup Response +-- +-- ************************************************************** + +F1SetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupResponseIEs} }, + ... +} + + +F1SetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-CU-Name CRITICALITY ignore TYPE GNB-CU-Name PRESENCE optional }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-GNB-CU-RRC-Version CRITICALITY reject TYPE RRC-Version PRESENCE mandatory }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }| + { ID id-BAPAddress CRITICALITY ignore TYPE BAPAddress PRESENCE optional }| + { ID id-Extended-GNB-DU-Name CRITICALITY ignore TYPE Extended-GNB-DU-Name PRESENCE optional }, + ... +} + + +Cells-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Activated-List-ItemIEs } } + +Cells-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-Cells-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-to-be-Activated-List-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- F1 Setup Failure +-- +-- ************************************************************** + +F1SetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupFailureIEs} }, + ... +} + +F1SetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBDUConfigurationUpdate::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateIEs} }, + ... +} + +GNBDUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Served-Cells-To-Add-List CRITICALITY reject TYPE Served-Cells-To-Add-List PRESENCE optional }| + { ID id-Served-Cells-To-Modify-List CRITICALITY reject TYPE Served-Cells-To-Modify-List PRESENCE optional }| + { ID id-Served-Cells-To-Delete-List CRITICALITY reject TYPE Served-Cells-To-Delete-List PRESENCE optional }| + { ID id-Cells-Status-List CRITICALITY reject TYPE Cells-Status-List PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE optional }| + { ID id-GNB-DU-TNL-Association-To-Remove-List CRITICALITY reject TYPE GNB-DU-TNL-Association-To-Remove-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }, + ... +} + +Served-Cells-To-Add-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Add-ItemIEs } } +Served-Cells-To-Modify-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Modify-ItemIEs } } +Served-Cells-To-Delete-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Delete-ItemIEs } } +Cells-Status-List ::= SEQUENCE (SIZE(0.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Status-ItemIEs } } + +Dedicated-SIDelivery-NeededUE-List::= SEQUENCE (SIZE(1.. maxnoofUEIDs)) OF ProtocolIE-SingleContainer { { Dedicated-SIDelivery-NeededUE-ItemIEs } } + +GNB-DU-TNL-Association-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-DU-TNL-Association-To-Remove-ItemIEs } } + + +Served-Cells-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Add-Item CRITICALITY reject TYPE Served-Cells-To-Add-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Modify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Modify-Item CRITICALITY reject TYPE Served-Cells-To-Modify-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Delete-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Delete-Item CRITICALITY reject TYPE Served-Cells-To-Delete-Item PRESENCE mandatory }, + ... +} + +Cells-Status-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Status-Item CRITICALITY reject TYPE Cells-Status-Item PRESENCE mandatory }, + ... +} + +Dedicated-SIDelivery-NeededUE-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Dedicated-SIDelivery-NeededUE-Item CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-Item PRESENCE mandatory }, + ... +} + +GNB-DU-TNL-Association-To-Remove-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-TNL-Association-To-Remove-Item CRITICALITY reject TYPE GNB-DU-TNL-Association-To-Remove-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBDUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateFailureIEs} }, + ... +} + +GNBDUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBCUConfigurationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateIEs} }, + ... +} + +GNBCUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Add-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Add-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Remove-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Remove-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Update-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Update-List PRESENCE optional }| + { ID id-Cells-to-be-Barred-List CRITICALITY ignore TYPE Cells-to-be-Barred-List PRESENCE optional }| + { ID id-Protected-EUTRA-Resources-List CRITICALITY reject TYPE Protected-EUTRA-Resources-List PRESENCE optional }| + { ID id-Neighbour-Cell-Information-List CRITICALITY ignore TYPE Neighbour-Cell-Information-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Deactivated-List-ItemIEs } } +GNB-CU-TNL-Association-To-Add-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Add-ItemIEs } } +GNB-CU-TNL-Association-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Remove-ItemIEs } } +GNB-CU-TNL-Association-To-Update-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Update-ItemIEs } } +Cells-to-be-Barred-List ::= SEQUENCE(SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Barred-ItemIEs } } + + +Cells-to-be-Deactivated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Deactivated-List-Item CRITICALITY reject TYPE Cells-to-be-Deactivated-List-Item PRESENCE mandatory }, + ... +} + + +GNB-CU-TNL-Association-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Add-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Add-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-To-Remove-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Remove-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Remove-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-To-Update-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Update-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Update-Item PRESENCE mandatory }, + ... +} + +Cells-to-be-Barred-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Barred-Item CRITICALITY ignore TYPE Cells-to-be-Barred-Item PRESENCE mandatory }, + ... +} + +Protected-EUTRA-Resources-List ::= SEQUENCE (SIZE(1.. maxCellineNB)) OF ProtocolIE-SingleContainer { { Protected-EUTRA-Resources-ItemIEs } } +Protected-EUTRA-Resources-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Protected-EUTRA-Resources-Item CRITICALITY reject TYPE Protected-EUTRA-Resources-Item PRESENCE mandatory}, + ... +} + +Neighbour-Cell-Information-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Neighbour-Cell-Information-ItemIEs } } +Neighbour-Cell-Information-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Neighbour-Cell-Information-Item CRITICALITY ignore TYPE Neighbour-Cell-Information-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBCUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Failed-to-be-Activated-List CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Setup-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Failed-To-Setup-List PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }, + ... +} + +Cells-Failed-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Failed-to-be-Activated-List-ItemIEs } } +GNB-CU-TNL-Association-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Setup-ItemIEs } } +GNB-CU-TNL-Association-Failed-To-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs } } + +Cells-Failed-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Failed-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Setup-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-Setup-Item PRESENCE mandatory }, + ... +} + + +GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-Failed-To-Setup-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateFailureIEs} }, + ... +} + +GNBCUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION REQUEST +-- +-- ************************************************************** + +GNBDUResourceCoordinationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationRequest-IEs}}, + ... +} + +GNBDUResourceCoordinationRequest-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-RequestType CRITICALITY reject TYPE RequestType PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReq-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReq-Container PRESENCE mandatory}| + { ID id-IgnoreResourceCoordinationContainer CRITICALITY reject TYPE IgnoreResourceCoordinationContainer PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION RESPONSE +-- +-- ************************************************************** + +GNBDUResourceCoordinationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationResponse-IEs}}, + ... +} + +GNBDUResourceCoordinationResponse-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReqAck-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReqAck-Container PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE Context Setup ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT SETUP REQUEST +-- +-- ************************************************************** + +UEContextSetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupRequestIEs} }, + ... +} + +UEContextSetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SpCell-ID CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-ServCellIndex CRITICALITY reject TYPE ServCellIndex PRESENCE mandatory }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE mandatory}| + { ID id-Candidate-SpCell-List CRITICALITY ignore TYPE Candidate-SpCell-List PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-SCell-ToBeSetup-List CRITICALITY ignore TYPE SCell-ToBeSetup-List PRESENCE optional }| + { ID id-SRBs-ToBeSetup-List CRITICALITY reject TYPE SRBs-ToBeSetup-List PRESENCE optional }| + { ID id-DRBs-ToBeSetup-List CRITICALITY reject TYPE DRBs-ToBeSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-MaskedIMEISV CRITICALITY ignore TYPE MaskedIMEISV PRESENCE optional }| + { ID id-ServingPLMN CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional }| + { ID id-GNB-DU-UE-AMBR-UL CRITICALITY ignore TYPE BitRate PRESENCE conditional }| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-ServingCellMO CRITICALITY ignore TYPE ServingCellMO PRESENCE optional }| + { ID id-new-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-RANUEID CRITICALITY ignore TYPE RANUEID PRESENCE optional }| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }| + { ID id-BHChannels-ToBeSetup-List CRITICALITY reject TYPE BHChannels-ToBeSetup-List PRESENCE optional }| + { ID id-ConfiguredBAPAddress CRITICALITY reject TYPE BAPAddress PRESENCE optional }| + { ID id-NRV2XServicesAuthorized CRITICALITY ignore TYPE NRV2XServicesAuthorized PRESENCE optional }| + { ID id-LTEV2XServicesAuthorized CRITICALITY ignore TYPE LTEV2XServicesAuthorized PRESENCE optional }| + { ID id-NRUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE NRUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-LTEUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE LTEUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-PC5LinkAMBR CRITICALITY ignore TYPE BitRate PRESENCE optional}| + { ID id-SLDRBs-ToBeSetup-List CRITICALITY reject TYPE SLDRBs-ToBeSetup-List PRESENCE optional }| + { ID id-ConditionalInterDUMobilityInformation CRITICALITY reject TYPE ConditionalInterDUMobilityInformation PRESENCE optional}| + { ID id-ManagementBasedMDTPLMNList CRITICALITY ignore TYPE MDTPLMNList PRESENCE optional }| + { ID id-ServingNID CRITICALITY reject TYPE NID PRESENCE optional }, + ... +} + +Candidate-SpCell-List::= SEQUENCE (SIZE(1..maxnoofCandidateSpCells)) OF ProtocolIE-SingleContainer { { Candidate-SpCell-ItemIEs} } +SCell-ToBeSetup-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetup-ItemIEs} } +SRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetup-ItemIEs} } +DRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetup-ItemIEs} } +BHChannels-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeSetup-ItemIEs} } +SLDRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeSetup-ItemIEs} } + +Candidate-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Candidate-SpCell-Item CRITICALITY ignore TYPE Candidate-SpCell-Item PRESENCE mandatory }, + ... +} + + +SCell-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetup-Item CRITICALITY ignore TYPE SCell-ToBeSetup-Item PRESENCE mandatory }, + ... +} + +SRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetup-Item CRITICALITY reject TYPE SRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetup-Item CRITICALITY reject TYPE DRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeSetup-Item CRITICALITY reject TYPE BHChannels-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeSetup-Item CRITICALITY reject TYPE SLDRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP RESPONSE +-- +-- ************************************************************** + +UEContextSetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupResponseIEs} }, + ... +} + + +UEContextSetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY ignore TYPE C-RNTI PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-DRBs-Setup-List CRITICALITY ignore TYPE DRBs-Setup-List PRESENCE optional }| + { ID id-SRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetup-List CRITICALITY ignore TYPE DRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-SCell-FailedtoSetup-List CRITICALITY ignore TYPE SCell-FailedtoSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-SRBs-Setup-List CRITICALITY ignore TYPE SRBs-Setup-List PRESENCE optional }| + { ID id-BHChannels-Setup-List CRITICALITY ignore TYPE BHChannels-Setup-List PRESENCE optional }| + { ID id-BHChannels-FailedToBeSetup-List CRITICALITY ignore TYPE BHChannels-FailedToBeSetup-List PRESENCE optional }| + { ID id-SLDRBs-Setup-List CRITICALITY ignore TYPE SLDRBs-Setup-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SLDRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + +DRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Setup-ItemIEs} } + + +SRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetup-ItemIEs} } +DRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetup-ItemIEs} } +SCell-FailedtoSetup-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetup-ItemIEs} } +SRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Setup-ItemIEs} } +BHChannels-Setup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Setup-ItemIEs} } +BHChannels-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeSetup-ItemIEs} } + +DRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Setup-Item CRITICALITY ignore TYPE DRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Setup-Item CRITICALITY ignore TYPE SRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetup-Item CRITICALITY ignore TYPE SCell-FailedtoSetup-Item PRESENCE mandatory}, + ... +} + +BHChannels-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Setup-Item CRITICALITY ignore TYPE BHChannels-Setup-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeSetup-Item CRITICALITY ignore TYPE BHChannels-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Setup-ItemIEs} } + +SLDRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeSetup-ItemIEs} } + +SLDRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Setup-Item CRITICALITY ignore TYPE SLDRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP FAILURE +-- +-- ************************************************************** + +UEContextSetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupFailureIEs} }, + ... +} + +UEContextSetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Potential-SpCell-List CRITICALITY ignore TYPE Potential-SpCell-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + +Potential-SpCell-List::= SEQUENCE (SIZE(0..maxnoofPotentialSpCells)) OF ProtocolIE-SingleContainer { { Potential-SpCell-ItemIEs} } + +Potential-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Potential-SpCell-Item CRITICALITY ignore TYPE Potential-SpCell-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Context Release Request ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Release Request +-- +-- ************************************************************** + +UEContextReleaseRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEContextReleaseRequestIEs}}, + ... +} + +UEContextReleaseRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- UE Context Release (gNB-CU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMMAND +-- +-- ************************************************************** + +UEContextReleaseCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCommandIEs} }, + ... +} + +UEContextReleaseCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-SRBID CRITICALITY ignore TYPE SRBID PRESENCE conditional }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMPLETE +-- +-- ************************************************************** + +UEContextReleaseComplete ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCompleteIEs} }, + ... +} + + +UEContextReleaseCompleteIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- UE Context Modification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUEST +-- +-- ************************************************************** + +UEContextModificationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequestIEs} }, + ... +} + +UEContextModificationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SpCell-ID CRITICALITY ignore TYPE NRCGI PRESENCE optional }| + { ID id-ServCellIndex CRITICALITY reject TYPE ServCellIndex PRESENCE optional }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE optional }| + { ID id-TransmissionActionIndicator CRITICALITY ignore TYPE TransmissionActionIndicator PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-RRCReconfigurationCompleteIndicator CRITICALITY ignore TYPE RRCReconfigurationCompleteIndicator PRESENCE optional }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE optional }| + { ID id-SCell-ToBeSetupMod-List CRITICALITY ignore TYPE SCell-ToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-ToBeRemoved-List CRITICALITY ignore TYPE SCell-ToBeRemoved-List PRESENCE optional }| + { ID id-SRBs-ToBeSetupMod-List CRITICALITY reject TYPE SRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeSetupMod-List CRITICALITY reject TYPE DRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeModified-List CRITICALITY reject TYPE DRBs-ToBeModified-List PRESENCE optional }| + { ID id-SRBs-ToBeReleased-List CRITICALITY reject TYPE SRBs-ToBeReleased-List PRESENCE optional }| + { ID id-DRBs-ToBeReleased-List CRITICALITY reject TYPE DRBs-ToBeReleased-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-DRXConfigurationIndicator CRITICALITY ignore TYPE DRXConfigurationIndicator PRESENCE optional }| + { ID id-RLCFailureIndication CRITICALITY ignore TYPE RLCFailureIndication PRESENCE optional }| + { ID id-UplinkTxDirectCurrentListInformation CRITICALITY ignore TYPE UplinkTxDirectCurrentListInformation PRESENCE optional }| + { ID id-GNB-DUConfigurationQuery CRITICALITY reject TYPE GNB-DUConfigurationQuery PRESENCE optional }| + { ID id-GNB-DU-UE-AMBR-UL CRITICALITY ignore TYPE BitRate PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-ServingCellMO CRITICALITY ignore TYPE ServingCellMO PRESENCE optional }| + { ID id-NeedforGap CRITICALITY ignore TYPE NeedforGap PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }| + { ID id-LowerLayerPresenceStatusChange CRITICALITY ignore TYPE LowerLayerPresenceStatusChange PRESENCE optional }| + { ID id-BHChannels-ToBeSetupMod-List CRITICALITY reject TYPE BHChannels-ToBeSetupMod-List PRESENCE optional }| + { ID id-BHChannels-ToBeModified-List CRITICALITY reject TYPE BHChannels-ToBeModified-List PRESENCE optional }| + { ID id-BHChannels-ToBeReleased-List CRITICALITY reject TYPE BHChannels-ToBeReleased-List PRESENCE optional }| + { ID id-NRV2XServicesAuthorized CRITICALITY ignore TYPE NRV2XServicesAuthorized PRESENCE optional }| + { ID id-LTEV2XServicesAuthorized CRITICALITY ignore TYPE LTEV2XServicesAuthorized PRESENCE optional }| + { ID id-NRUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE NRUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-LTEUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE LTEUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-PC5LinkAMBR CRITICALITY ignore TYPE BitRate PRESENCE optional}| + { ID id-SLDRBs-ToBeSetupMod-List CRITICALITY reject TYPE SLDRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-SLDRBs-ToBeModified-List CRITICALITY reject TYPE SLDRBs-ToBeModified-List PRESENCE optional }| + { ID id-SLDRBs-ToBeReleased-List CRITICALITY reject TYPE SLDRBs-ToBeReleased-List PRESENCE optional }| + { ID id-ConditionalIntraDUMobilityInformation CRITICALITY reject TYPE ConditionalIntraDUMobilityInformation PRESENCE optional}, + ... +} + +SCell-ToBeSetupMod-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetupMod-ItemIEs} } +SCell-ToBeRemoved-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeRemoved-ItemIEs} } +SRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetupMod-ItemIEs} } +DRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetupMod-ItemIEs} } +BHChannels-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeSetupMod-ItemIEs} } + +DRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeModified-ItemIEs} } +BHChannels-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeModified-ItemIEs} } +SRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeReleased-ItemIEs} } +DRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeReleased-ItemIEs} } +BHChannels-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeReleased-ItemIEs} } + +SCell-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetupMod-Item CRITICALITY ignore TYPE SCell-ToBeSetupMod-Item PRESENCE mandatory }, + ... +} + +SCell-ToBeRemoved-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeRemoved-Item CRITICALITY ignore TYPE SCell-ToBeRemoved-Item PRESENCE mandatory }, + ... +} + + +SRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetupMod-Item CRITICALITY reject TYPE DRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeModified-Item CRITICALITY reject TYPE DRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + + +SRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeReleased-Item CRITICALITY reject TYPE SRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeReleased-Item CRITICALITY reject TYPE DRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeSetupMod-Item CRITICALITY reject TYPE BHChannels-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeModified-Item CRITICALITY reject TYPE BHChannels-ToBeModified-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeReleased-Item CRITICALITY reject TYPE BHChannels-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeSetupMod-ItemIEs} } +SLDRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeModified-ItemIEs} } +SLDRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeReleased-ItemIEs} } + +SLDRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SLDRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeModified-Item CRITICALITY reject TYPE SLDRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeReleased-Item CRITICALITY reject TYPE SLDRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION RESPONSE +-- +-- ************************************************************** + +UEContextModificationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationResponseIEs} }, + ... +} + + +UEContextModificationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-SetupMod-List CRITICALITY ignore TYPE DRBs-SetupMod-List PRESENCE optional}| + { ID id-DRBs-Modified-List CRITICALITY ignore TYPE DRBs-Modified-List PRESENCE optional}| + { ID id-SRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-FailedtoSetupMod-List CRITICALITY ignore TYPE SCell-FailedtoSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeModified-List CRITICALITY ignore TYPE DRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-C-RNTI CRITICALITY ignore TYPE C-RNTI PRESENCE optional }| + { ID id-Associated-SCell-List CRITICALITY ignore TYPE Associated-SCell-List PRESENCE optional }| + { ID id-SRBs-SetupMod-List CRITICALITY ignore TYPE SRBs-SetupMod-List PRESENCE optional }| + { ID id-SRBs-Modified-List CRITICALITY ignore TYPE SRBs-Modified-List PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-BHChannels-SetupMod-List CRITICALITY ignore TYPE BHChannels-SetupMod-List PRESENCE optional}| + { ID id-BHChannels-Modified-List CRITICALITY ignore TYPE BHChannels-Modified-List PRESENCE optional}| + { ID id-BHChannels-FailedToBeSetupMod-List CRITICALITY ignore TYPE BHChannels-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-BHChannels-FailedToBeModified-List CRITICALITY ignore TYPE BHChannels-FailedToBeModified-List PRESENCE optional }| + { ID id-SLDRBs-SetupMod-List CRITICALITY ignore TYPE SLDRBs-SetupMod-List PRESENCE optional }| + { ID id-SLDRBs-Modified-List CRITICALITY ignore TYPE SLDRBs-Modified-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SLDRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeModified-List CRITICALITY ignore TYPE SLDRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + + +DRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-SetupMod-ItemIEs} } +DRBs-Modified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Modified-ItemIEs } } +SRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-SetupMod-ItemIEs} } +SRBs-Modified-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Modified-ItemIEs } } +DRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeModified-ItemIEs} } +SRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetupMod-ItemIEs} } +DRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetupMod-ItemIEs} } +SCell-FailedtoSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetupMod-ItemIEs} } +BHChannels-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-SetupMod-ItemIEs} } +BHChannels-Modified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Modified-ItemIEs } } +BHChannels-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeModified-ItemIEs} } +BHChannels-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeSetupMod-ItemIEs} } + +Associated-SCell-List ::= SEQUENCE (SIZE(1.. maxnoofSCells)) OF ProtocolIE-SingleContainer { { Associated-SCell-ItemIEs} } + +DRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-SetupMod-Item CRITICALITY ignore TYPE DRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Modified-Item CRITICALITY ignore TYPE DRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-SetupMod-Item CRITICALITY ignore TYPE SRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +SRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Modified-Item CRITICALITY ignore TYPE SRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeModified-Item CRITICALITY ignore TYPE DRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetupMod-Item CRITICALITY ignore TYPE SCell-FailedtoSetupMod-Item PRESENCE mandatory}, + ... +} + +Associated-SCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Associated-SCell-Item CRITICALITY ignore TYPE Associated-SCell-Item PRESENCE mandatory}, + ... +} + +BHChannels-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-SetupMod-Item CRITICALITY ignore TYPE BHChannels-SetupMod-Item PRESENCE mandatory}, + ... +} + + +BHChannels-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Modified-Item CRITICALITY ignore TYPE BHChannels-Modified-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeSetupMod-Item CRITICALITY ignore TYPE BHChannels-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeModified-Item CRITICALITY ignore TYPE BHChannels-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-SetupMod-ItemIEs} } +SLDRBs-Modified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Modified-ItemIEs } } +SLDRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeModified-ItemIEs} } +SLDRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeSetupMod-ItemIEs} } + +SLDRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-SetupMod-Item CRITICALITY ignore TYPE SLDRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Modified-Item CRITICALITY ignore TYPE SLDRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeModified-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION FAILURE +-- +-- ************************************************************** + +UEContextModificationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationFailureIEs} }, + ... +} + +UEContextModificationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- UE Context Modification Required (gNB-DU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUIRED +-- +-- ************************************************************** + +UEContextModificationRequired ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequiredIEs} }, + ... +} + +UEContextModificationRequiredIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-Required-ToBeModified-List CRITICALITY reject TYPE DRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-DRBs-Required-ToBeReleased-List CRITICALITY reject TYPE DRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-BHChannels-Required-ToBeReleased-List CRITICALITY reject TYPE BHChannels-Required-ToBeReleased-List PRESENCE optional}| + { ID id-SLDRBs-Required-ToBeModified-List CRITICALITY reject TYPE SLDRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SLDRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SLDRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional}, + ... +} + +DRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeModified-ItemIEs } } +DRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeReleased-ItemIEs } } + +SRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Required-ToBeReleased-ItemIEs } } + +BHChannels-Required-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Required-ToBeReleased-ItemIEs } } + +DRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeModified-Item CRITICALITY reject TYPE DRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +DRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE DRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +BHChannels-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Required-ToBeReleased-Item CRITICALITY reject TYPE BHChannels-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Required-ToBeModified-ItemIEs } } +SLDRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Required-ToBeReleased-ItemIEs } } + +SLDRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Required-ToBeModified-Item CRITICALITY reject TYPE SLDRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SLDRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION CONFIRM +-- +-- ************************************************************** + +UEContextModificationConfirm::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationConfirmIEs} }, + ... +} + + +UEContextModificationConfirmIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DRBs-ModifiedConf-List CRITICALITY ignore TYPE DRBs-ModifiedConf-List PRESENCE optional}| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-SLDRBs-ModifiedConf-List CRITICALITY ignore TYPE SLDRBs-ModifiedConf-List PRESENCE optional}, + ... +} + +DRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ModifiedConf-ItemIEs } } + +DRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ModifiedConf-Item CRITICALITY ignore TYPE DRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ModifiedConf-ItemIEs } } + +SLDRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ModifiedConf-Item CRITICALITY ignore TYPE SLDRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REFUSE +-- +-- ************************************************************** + +UEContextModificationRefuse::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRefuseIEs} }, + ... +} + + +UEContextModificationRefuseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- WRITE-REPLACE WARNING ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Write-Replace Warning Request +-- +-- ************************************************************** + +WriteReplaceWarningRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningRequestIEs} }, + ... +} + +WriteReplaceWarningRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PWSSystemInformation CRITICALITY reject TYPE PWSSystemInformation PRESENCE mandatory }| + { ID id-RepetitionPeriod CRITICALITY reject TYPE RepetitionPeriod PRESENCE mandatory }| + { ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| + { ID id-Cells-To-Be-Broadcast-List CRITICALITY reject TYPE Cells-To-Be-Broadcast-List PRESENCE optional }, + ... +} + +Cells-To-Be-Broadcast-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-To-Be-Broadcast-List-ItemIEs } } + +Cells-To-Be-Broadcast-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-To-Be-Broadcast-Item CRITICALITY reject TYPE Cells-To-Be-Broadcast-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- Write-Replace Warning Response +-- +-- ************************************************************** + +WriteReplaceWarningResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningResponseIEs} }, + ... +} + +WriteReplaceWarningResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Broadcast-Completed-List CRITICALITY reject TYPE Cells-Broadcast-Completed-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }, + ... +} + +Cells-Broadcast-Completed-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Completed-List-ItemIEs } } + +Cells-Broadcast-Completed-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Completed-Item CRITICALITY reject TYPE Cells-Broadcast-Completed-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- PWS CANCEL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Cancel Request +-- +-- ************************************************************** + +PWSCancelRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {PWSCancelRequestIEs} }, + ... +} + +PWSCancelRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| + { ID id-Broadcast-To-Be-Cancelled-List CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-List PRESENCE optional }| + { ID id-Cancel-all-Warning-Messages-Indicator CRITICALITY reject TYPE Cancel-all-Warning-Messages-Indicator PRESENCE optional }| + { ID id-NotificationInformation CRITICALITY reject TYPE NotificationInformation PRESENCE optional}, + ... +} + +Broadcast-To-Be-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Broadcast-To-Be-Cancelled-List-ItemIEs } } + +Broadcast-To-Be-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Broadcast-To-Be-Cancelled-Item CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS Cancel Response +-- +-- ************************************************************** + +PWSCancelResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {PWSCancelResponseIEs} }, + ... +} + +PWSCancelResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Broadcast-Cancelled-List CRITICALITY reject TYPE Cells-Broadcast-Cancelled-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +Cells-Broadcast-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Cancelled-List-ItemIEs } } + +Cells-Broadcast-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Cancelled-Item CRITICALITY reject TYPE Cells-Broadcast-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Inactivity Notification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Inactivity Notification +-- +-- ************************************************************** + +UEInactivityNotification ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEInactivityNotificationIEs}}, + ... +} + +UEInactivityNotificationIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Activity-List CRITICALITY reject TYPE DRB-Activity-List PRESENCE mandatory } , + ... +} + +DRB-Activity-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRB-Activity-ItemIEs } } + +DRB-Activity-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Activity-Item CRITICALITY reject TYPE DRB-Activity-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- Initial UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- INITIAL UL RRC Message Transfer +-- +-- ************************************************************** + +InitialULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ InitialULRRCMessageTransferIEs}}, + ... +} + +InitialULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY reject TYPE C-RNTI PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-DUtoCURRCContainer CRITICALITY reject TYPE DUtoCURRCContainer PRESENCE optional }| + { ID id-SULAccessIndication CRITICALITY ignore TYPE SULAccessIndication PRESENCE optional }| + { ID id-TransactionID CRITICALITY ignore TYPE TransactionID PRESENCE mandatory }| + { ID id-RANUEID CRITICALITY ignore TYPE RANUEID PRESENCE optional }| + { ID id-RRCContainer-RRCSetupComplete CRITICALITY ignore TYPE RRCContainer-RRCSetupComplete PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- DL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DL RRC Message Transfer +-- +-- ************************************************************** + +DLRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DLRRCMessageTransferIEs}}, + ... +} + +DLRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-UEContextNotRetrievable CRITICALITY reject TYPE UEContextNotRetrievable PRESENCE optional }| + { ID id-RedirectedRRCmessage CRITICALITY reject TYPE OCTET STRING PRESENCE optional }| + { ID id-PLMNAssistanceInfoForNetShar CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional }| + { ID id-new-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UL RRC Message Transfer +-- +-- ************************************************************** + +ULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ULRRCMessageTransferIEs}}, + ... +} + +ULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-SelectedPLMNID CRITICALITY reject TYPE PLMN-Identity PRESENCE optional }| + { ID id-new-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- PRIVATE MESSAGE +-- +-- ************************************************************** + +PrivateMessage ::= SEQUENCE { + privateIEs PrivateIE-Container {{PrivateMessage-IEs}}, + ... +} + +PrivateMessage-IEs F1AP-PRIVATE-IES ::= { + ... +} + + +-- ************************************************************** +-- +-- System Information ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- System information Delivery Command +-- +-- ************************************************************** + +SystemInformationDeliveryCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ SystemInformationDeliveryCommandIEs}}, + ... +} + +SystemInformationDeliveryCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-SItype-List CRITICALITY reject TYPE SItype-List PRESENCE mandatory }| + { ID id-ConfirmedUEID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- Paging PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Paging +-- +-- ************************************************************** + +Paging ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PagingIEs}}, + ... +} + +PagingIEs F1AP-PROTOCOL-IES ::= { + { ID id-UEIdentityIndexValue CRITICALITY reject TYPE UEIdentityIndexValue PRESENCE mandatory }| + { ID id-PagingIdentity CRITICALITY reject TYPE PagingIdentity PRESENCE mandatory }| + { ID id-PagingDRX CRITICALITY ignore TYPE PagingDRX PRESENCE optional }| + { ID id-PagingPriority CRITICALITY ignore TYPE PagingPriority PRESENCE optional }| + { ID id-PagingCell-List CRITICALITY ignore TYPE PagingCell-list PRESENCE mandatory }| + { ID id-PagingOrigin CRITICALITY ignore TYPE PagingOrigin PRESENCE optional }, + ... +} + +PagingCell-list::= SEQUENCE (SIZE(1.. maxnoofPagingCells)) OF ProtocolIE-SingleContainer { { PagingCell-ItemIEs } } + +PagingCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PagingCell-Item CRITICALITY ignore TYPE PagingCell-Item PRESENCE mandatory} , + ... +} + + + +-- ************************************************************** +-- +-- Notify +-- +-- ************************************************************** + +Notify ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ NotifyIEs}}, + ... +} + +NotifyIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Notify-List CRITICALITY reject TYPE DRB-Notify-List PRESENCE mandatory }, + ... +} + +DRB-Notify-List::= SEQUENCE (SIZE(1.. maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRB-Notify-ItemIEs } } + +DRB-Notify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Notify-Item CRITICALITY reject TYPE DRB-Notify-Item PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- NETWORK ACCESS RATE REDUCTION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Network Access Rate Reduction +-- +-- ************************************************************** + +NetworkAccessRateReduction ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ NetworkAccessRateReductionIEs }}, + ... +} + +NetworkAccessRateReductionIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UAC-Assistance-Info CRITICALITY reject TYPE UAC-Assistance-Info PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS RESTART INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Restart Indication +-- +-- ************************************************************** + +PWSRestartIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PWSRestartIndicationIEs} }, + ... +} + +PWSRestartIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NR-CGI-List-For-Restart-List CRITICALITY reject TYPE NR-CGI-List-For-Restart-List PRESENCE mandatory }, + ... +} + +NR-CGI-List-For-Restart-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { NR-CGI-List-For-Restart-List-ItemIEs } } + +NR-CGI-List-For-Restart-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-NR-CGI-List-For-Restart-Item CRITICALITY reject TYPE NR-CGI-List-For-Restart-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS FAILURE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Failure Indication +-- +-- ************************************************************** + +PWSFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PWSFailureIndicationIEs} }, + ... +} + +PWSFailureIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PWS-Failed-NR-CGI-List CRITICALITY reject TYPE PWS-Failed-NR-CGI-List PRESENCE optional }, + ... +} + +PWS-Failed-NR-CGI-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { PWS-Failed-NR-CGI-List-ItemIEs } } + +PWS-Failed-NR-CGI-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PWS-Failed-NR-CGI-Item CRITICALITY reject TYPE PWS-Failed-NR-CGI-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- gNB-DU STATUS INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- gNB-DU Status Indication +-- +-- ************************************************************** + +GNBDUStatusIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUStatusIndicationIEs} }, + ... +} + +GNBDUStatusIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-GNBDUOverloadInformation CRITICALITY reject TYPE GNBDUOverloadInformation PRESENCE mandatory }, + ... +} + + + +-- ************************************************************** +-- +-- RRC Delivery Report ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- RRC Delivery Report +-- +-- ************************************************************** + +RRCDeliveryReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ RRCDeliveryReportIEs}}, + ... +} + +RRCDeliveryReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-RRCDeliveryStatus CRITICALITY ignore TYPE RRCDeliveryStatus PRESENCE mandatory }| + { ID id-SRBID CRITICALITY ignore TYPE SRBID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- F1 Removal ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Removal Request +-- +-- ************************************************************** + +F1RemovalRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalRequestIEs }}, + ... +} + +F1RemovalRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- F1 Removal Response +-- +-- ************************************************************** + +F1RemovalResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalResponseIEs }}, + ... +} + +F1RemovalResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + + ... +} + +-- ************************************************************** +-- +-- F1 Removal Failure +-- +-- ************************************************************** + +F1RemovalFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalFailureIEs }}, + ... +} + +F1RemovalFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + + ... +} + + +-- ************************************************************** +-- +-- TRACE ELEMENTARY PROCEDURES +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- TRACE START +-- +-- ************************************************************** + +TraceStart ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {TraceStartIEs} }, + ... +} + +TraceStartIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- DEACTIVATE TRACE +-- +-- ************************************************************** + +DeactivateTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {DeactivateTraceIEs} }, + ... +} + +DeactivateTraceIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-TraceID CRITICALITY ignore TYPE TraceID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- CELL TRAFFIC TRACE +-- +-- ************************************************************** + +CellTrafficTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {CellTrafficTraceIEs} }, + ... +} + +CellTrafficTraceIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + {ID id-TraceID CRITICALITY ignore TYPE TraceID PRESENCE mandatory }| + {ID id-TraceCollectionEntityIPAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE mandatory }| + {ID id-PrivacyIndicator CRITICALITY ignore TYPE PrivacyIndicator PRESENCE optional }| + + {ID id-TraceCollectionEntityURI CRITICALITY ignore TYPE URI-address PRESENCE optional }, + ... + +} + +-- ************************************************************** +-- +-- DU-CU Radio Information Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DU-CU Radio Information Transfer +-- +-- ************************************************************** + +DUCURadioInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DUCURadioInformationTransferIEs}}, + ... +} + +DUCURadioInformationTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-DUCURadioInformationType CRITICALITY ignore TYPE DUCURadioInformationType PRESENCE mandatory }, + ... +} + + + +-- ************************************************************** +-- +-- CU-DU Radio Information Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- CU-DU Radio Information Transfer +-- +-- ************************************************************** + +CUDURadioInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ CUDURadioInformationTransferIEs}}, + ... +} + +CUDURadioInformationTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CUDURadioInformationType CRITICALITY ignore TYPE CUDURadioInformationType PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- IAB PROCEDURES +-- +-- ************************************************************** +-- ************************************************************** +-- +-- BAP Mapping Configuration ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- BAP MAPPING CONFIGURATION +-- ************************************************************** + + +BAPMappingConfiguration ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {BAPMappingConfiguration-IEs} }, + ... + } + +BAPMappingConfiguration-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-BH-Routing-Information-Added-List CRITICALITY ignore TYPE BH-Routing-Information-Added-List PRESENCE optional}| + { ID id-BH-Routing-Information-Removed-List CRITICALITY ignore TYPE BH-Routing-Information-Removed-List PRESENCE optional}| + { ID id-TrafficMappingInformation CRITICALITY ignore TYPE TrafficMappingInfo PRESENCE optional}, + ... +} + +BH-Routing-Information-Added-List ::= SEQUENCE (SIZE(1.. maxnoofRoutingEntries)) OF ProtocolIE-SingleContainer { { BH-Routing-Information-Added-List-ItemIEs } } +BH-Routing-Information-Removed-List ::= SEQUENCE (SIZE(1.. maxnoofRoutingEntries)) OF ProtocolIE-SingleContainer { { BH-Routing-Information-Removed-List-ItemIEs } } + +BH-Routing-Information-Added-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BH-Routing-Information-Added-List-Item CRITICALITY ignore TYPE BH-Routing-Information-Added-List-Item PRESENCE optional}, + ... +} + +BH-Routing-Information-Removed-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BH-Routing-Information-Removed-List-Item CRITICALITY ignore TYPE BH-Routing-Information-Removed-List-Item PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- BAP MAPPING CONFIGURATION ACKNOWLEDGE +-- ************************************************************** + +BAPMappingConfigurationAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {BAPMappingConfigurationAcknowledge-IEs} }, + ... +} + +BAPMappingConfigurationAcknowledge-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + + + +-- ************************************************************** +-- +-- GNB-DU Configuration ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU RESOURCE CONFIGURATION +-- ************************************************************** + + +GNBDUResourceConfiguration ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ GNBDUResourceConfigurationIEs}}, + ... +} + + +GNBDUResourceConfigurationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Activated-Cells-to-be-Updated-List CRITICALITY reject TYPE Activated-Cells-to-be-Updated-List PRESENCE optional}| + { ID id-Child-Nodes-List CRITICALITY reject TYPE Child-Nodes-List PRESENCE optional}, + ... +} + + + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE CONFIGURATION ACKNOWLEDGE +-- ************************************************************** + + +GNBDUResourceConfigurationAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBDUResourceConfigurationAcknowledgeIEs} }, + ... +} + + +GNBDUResourceConfigurationAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- IAB TNL Address Allocation ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- IAB TNL ADDRESS REQUEST +-- ************************************************************** + + + +IABTNLAddressRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {IABTNLAddressRequestIEs} }, + ... +} + +IABTNLAddressRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-IABv4AddressesRequested CRITICALITY reject TYPE IABv4AddressesRequested PRESENCE optional }| + { ID id-IABIPv6RequestType CRITICALITY reject TYPE IABIPv6RequestType PRESENCE optional }| + { ID id-IAB-TNL-Addresses-To-Remove-List CRITICALITY reject TYPE IAB-TNL-Addresses-To-Remove-List PRESENCE optional }, + ... +} + + +IAB-TNL-Addresses-To-Remove-List ::= SEQUENCE (SIZE(1..maxnoofTLAsIAB)) OF ProtocolIE-SingleContainer { { IAB-TNL-Addresses-To-Remove-ItemIEs } } + +IAB-TNL-Addresses-To-Remove-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-IAB-TNL-Addresses-To-Remove-Item CRITICALITY reject TYPE IAB-TNL-Addresses-To-Remove-Item PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- IAB TNL ADDRESS RESPONSE +-- ************************************************************** + + +IABTNLAddressResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {IABTNLAddressResponseIEs} }, + ... +} + + +IABTNLAddressResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-IAB-Allocated-TNL-Address-List CRITICALITY reject TYPE IAB-Allocated-TNL-Address-List PRESENCE mandatory }, + ... +} + + +IAB-Allocated-TNL-Address-List ::= SEQUENCE (SIZE(1.. maxnoofTLAsIAB)) OF ProtocolIE-SingleContainer { { IAB-Allocated-TNL-Address-List-ItemIEs } } + + +IAB-Allocated-TNL-Address-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-IAB-Allocated-TNL-Address-Item CRITICALITY reject TYPE IAB-Allocated-TNL-Address-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- IAB UP Configuration Update ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- IAB UP Configuration Update Request +-- +-- ************************************************************** + +IABUPConfigurationUpdateRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateRequestIEs} }, + ... +} + +IABUPConfigurationUpdateRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UL-UP-TNL-Information-to-Update-List CRITICALITY ignore TYPE UL-UP-TNL-Information-to-Update-List PRESENCE optional }| + { ID id-UL-UP-TNL-Address-to-Update-List CRITICALITY ignore TYPE UL-UP-TNL-Address-to-Update-List PRESENCE optional }, + ... +} + +UL-UP-TNL-Information-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofULUPTNLInformationforIAB)) OF ProtocolIE-SingleContainer { { UL-UP-TNL-Information-to-Update-List-ItemIEs } } + +UL-UP-TNL-Information-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-UL-UP-TNL-Information-to-Update-List-Item CRITICALITY ignore TYPE UL-UP-TNL-Information-to-Update-List-Item PRESENCE optional}, + ... +} + +UL-UP-TNL-Address-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofUPTNLAddresses)) OF ProtocolIE-SingleContainer { { UL-UP-TNL-Address-to-Update-List-ItemIEs } } + +UL-UP-TNL-Address-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-UL-UP-TNL-Address-to-Update-List-Item CRITICALITY ignore TYPE UL-UP-TNL-Address-to-Update-List-Item PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- IAB UP Configuration Update Response +-- +-- ************************************************************** + +IABUPConfigurationUpdateResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateResponseIEs} }, + ... +} + +IABUPConfigurationUpdateResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-DL-UP-TNL-Address-to-Update-List CRITICALITY reject TYPE DL-UP-TNL-Address-to-Update-List PRESENCE optional }, + ... +} + +DL-UP-TNL-Address-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofUPTNLAddresses)) OF ProtocolIE-SingleContainer { { DL-UP-TNL-Address-to-Update-List-ItemIEs } } + +DL-UP-TNL-Address-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DL-UP-TNL-Address-to-Update-List-Item CRITICALITY ignore TYPE DL-UP-TNL-Address-to-Update-List-Item PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- IAB UP Configuration Update Failure +-- +-- ************************************************************** + +IABUPConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateFailureIEs} }, + ... +} + +IABUPConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Resource Status Reporting Initiation ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Resource Status Request +-- +-- ************************************************************** + +ResourceStatusRequest::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResourceStatusRequestIEs} }, + ... +} + +ResourceStatusRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE conditional }| + { ID id-RegistrationRequest CRITICALITY ignore TYPE RegistrationRequest PRESENCE mandatory }| + { ID id-ReportCharacteristics CRITICALITY ignore TYPE ReportCharacteristics PRESENCE conditional }| + { ID id-CellToReportList CRITICALITY ignore TYPE CellToReportList PRESENCE optional }| + { ID id-ReportingPeriodicity CRITICALITY ignore TYPE ReportingPeriodicity PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Resource Status Response +-- +-- ************************************************************** + +ResourceStatusResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ResourceStatusResponseIEs} }, + ... +} + + +ResourceStatusResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Resource Status Failure +-- +-- ************************************************************** + +ResourceStatusFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ResourceStatusFailureIEs} }, + ... +} + +ResourceStatusFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Resource Status Reporting ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Resource Status Update +-- +-- ************************************************************** + +ResourceStatusUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ResourceStatusUpdateIEs}}, + ... +} + +ResourceStatusUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-HardwareLoadIndicator CRITICALITY ignore TYPE HardwareLoadIndicator PRESENCE optional }| + { ID id-TNLCapacityIndicator CRITICALITY ignore TYPE TNLCapacityIndicator PRESENCE optional }| + { ID id-CellMeasurementResultList CRITICALITY ignore TYPE CellMeasurementResultList PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Access And Mobility Indication ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Access And Mobility Indication +-- +-- ************************************************************** + +AccessAndMobilityIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { AccessAndMobilityIndicationIEs} }, + ... +} + +AccessAndMobilityIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-RACHReportInformationList CRITICALITY ignore TYPE RACHReportInformationList PRESENCE optional }| + { ID id-RLFReportInformationList CRITICALITY ignore TYPE RLFReportInformationList PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- REFERENCE TIME INFORMATION REPORTING CONTROL +-- +-- ************************************************************** + +ReferenceTimeInformationReportingControl::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ReferenceTimeInformationReportingControlIEs} }, + ... +} + +ReferenceTimeInformationReportingControlIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-ReportingRequestType CRITICALITY reject TYPE ReportingRequestType PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- REFERENCE TIME INFORMATION REPORT +-- +-- ************************************************************** + +ReferenceTimeInformationReport::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ReferenceTimeInformationReportIEs} }, + ... +} + +ReferenceTimeInformationReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY ignore TYPE TransactionID PRESENCE mandatory }| + { ID id-TimeReferenceInformation CRITICALITY ignore TYPE TimeReferenceInformation PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- Access Success +-- +-- ************************************************************** + +AccessSuccess ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ AccessSuccessIEs}}, + ... +} + +AccessSuccessIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING ASSISTANCE INFORMATION CONTROL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Assistance Information Control +-- +-- ************************************************************** + +PositioningAssistanceInformationControl ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PositioningAssistanceInformationControlIEs}}, + ... +} + +PositioningAssistanceInformationControlIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PosAssistance-Information CRITICALITY reject TYPE PosAssistance-Information PRESENCE optional}| + { ID id-PosBroadcast CRITICALITY reject TYPE PosBroadcast PRESENCE optional}| + { ID id-PositioningBroadcastCells CRITICALITY reject TYPE PositioningBroadcastCells PRESENCE optional}| + { ID id-RoutingID CRITICALITY reject TYPE RoutingID PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- POSITIONING ASSISTANCE INFORMATION FEEDBACK ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Assistance Information Feedback +-- +-- ************************************************************** + +PositioningAssistanceInformationFeedback ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PositioningAssistanceInformationFeedbackIEs}}, + ... +} + +PositioningAssistanceInformationFeedbackIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PosAssistanceInformationFailureList CRITICALITY reject TYPE PosAssistanceInformationFailureList PRESENCE optional}| + { ID id-PositioningBroadcastCells CRITICALITY reject TYPE PositioningBroadcastCells PRESENCE optional}| + { ID id-RoutingID CRITICALITY reject TYPE RoutingID PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- POSITONING MEASUREMENT EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Request +-- +-- ************************************************************** + +PositioningMeasurementRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementRequestIEs} }, + ... +} + +PositioningMeasurementRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory}| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory}| + { ID id-TRP-MeasurementRequestList CRITICALITY reject TYPE TRP-MeasurementRequestList PRESENCE mandatory}| + { ID id-PosReportCharacteristics CRITICALITY reject TYPE PosReportCharacteristics PRESENCE mandatory}| + { ID id-PosMeasurementPeriodicity CRITICALITY reject TYPE PosMeasurementPeriodicity PRESENCE conditional }| + -- The above IE shall be present if the PosReportCharacteristics IE is set to “periodic” -- + { ID id-PosMeasurementQuantities CRITICALITY reject TYPE PosMeasurementQuantities PRESENCE mandatory}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-MeasurementBeamInfoRequest CRITICALITY ignore TYPE MeasurementBeamInfoRequest PRESENCE optional }| + { ID id-SystemFrameNumber CRITICALITY ignore TYPE SystemFrameNumber PRESENCE optional}| + { ID id-SlotNumber CRITICALITY ignore TYPE SlotNumber PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Positioning Measurement Response +-- +-- ************************************************************** + +PositioningMeasurementResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementResponseIEs} }, + ... +} + + +PositioningMeasurementResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory}| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory}| + { ID id-PosMeasurementResultList CRITICALITY reject TYPE PosMeasurementResultList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Positioning Measurement Failure +-- +-- ************************************************************** + +PositioningMeasurementFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementFailureIEs} }, + ... +} + +PositioningMeasurementFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT REPORT ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Report +-- +-- ************************************************************** + +PositioningMeasurementReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementReportIEs} }, + ... +} + +PositioningMeasurementReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-PosMeasurementResultList CRITICALITY reject TYPE PosMeasurementResultList PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT ABORT ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Abort +-- +-- ************************************************************** + +PositioningMeasurementAbort ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementAbortIEs} }, + ... +} + +PositioningMeasurementAbortIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT FAILURE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Failure Indication +-- +-- ************************************************************** + +PositioningMeasurementFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementFailureIndicationIEs} }, + ... +} + +PositioningMeasurementFailureIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Update +-- +-- ************************************************************** + +PositioningMeasurementUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementUpdateIEs} }, + ... +} + +PositioningMeasurementUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- TRP INFORMATION EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- TRP Information Request +-- +-- ************************************************************** + +TRPInformationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationRequestIEs} }, + ... +} + +TRPInformationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-TRPList CRITICALITY ignore TYPE TRPList PRESENCE optional }| + { ID id-TRPInformationTypeListTRPReq CRITICALITY reject TYPE TRPInformationTypeListTRPReq PRESENCE mandatory }, + ... +} + +TRPInformationTypeListTRPReq ::= SEQUENCE (SIZE(1.. maxnoofTRPInfoTypes)) OF ProtocolIE-SingleContainer { { TRPInformationTypeItemTRPReq } } + +TRPInformationTypeItemTRPReq F1AP-PROTOCOL-IES ::= { + { ID id-TRPInformationTypeItem CRITICALITY reject TYPE TRPInformationTypeItem PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- TRP Information Response +-- +-- ************************************************************** + +TRPInformationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationResponseIEs} }, + ... +} + +TRPInformationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-TRPInformationListTRPResp CRITICALITY ignore TYPE TRPInformationListTRPResp PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +TRPInformationListTRPResp ::= SEQUENCE (SIZE(1.. maxnoofTRPs)) OF ProtocolIE-SingleContainer { { TRPInformationItemTRPResp } } + +TRPInformationItemTRPResp F1AP-PROTOCOL-IES ::= { + { ID id-TRPInformationItem CRITICALITY ignore TYPE TRPInformationItem PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- TRP Information Failure +-- +-- ************************************************************** + +TRPInformationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationFailureIEs} }, + ... +} + +TRPInformationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING INFORMATION EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Information Request +-- +-- ************************************************************** + +PositioningInformationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationRequestIEs} }, + ... +} + +PositioningInformationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-RequestedSRSTransmissionCharacteristics CRITICALITY ignore TYPE RequestedSRSTransmissionCharacteristics PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Positioning Information Response +-- +-- ************************************************************** + +PositioningInformationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationResponseIEs} }, + ... +} + + +PositioningInformationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Positioning Information Failure +-- +-- ************************************************************** + +PositioningInformationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationFailureIEs} }, + ... +} + +PositioningInformationFailureIEs F1AP-PROTOCOL-IES ::= { + + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING ACTIVATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Activation Request +-- +-- ************************************************************** + +PositioningActivationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationRequestIEs} }, + ... +} + +PositioningActivationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSType CRITICALITY reject TYPE SRSType PRESENCE mandatory }| + { ID id-ActivationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional }, + ... +} + +SRSType ::= CHOICE { + semipersistentSRS SemipersistentSRS, + aperiodicSRS AperiodicSRS, + choice-extension ProtocolIE-SingleContainer { { SRSType-ExtIEs} } +} + +SRSType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SemipersistentSRS ::= SEQUENCE { + sRSResourceSetID SRSResourceSetID, + sRSSpatialRelation SRSSpatialRelation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {SemipersistentSRS-ExtIEs} } OPTIONAL, + ... +} + +SemipersistentSRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AperiodicSRS ::= SEQUENCE { + aperiodic ENUMERATED {true, ...}, + sRSResourceTrigger SRSResourceTrigger OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {AperiodicSRS-ExtIEs} } OPTIONAL, + ... +} + +AperiodicSRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- ************************************************************** +-- +-- Positioning Activation Response +-- +-- ************************************************************** + +PositioningActivationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationResponseIEs} }, + ... +} + + +PositioningActivationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SystemFrameNumber CRITICALITY ignore TYPE SystemFrameNumber PRESENCE optional }| + { ID id-SlotNumber CRITICALITY ignore TYPE SlotNumber PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + + + +-- ************************************************************** +-- +-- Positioning Activation Failure +-- +-- ************************************************************** + +PositioningActivationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationFailureIEs} }, + ... +} + +PositioningActivationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING DEACTIVATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Deactivation +-- +-- ************************************************************** + +PositioningDeactivation ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningDeactivationIEs} }, + ... +} + +PositioningDeactivationIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-AbortTransmission CRITICALITY ignore TYPE AbortTransmission PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING INFORMATION UPDATE PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Information Update +-- +-- ************************************************************** + +PositioningInformationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationUpdateIEs} }, + ... +} + + +PositioningInformationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Request +-- +-- ************************************************************** + +E-CIDMeasurementInitiationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationRequest-IEs}}, + ... +} + +E-CIDMeasurementInitiationRequest-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-ReportCharacteristics CRITICALITY reject TYPE E-CID-ReportCharacteristics PRESENCE mandatory }| + { ID id-E-CID-MeasurementPeriodicity CRITICALITY reject TYPE E-CID-MeasurementPeriodicity PRESENCE conditional }| +-- The above IE shall be present if the E-CID-ReportCharacteristics IE is set to “periodic” –- + { ID id-E-CID-MeasurementQuantities CRITICALITY reject TYPE E-CID-MeasurementQuantities PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Response +-- +-- ************************************************************** + +E-CIDMeasurementInitiationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationResponse-IEs}}, + ... +} + +E-CIDMeasurementInitiationResponse-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-MeasurementResult CRITICALITY ignore TYPE E-CID-MeasurementResult PRESENCE optional}| + { ID id-Cell-Portion-ID CRITICALITY ignore TYPE Cell-Portion-ID PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Failure +-- +-- ************************************************************** + +E-CIDMeasurementInitiationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationFailure-IEs}}, + ... +} + + +E-CIDMeasurementInitiationFailure-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT FAILURE INDICATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Failure Indication +-- +-- ************************************************************** + +E-CIDMeasurementFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementFailureIndication-IEs}}, + ... +} + + +E-CIDMeasurementFailureIndication-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT REPORT PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Report +-- +-- ************************************************************** + +E-CIDMeasurementReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementReport-IEs}}, + ... +} + + +E-CIDMeasurementReport-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-MeasurementResult CRITICALITY ignore TYPE E-CID-MeasurementResult PRESENCE mandatory }| + { ID id-Cell-Portion-ID CRITICALITY ignore TYPE Cell-Portion-ID PRESENCE optional}, + + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT TERMINATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Termination Command +-- +-- ************************************************************** + + +E-CIDMeasurementTerminationCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementTerminationCommand-IEs}}, + ... +} + + +E-CIDMeasurementTerminationCommand-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }, + ... +} + + + +END +-- ASN1STOP + + +-- ASN1START +-- ************************************************************** +-- +-- Information Element Definitions +-- +-- ************************************************************** + +F1AP-IEs { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-IEs (2) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + id-gNB-CUSystemInformation, + id-HandoverPreparationInformation, + id-TAISliceSupportList, + id-RANAC, + id-BearerTypeChange, + id-Cell-Direction, + id-Cell-Type, + id-CellGroupConfig, + id-AvailablePLMNList, + id-PDUSessionID, + id-ULPDUSessionAggregateMaximumBitRate, + id-DC-Based-Duplication-Configured, + id-DC-Based-Duplication-Activation, + id-Duplication-Activation, + id-DLPDCPSNLength, + id-ULPDCPSNLength, + id-RLC-Status, + id-MeasurementTimingConfiguration, + id-DRB-Information, + id-QoSFlowMappingIndication, + id-ServingCellMO, + id-RLCMode, + id-ExtendedServedPLMNs-List, + id-ExtendedAvailablePLMN-List, + id-DRX-LongCycleStartOffset, + id-SelectedBandCombinationIndex, + id-SelectedFeatureSetEntryIndex, + id-Ph-InfoSCG, + id-latest-RRC-Version-Enhanced, + id-RequestedBandCombinationIndex, + id-RequestedFeatureSetEntryIndex, + id-DRX-Config, + id-UEAssistanceInformation, + id-PDCCH-BlindDetectionSCG, + id-Requested-PDCCH-BlindDetectionSCG, + id-BPLMN-ID-Info-List, + id-NotificationInformation, + id-TNLAssociationTransportLayerAddressgNBDU, + id-portNumber, + id-AdditionalSIBMessageList, + id-IgnorePRACHConfiguration, + id-CG-Config, + id-Ph-InfoMCG, + id-AggressorgNBSetID, + id-VictimgNBSetID, + id-MeasGapSharingConfig, + id-systemInformationAreaID, + id-areaScope, + id-IntendedTDD-DL-ULConfig, + id-QosMonitoringRequest, + id-BHInfo, + id-IAB-Info-IAB-DU, + id-IAB-Info-IAB-donor-CU, + id-IAB-Barred, + id-SIB12-message, + id-SIB13-message, + id-SIB14-message, + id-UEAssistanceInformationEUTRA, + id-SL-PHY-MAC-RLC-Config, + id-SL-ConfigDedicatedEUTRA, + id-AlternativeQoSParaSetList, + id-CurrentQoSParaSetIndex, + id-CarrierList, + id-ULCarrierList, + id-FrequencyShift7p5khz, + id-SSB-PositionsInBurst, + id-NRPRACHConfig, + id-TDD-UL-DLConfigCommonNR, + id-CNPacketDelayBudgetDownlink, + id-CNPacketDelayBudgetUplink, + id-ExtendedPacketDelayBudget, + id-TSCTrafficCharacteristics, + id-AdditionalPDCPDuplicationTNL-List, + id-RLCDuplicationInformation, + id-AdditionalDuplicationIndication, + id-mdtConfiguration, + id-TraceCollectionEntityURI, + id-NID, + id-NPNSupportInfo, + id-NPNBroadcastInformation, + id-AvailableSNPN-ID-List, + id-SIB10-message, + id-RequestedP-MaxFR2, + id-DLCarrierList, + id-ExtendedTAISliceSupportList, + id-E-CID-MeasurementQuantities-Item, + id-ConfiguredTACIndication, + maxNRARFCN, + maxnoofErrors, + maxnoofBPLMNs, + maxnoofBPLMNsNR, + maxnoofDLUPTNLInformation, + maxnoofNrCellBands, + maxnoofULUPTNLInformation, + maxnoofQoSFlows, + maxnoofSliceItems, + maxnoofSIBTypes, + maxnoofSITypes, + maxCellineNB, + maxnoofExtendedBPLMNs, + maxnoofAdditionalSIBs, + maxnoofUACPLMNs, + maxnoofUACperPLMN, + maxCellingNBDU, + maxnoofTLAs, + maxnoofGTPTLAs, + maxnoofslots, + maxnoofNonUPTrafficMappings, + maxnoofServingCells, + maxnoofServedCellsIAB, + maxnoofChildIABNodes, + maxnoofIABSTCInfo, + maxnoofSymbols, + maxnoofDUFSlots, + maxnoofHSNASlots, + maxnoofEgressLinks, + maxnoofMappingEntries, + maxnoofDSInfo, + maxnoofQoSParaSets, + maxnoofPC5QoSFlows, + maxnoofSSBAreas, + maxnoofBPLMNsNR, + maxnoofNRSCSs, + maxnoofPhysicalResourceBlocks, + maxnoofPhysicalResourceBlocks-1, + maxnoofPRACHconfigs, + maxnoofRACHReports, + maxnoofRLFReports, + maxnoofAdditionalPDCPDuplicationTNL, + maxnoofRLCDuplicationState, + maxnoofCHOcells, + maxnoofMDTPLMNs, + maxnoofCAGsupported, + maxnoofNIDsupported, + maxnoofNRSCSs, + maxnoofPhysicalResourceBlocks, + maxnoofExtSliceItems, + maxnoofPosMeas, + maxnoofTRPInfoTypes, + maxnoofSRSTriggerStates, + maxnoofSpatialRelations, + maxnoBcastCell, + maxnoofTRPs, + maxnoofAngleInfo, + maxnooflcs-gcs-translation, + maxnoofPath, + maxnoofMeasE-CID, + maxnoofSSBs, + maxnoSRS-ResourceSets, + maxnoSRS-ResourcePerSet, + maxnoSRS-Carriers, + maxnoSCSs, + maxnoSRS-Resources, + maxnoSRS-PosResources, + maxnoSRS-PosResourceSets, + maxnoSRS-PosResourcePerSet, + maxnoofPRS-ResourceSets, + maxnoofPRS-ResourcesPerSet, + maxNoOfMeasTRPs, + maxnoofPRSresourceSets, + maxnoofPRSresources + + + +FROM F1AP-Constants + + Criticality, + ProcedureCode, + ProtocolIE-ID, + TriggeringMessage + +FROM F1AP-CommonDataTypes + + ProtocolExtensionContainer{}, + F1AP-PROTOCOL-EXTENSION, + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + +-- A + +AbortTransmission ::= CHOICE { + sRSResourceSetID SRSResourceSetID, + releaseALL NULL, + choice-extension ProtocolIE-SingleContainer { { AbortTransmission-ExtIEs } } +} + +AbortTransmission-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +AccessPointPosition ::= SEQUENCE { + latitudeSign ENUMERATED {north, south}, + latitude INTEGER (0..8388607), + longitude INTEGER (-8388608..8388607), + directionOfAltitude ENUMERATED {height, depth}, + altitude INTEGER (0..32767), + uncertaintySemi-major INTEGER (0..127), + uncertaintySemi-minor INTEGER (0..127), + orientationOfMajorAxis INTEGER (0..179), + uncertaintyAltitude INTEGER (0..127), + confidence INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { AccessPointPosition-ExtIEs} } OPTIONAL +} + +AccessPointPosition-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Activated-Cells-to-be-Updated-List ::= SEQUENCE (SIZE(1..maxnoofServedCellsIAB)) OF Activated-Cells-to-be-Updated-List-Item + +Activated-Cells-to-be-Updated-List-Item ::= SEQUENCE{ + nRCGI NRCGI, + iAB-DU-Cell-Resource-Configuration-Mode-Info IAB-DU-Cell-Resource-Configuration-Mode-Info, + iE-Extensions ProtocolExtensionContainer { { Activated-Cells-to-be-Updated-List-Item-ExtIEs} } OPTIONAL +} + +Activated-Cells-to-be-Updated-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ActiveULBWP ::= SEQUENCE { + locationAndBandwidth INTEGER (0..37949,...), + subcarrierSpacing ENUMERATED {kHz15, kHz30, kHz60, kHz120,...}, + cyclicPrefix ENUMERATED {normal, extended}, + txDirectCurrentLocation INTEGER (0..3301,...), + shift7dot5kHz ENUMERATED {true, ...} OPTIONAL, + sRSConfig SRSConfig, + iE-Extensions ProtocolExtensionContainer { { ActiveULBWP-ExtIEs} } OPTIONAL +} + +ActiveULBWP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalDuplicationIndication ::= ENUMERATED { + three, + four, + ... +} + + +AdditionalPath-List::= SEQUENCE (SIZE(1..maxnoofPath)) OF AdditionalPath-Item + +AdditionalPath-Item ::=SEQUENCE { + relativePathDelay RelativePathDelay, + pathQuality TRPMeasurementQuality OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { AdditionalPath-Item-ExtIEs } } OPTIONAL +} + +AdditionalPath-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AdditionalPDCPDuplicationTNL-List ::= SEQUENCE (SIZE(1..maxnoofAdditionalPDCPDuplicationTNL)) OF AdditionalPDCPDuplicationTNL-Item + +AdditionalPDCPDuplicationTNL-Item ::=SEQUENCE { + additionalPDCPDuplicationUPTNLInformation UPTransportLayerInformation, + iE-Extensions ProtocolExtensionContainer { { AdditionalPDCPDuplicationTNL-ItemExtIEs } } OPTIONAL, + ... +} + +AdditionalPDCPDuplicationTNL-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalSIBMessageList ::= SEQUENCE (SIZE(1..maxnoofAdditionalSIBs)) OF AdditionalSIBMessageList-Item + +AdditionalSIBMessageList-Item ::= SEQUENCE { + additionalSIB OCTET STRING, + iE-Extensions ProtocolExtensionContainer { { AdditionalSIBMessageList-Item-ExtIEs} } OPTIONAL +} + +AdditionalSIBMessageList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalRRMPriorityIndex ::= BIT STRING (SIZE(32)) + +AggressorCellList ::= SEQUENCE (SIZE(1..maxCellingNBDU)) OF AggressorCellList-Item + +AggressorCellList-Item ::= SEQUENCE { + aggressorCell-ID NRCGI, + iE-Extensions ProtocolExtensionContainer { { AggressorCellList-Item-ExtIEs } } OPTIONAL +} + +AggressorCellList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AggressorgNBSetID ::= SEQUENCE { + aggressorgNBSetID GNBSetID, + iE-Extensions ProtocolExtensionContainer { { AggressorgNBSetID-ExtIEs } } OPTIONAL +} + +AggressorgNBSetID-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {AllocationAndRetentionPriority-ExtIEs} } OPTIONAL, + ... +} + +AllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AlternativeQoSParaSetList ::= SEQUENCE (SIZE(1..maxnoofQoSParaSets)) OF AlternativeQoSParaSetItem + +AlternativeQoSParaSetItem ::= SEQUENCE { + alternativeQoSParaSetIndex QoSParaSetIndex, + guaranteedFlowBitRateDL BitRate OPTIONAL, + guaranteedFlowBitRateUL BitRate OPTIONAL, + packetDelayBudget PacketDelayBudget OPTIONAL, + packetErrorRate PacketErrorRate OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {AlternativeQoSParaSetItem-ExtIEs} } OPTIONAL, + ... +} + +AlternativeQoSParaSetItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AngleMeasurementQuality ::= SEQUENCE { + azimuthQuality INTEGER(0..255), + zenithQuality INTEGER(0..255) OPTIONAL, + resolution ENUMERATED{deg0dot1,...}, + iE-Extensions ProtocolExtensionContainer { { AngleMeasurementQuality-ExtIEs } } OPTIONAL +} + +AngleMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AperiodicSRSResourceTriggerList ::= SEQUENCE (SIZE(1..maxnoofSRSTriggerStates)) OF AperiodicSRSResourceTrigger + +AperiodicSRSResourceTrigger ::= INTEGER (0..3, ...) + +Associated-SCell-Item ::= SEQUENCE { + sCell-ID NRCGI, + iE-Extensions ProtocolExtensionContainer { { Associated-SCell-ItemExtIEs } } OPTIONAL +} + +Associated-SCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AvailablePLMNList ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF AvailablePLMNList-Item + +AvailablePLMNList-Item ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { AvailablePLMNList-Item-ExtIEs} } OPTIONAL +} + +AvailablePLMNList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AvailableSNPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF AvailableSNPN-ID-List-Item + +AvailableSNPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + availableNIDList BroadcastNIDList, + iE-Extensions ProtocolExtensionContainer { { AvailableSNPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +AvailableSNPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AveragingWindow ::= INTEGER (0..4095, ...) + +AreaScope ::= ENUMERATED {true, ...} + +-- B + +BandwidthSRS ::= CHOICE { + fR1 FR1-Bandwidth, + fR2 FR2-Bandwidth, + choice-extension ProtocolIE-SingleContainer {{ BandwidthSRS-ExtIEs }} +} + +BandwidthSRS-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +BAPAddress ::= BIT STRING (SIZE(10)) + +BAPCtrlPDUChannel ::= ENUMERATED {true, ...} + +BAPlayerBHRLCchannelMappingInfo ::= SEQUENCE { + bAPlayerBHRLCchannelMappingInfoToAdd BAPlayerBHRLCchannelMappingInfoList OPTIONAL, + bAPlayerBHRLCchannelMappingInfoToRemove MappingInformationtoRemove OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BAPlayerBHRLCchannelMappingInfo-ExtIEs} } OPTIONAL, + ... +} + +BAPlayerBHRLCchannelMappingInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BAPlayerBHRLCchannelMappingInfoList ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF BAPlayerBHRLCchannelMappingInfo-Item + +BAPlayerBHRLCchannelMappingInfo-Item ::= SEQUENCE { + mappingInformationIndex MappingInformationIndex, + priorHopBAPAddress BAPAddress OPTIONAL, + ingressbHRLCChannelID BHRLCChannelID OPTIONAL, + nextHopBAPAddress BAPAddress OPTIONAL, + egressbHRLCChannelID BHRLCChannelID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BAPlayerBHRLCchannelMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +BAPlayerBHRLCchannelMappingInfo-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BAPPathID ::= BIT STRING (SIZE(10)) + +BAPRoutingID ::= SEQUENCE { + bAPAddress BAPAddress, + bAPPathID BAPPathID, + iE-Extensions ProtocolExtensionContainer { { BAPRoutingIDExtIEs } } OPTIONAL +} + +BAPRoutingIDExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BitRate ::= INTEGER (0..4000000000000,...) + +BearerTypeChange ::= ENUMERATED {true, ...} + +BHRLCChannelID ::= BIT STRING (SIZE(16)) + +BHChannels-FailedToBeModified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeModified-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-FailedToBeSetup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeSetup-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-FailedToBeSetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Modified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Modified-ItemExtIEs } } OPTIONAL +} + +BHChannels-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Required-ToBeReleased-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Required-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +BHChannels-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Setup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Setup-ItemExtIEs } } OPTIONAL +} + +BHChannels-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-SetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-SetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeModified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode OPTIONAL, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeModified-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeReleased-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeSetup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeSetup-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeSetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHInfo ::= SEQUENCE { + bAProutingID BAPRoutingID OPTIONAL, + egressBHRLCCHList EgressBHRLCCHList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHInfo-ExtIEs} } OPTIONAL +} + +BHInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHQoSInformation ::= CHOICE { + bHRLCCHQoS QoSFlowLevelQoSParameters, + eUTRANBHRLCCHQoS EUTRANQoS, + cPTrafficType CPTrafficType, + choice-extension ProtocolIE-SingleContainer { { BHQoSInformation-ExtIEs} } +} + +BHQoSInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +BH-Routing-Information-Added-List-Item ::= SEQUENCE { + bAPRoutingID BAPRoutingID, + nextHopBAPAddress BAPAddress, + iE-Extensions ProtocolExtensionContainer { { BH-Routing-Information-Added-List-ItemExtIEs} } OPTIONAL +} + +BH-Routing-Information-Added-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BH-Routing-Information-Removed-List-Item ::= SEQUENCE { + bAPRoutingID BAPRoutingID, + iE-Extensions ProtocolExtensionContainer { { BH-Routing-Information-Removed-List-ItemExtIEs} } OPTIONAL +} + +BH-Routing-Information-Removed-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BPLMN-ID-Info-List ::= SEQUENCE (SIZE(1..maxnoofBPLMNsNR)) OF BPLMN-ID-Info-Item + +BPLMN-ID-Info-Item ::= SEQUENCE { + pLMN-Identity-List AvailablePLMNList, + extended-PLMN-Identity-List ExtendedAvailablePLMN-List OPTIONAL, + fiveGS-TAC FiveGS-TAC OPTIONAL, + nr-cell-ID NRCellIdentity, + ranac RANAC OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BPLMN-ID-Info-ItemExtIEs} } OPTIONAL, + ... +} + +BPLMN-ID-Info-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ConfiguredTACIndication CRITICALITY ignore EXTENSION ConfiguredTACIndication PRESENCE optional }| + { ID id-NPNBroadcastInformation CRITICALITY reject EXTENSION NPNBroadcastInformation PRESENCE optional}, + ... +} + +ServedPLMNs-List ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF ServedPLMNs-Item + +ServedPLMNs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { ServedPLMNs-ItemExtIEs} } OPTIONAL, + ... +} + +ServedPLMNs-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { +{ ID id-TAISliceSupportList CRITICALITY ignore EXTENSION SliceSupportList PRESENCE optional }| +{ ID id-NPNSupportInfo CRITICALITY reject EXTENSION NPNSupportInfo PRESENCE optional }| +{ ID id-ExtendedTAISliceSupportList CRITICALITY reject EXTENSION ExtendedSliceSupportList PRESENCE optional }, + ... +} + +BroadcastCAGList ::= SEQUENCE (SIZE(1..maxnoofCAGsupported)) OF CAGID + +BroadcastNIDList ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF NID + +BroadcastSNPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF BroadcastSNPN-ID-List-Item + +BroadcastSNPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + broadcastNIDList BroadcastNIDList, + iE-Extensions ProtocolExtensionContainer { { BroadcastSNPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +BroadcastSNPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BroadcastPNI-NPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofCAGsupported)) OF BroadcastPNI-NPN-ID-List-Item + +BroadcastPNI-NPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + broadcastCAGList BroadcastCAGList, + iE-Extensions ProtocolExtensionContainer { { BroadcastPNI-NPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +BroadcastPNI-NPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +BurstArrivalTime ::= OCTET STRING + +-- C +CAGID ::= BIT STRING (SIZE(32)) + +Cancel-all-Warning-Messages-Indicator ::= ENUMERATED {true, ...} + +Candidate-SpCell-Item ::= SEQUENCE { + candidate-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Candidate-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Candidate-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CapacityValue::= SEQUENCE { + capacityValue INTEGER (0..100), + sSBAreaCapacityValueList SSBAreaCapacityValueList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CapacityValue-ExtIEs} } OPTIONAL +} + +CapacityValue-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cause ::= CHOICE { + radioNetwork CauseRadioNetwork, + transport CauseTransport, + protocol CauseProtocol, + misc CauseMisc, + choice-extension ProtocolIE-SingleContainer { { Cause-ExtIEs} } +} + +Cause-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CauseMisc ::= ENUMERATED { + control-processing-overload, + not-enough-user-plane-processing-resources, + hardware-failure, + om-intervention, + unspecified, + ... +} + +CauseProtocol ::= ENUMERATED { + transfer-syntax-error, + abstract-syntax-error-reject, + abstract-syntax-error-ignore-and-notify, + message-not-compatible-with-receiver-state, + semantic-error, + abstract-syntax-error-falsely-constructed-message, + unspecified, + ... +} + +CauseRadioNetwork ::= ENUMERATED { + unspecified, + rl-failure-rlc, + unknown-or-already-allocated-gnb-cu-ue-f1ap-id, + unknown-or-already-allocated-gnb-du-ue-f1ap-id, + unknown-or-inconsistent-pair-of-ue-f1ap-id, + interaction-with-other-procedure, + not-supported-qci-Value, + action-desirable-for-radio-reasons, + no-radio-resources-available, + procedure-cancelled, + normal-release, + ..., + cell-not-available, + rl-failure-others, + ue-rejection, + resources-not-available-for-the-slice, + amf-initiated-abnormal-release, + release-due-to-pre-emption, + plmn-not-served-by-the-gNB-CU, + multiple-drb-id-instances, + unknown-drb-id, + multiple-bh-rlc-ch-id-instances, + unknown-bh-rlc-ch-id, + cho-cpc-resources-tobechanged, + nPN-not-supported, + nPN-access-denied, + gNB-CU-Cell-Capacity-Exceeded, + report-characteristics-empty, + existing-measurement-ID, + measurement-temporarily-not-available, + measurement-not-supported-for-the-object + +} + +CauseTransport ::= ENUMERATED { + unspecified, + transport-resource-unavailable, + ..., + unknown-TNL-address-for-IAB, + unknown-UP-TNL-information-for-IAB +} + +CellGroupConfig ::= OCTET STRING + +CellCapacityClassValue ::= INTEGER (1..100,...) + +Cell-Direction ::= ENUMERATED {dl-only, ul-only} + +CellMeasurementResultList ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF CellMeasurementResultItem + +CellMeasurementResultItem ::= SEQUENCE { + cellID NRCGI, + radioResourceStatus RadioResourceStatus OPTIONAL, + compositeAvailableCapacityGroup CompositeAvailableCapacityGroup OPTIONAL, + sliceAvailableCapacity SliceAvailableCapacity OPTIONAL, + numberofActiveUEs NumberofActiveUEs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CellMeasurementResultItem-ExtIEs} } OPTIONAL +} + +CellMeasurementResultItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cell-Portion-ID ::= INTEGER (0..4095,...) + +Cells-Failed-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { Cells-Failed-to-be-Activated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Failed-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-Status-Item ::= SEQUENCE { + nRCGI NRCGI, + service-status Service-Status, + iE-Extensions ProtocolExtensionContainer { { Cells-Status-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Status-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-To-Be-Broadcast-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-To-Be-Broadcast-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-To-Be-Broadcast-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-Broadcast-Completed-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Completed-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Completed-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Broadcast-To-Be-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Broadcast-To-Be-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Broadcast-To-Be-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Cells-Broadcast-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Activated-List-ItemExtIEs} } OPTIONAL, + ... +} + +Cells-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-gNB-CUSystemInformation CRITICALITY reject EXTENSION GNB-CUSystemInformation PRESENCE optional }| + { ID id-AvailablePLMNList CRITICALITY ignore EXTENSION AvailablePLMNList PRESENCE optional }| + { ID id-ExtendedAvailablePLMN-List CRITICALITY ignore EXTENSION ExtendedAvailablePLMN-List PRESENCE optional }| + { ID id-IAB-Info-IAB-donor-CU CRITICALITY ignore EXTENSION IAB-Info-IAB-donor-CU PRESENCE optional}| + { ID id-AvailableSNPN-ID-List CRITICALITY ignore EXTENSION AvailableSNPN-ID-List PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Deactivated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-to-be-Deactivated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Barred-Item::= SEQUENCE { + nRCGI NRCGI , + cellBarred CellBarred, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Barred-Item-ExtIEs } } OPTIONAL +} + +Cells-to-be-Barred-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-IAB-Barred CRITICALITY ignore EXTENSION IAB-Barred PRESENCE optional }, + + ... +} + + +CellBarred ::= ENUMERATED {barred, not-barred, ...} + +CellSize ::= ENUMERATED {verysmall, small, medium, large, ...} + +CellToReportList ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF CellToReportItem + +CellToReportItem ::= SEQUENCE { + cellID NRCGI, + sSBToReportList SSBToReportList OPTIONAL, + sliceToReportList SliceToReportList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CellToReportItem-ExtIEs} } OPTIONAL +} + +CellToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellType ::= SEQUENCE { + cellSize CellSize, + iE-Extensions ProtocolExtensionContainer { {CellType-ExtIEs} } OPTIONAL, + ... +} + +CellType-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellULConfigured ::= ENUMERATED {none, ul, sul, ul-and-sul, ...} + +Child-Node-Cells-List ::= SEQUENCE (SIZE(1..maxnoofChildIABNodes)) OF Child-Node-Cells-List-Item + +Child-Node-Cells-List-Item ::= SEQUENCE{ + nRCGI NRCGI, + iAB-DU-Cell-Resource-Configuration-Mode-Info IAB-DU-Cell-Resource-Configuration-Mode-Info OPTIONAL, + iAB-STC-Info IAB-STC-Info OPTIONAL, + rACH-Config-Common RACH-Config-Common OPTIONAL, + rACH-Config-Common-IAB RACH-Config-Common-IAB OPTIONAL, + cSI-RS-Configuration OCTET STRING OPTIONAL, + sR-Configuration OCTET STRING OPTIONAL, + pDCCH-ConfigSIB1 OCTET STRING OPTIONAL, + sCS-Common OCTET STRING OPTIONAL, + multiplexingInfo MultiplexingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{Child-Node-Cells-List-Item-ExtIEs}} OPTIONAL +} + +Child-Node-Cells-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Child-Nodes-List ::= SEQUENCE (SIZE(1..maxnoofChildIABNodes)) OF Child-Nodes-List-Item + +Child-Nodes-List-Item ::= SEQUENCE{ + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID, + child-Node-Cells-List Child-Node-Cells-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{Child-Nodes-List-Item-ExtIEs}} OPTIONAL +} + +Child-Nodes-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CHOtrigger-InterDU ::= ENUMERATED { + cho-initiation, + cho-replace, + ... +} + +CHOtrigger-IntraDU ::= ENUMERATED { + cho-initiation, + cho-replace, + cho-cancel, + ... +} + +CNUEPagingIdentity ::= CHOICE { + fiveG-S-TMSI BIT STRING (SIZE(48)), + choice-extension ProtocolIE-SingleContainer { { CNUEPagingIdentity-ExtIEs } } +} + +CNUEPagingIdentity-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CompositeAvailableCapacityGroup ::= SEQUENCE { + compositeAvailableCapacityDownlink CompositeAvailableCapacity, + compositeAvailableCapacityUplink CompositeAvailableCapacity, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacityGroup-ExtIEs} } OPTIONAL +} + +CompositeAvailableCapacityGroup-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CompositeAvailableCapacity ::= SEQUENCE { + cellCapacityClassValue CellCapacityClassValue OPTIONAL, + capacityValue CapacityValue, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacity-ExtIEs} } OPTIONAL +} + +CompositeAvailableCapacity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ConditionalInterDUMobilityInformation ::= SEQUENCE { + cho-trigger CHOtrigger-InterDU, + targetgNB-DUUEF1APID GNB-DU-UE-F1AP-ID OPTIONAL + -- This IE shall be present if the cho-trigger IE is present and set to "cho-replace" --, + iE-Extensions ProtocolExtensionContainer { { ConditionalInterDUMobilityInformation-ExtIEs} } OPTIONAL, + ... +} + +ConditionalInterDUMobilityInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::={ + ... +} + +ConditionalIntraDUMobilityInformation ::= SEQUENCE { + cho-trigger CHOtrigger-IntraDU, + targetCellsTocancel TargetCellList OPTIONAL, + -- This IE may be present if the cho-trigger IE is present and set to "cho-cancel" + iE-Extensions ProtocolExtensionContainer { { ConditionalIntraDUMobilityInformation-ExtIEs} } OPTIONAL, + ... +} + +ConditionalIntraDUMobilityInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::={ + ... +} + +ConfiguredTACIndication ::= ENUMERATED { + true, + ... +} + + +CoordinateID ::= INTEGER (0..511, ...) + +CP-TransportLayerAddress ::= CHOICE { + endpoint-IP-address TransportLayerAddress, + endpoint-IP-address-and-port Endpoint-IP-address-and-port, + choice-extension ProtocolIE-SingleContainer { { CP-TransportLayerAddress-ExtIEs } } +} + +CP-TransportLayerAddress-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CPTrafficType ::= INTEGER (1..3,...) + +CriticalityDiagnostics ::= SEQUENCE { + procedureCode ProcedureCode OPTIONAL, + triggeringMessage TriggeringMessage OPTIONAL, + procedureCriticality Criticality OPTIONAL, + transactionID TransactionID OPTIONAL, + iEsCriticalityDiagnostics CriticalityDiagnostics-IE-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics-IE-List ::= SEQUENCE (SIZE (1.. maxnoofErrors)) OF CriticalityDiagnostics-IE-Item + +CriticalityDiagnostics-IE-Item ::= SEQUENCE { + iECriticality Criticality, + iE-ID ProtocolIE-ID, + typeOfError TypeOfError, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-IE-Item-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-IE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +C-RNTI ::= INTEGER (0..65535, ...) + +CUDURadioInformationType ::= CHOICE { + rIM CUDURIMInformation, + choice-extension ProtocolIE-SingleContainer { { CUDURadioInformationType-ExtIEs} } +} + +CUDURadioInformationType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CUDURIMInformation ::= SEQUENCE { + victimgNBSetID GNBSetID, + rIMRSDetectionStatus RIMRSDetectionStatus, + iE-Extensions ProtocolExtensionContainer { { CUDURIMInformation-ExtIEs} } OPTIONAL +} + +CUDURIMInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CUtoDURRCInformation ::= SEQUENCE { + cG-ConfigInfo CG-ConfigInfo OPTIONAL, + uE-CapabilityRAT-ContainerList UE-CapabilityRAT-ContainerList OPTIONAL, + measConfig MeasConfig OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CUtoDURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +CUtoDURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-HandoverPreparationInformation CRITICALITY ignore EXTENSION HandoverPreparationInformation PRESENCE optional }| + { ID id-CellGroupConfig CRITICALITY ignore EXTENSION CellGroupConfig PRESENCE optional }| + { ID id-MeasurementTimingConfiguration CRITICALITY ignore EXTENSION MeasurementTimingConfiguration PRESENCE optional }| + { ID id-UEAssistanceInformation CRITICALITY ignore EXTENSION UEAssistanceInformation PRESENCE optional }| + { ID id-CG-Config CRITICALITY ignore EXTENSION CG-Config PRESENCE optional }| + { ID id-UEAssistanceInformationEUTRA CRITICALITY ignore EXTENSION UEAssistanceInformationEUTRA PRESENCE optional }, + ... +} + +-- D + +DCBasedDuplicationConfigured::= ENUMERATED{true,..., false} + +Dedicated-SIDelivery-NeededUE-Item ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID, + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { DedicatedSIDeliveryNeededUE-Item-ExtIEs} } OPTIONAL, + ... +} + +DedicatedSIDeliveryNeededUE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION::={ + ... +} + + +DL-PRS ::= SEQUENCE { + prsid INTEGER (0..255), + dl-PRSResourceSetID PRS-Resource-Set-ID, + dl-PRSResourceID PRS-Resource-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {DL-PRS-ExtIEs} } OPTIONAL +} + +DL-PRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-PRSMutingPattern ::= CHOICE { + two BIT STRING (SIZE(2)), + four BIT STRING (SIZE(4)), + six BIT STRING (SIZE(6)), + eight BIT STRING (SIZE(8)), + sixteen BIT STRING (SIZE(16)), + thirty-two BIT STRING (SIZE(32)), + choice-extension ProtocolIE-SingleContainer { { DL-PRSMutingPattern-ExtIEs } } +} + +DL-PRSMutingPattern-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DLPRSResourceCoordinates ::= SEQUENCE { + listofDL-PRSResourceSetARP SEQUENCE (SIZE(1.. maxnoofPRS-ResourceSets)) OF DLPRSResourceSetARP, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceCoordinates-ExtIEs } } OPTIONAL +} + +DLPRSResourceCoordinates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DLPRSResourceSetARP ::= SEQUENCE { + dl-PRSResourceSetID INTEGER (0..7), + dL-PRSResourceSetARPLocation DL-PRSResourceSetARPLocation, + listofDL-PRSResourceARP SEQUENCE (SIZE(1.. maxnoofPRS-ResourcesPerSet)) OF DLPRSResourceARP, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceSetARP-ExtIEs } } OPTIONAL +} + +DLPRSResourceSetARP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DL-PRSResourceSetARPLocation ::= CHOICE { + relativeGeodeticLocation RelativeGeodeticLocation, + relativeCartesianLocation RelativeCartesianLocation, + choice-Extension ProtocolIE-SingleContainer { { DL-PRSResourceSetARPLocation-ExtIEs } } +} + +DL-PRSResourceSetARPLocation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +DLPRSResourceARP ::= SEQUENCE { + dl-PRSResourceID INTEGER (0..63), + dL-PRSResourceARPLocation DL-PRSResourceARPLocation, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceARP-ExtIEs } } OPTIONAL +} + +DLPRSResourceARP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-PRSResourceARPLocation ::= CHOICE { + relativeGeodeticLocation RelativeGeodeticLocation, + relativeCartesianLocation RelativeCartesianLocation, + choice-Extension ProtocolIE-SingleContainer { { DL-PRSResourceARPLocation-ExtIEs } } +} + +DL-PRSResourceARPLocation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DL-UP-TNL-Address-to-Update-List-Item ::= SEQUENCE { + oldIPAdress TransportLayerAddress, + newIPAdress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { DL-UP-TNL-Address-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +DL-UP-TNL-Address-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DLUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDLUPTNLInformation)) OF DLUPTNLInformation-ToBeSetup-Item + +DLUPTNLInformation-ToBeSetup-Item ::= SEQUENCE { + dLUPTNLInformation UPTransportLayerInformation , + iE-Extensions ProtocolExtensionContainer { { DLUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DLUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity-Item ::= SEQUENCE { + dRBID DRBID, + dRB-Activity DRB-Activity OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRB-Activity-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Activity-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity ::= ENUMERATED {active, not-active} + +DRBID ::= INTEGER (1..32, ...) + +DRBs-FailedToBeModified-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-FailedToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Information ::= SEQUENCE { + dRB-QoS QoSFlowLevelQoSParameters, + sNSSAI SNSSAI, + notificationControl NotificationControl OPTIONAL, + flows-Mapped-To-DRB-List Flows-Mapped-To-DRB-List, + iE-Extensions ProtocolExtensionContainer { { DRB-Information-ItemExtIEs } } OPTIONAL +} + +DRB-Information-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Modified-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List, + iE-Extensions ProtocolExtensionContainer { { DRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RLC-Status CRITICALITY ignore EXTENSION RLC-Status PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRBs-ModifiedConf-Item ::= SEQUENCE { + dRBID DRBID, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-ModifiedConf-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRB-Notify-Item ::= SEQUENCE { + dRBID DRBID, + notification-Cause Notification-Cause, + iE-Extensions ProtocolExtensionContainer { { DRB-Notify-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Notify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CurrentQoSParaSetIndex CRITICALITY ignore EXTENSION QoSParaSetNotifyIndex PRESENCE optional }, + ... +} + +DRBs-Required-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RLC-Status CRITICALITY ignore EXTENSION RLC-Status PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRBs-Required-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Setup-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, ... +} + +DRBs-SetupMod-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + + +DRBs-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation OPTIONAL, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + uLConfiguration ULConfiguration OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + {ID id-BearerTypeChange CRITICALITY ignore EXTENSION BearerTypeChange PRESENCE optional}| + { ID id-RLCMode CRITICALITY ignore EXTENSION RLCMode PRESENCE optional }| + { ID id-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, + ... +} + +DRBs-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE mandatory }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + + +DRBs-ToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List, + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, + ... +} + +DRXCycle ::= SEQUENCE { + longDRXCycleLength LongDRXCycleLength, + shortDRXCycleLength ShortDRXCycleLength OPTIONAL, + shortDRXCycleTimer ShortDRXCycleTimer OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRXCycle-ExtIEs} } OPTIONAL, + ... +} + +DRXCycle-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRX-Config ::= OCTET STRING + +DRXConfigurationIndicator ::= ENUMERATED{ release, ...} + +DRX-LongCycleStartOffset ::= INTEGER (0..10239) + +DSInformationList ::= SEQUENCE (SIZE(0..maxnoofDSInfo)) OF DSCP + +DSCP ::= BIT STRING (SIZE (6)) + +DUtoCURRCContainer ::= OCTET STRING + +DUCURadioInformationType ::= CHOICE { + rIM DUCURIMInformation, + choice-extension ProtocolIE-SingleContainer { { DUCURadioInformationType-ExtIEs} } +} + +DUCURadioInformationType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DUCURIMInformation ::= SEQUENCE { + victimgNBSetID GNBSetID, + rIMRSDetectionStatus RIMRSDetectionStatus, + aggressorCellList AggressorCellList, + iE-Extensions ProtocolExtensionContainer { { DUCURIMInformation-ExtIEs} } OPTIONAL +} + +DUCURIMInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DUF-Slot-Config-Item ::= CHOICE { + explicitFormat ExplicitFormat, + implicitFormat ImplicitFormat, + choice-extension ProtocolIE-SingleContainer { { DUF-Slot-Config-Item-ExtIEs} } +} + +DUF-Slot-Config-Item-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} +DUF-Slot-Config-List ::= SEQUENCE (SIZE(1..maxnoofDUFSlots)) OF DUF-Slot-Config-Item + +DUFSlotformatIndex ::= INTEGER(0..254) + +DUFTransmissionPeriodicity ::= ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10, ...} + +DU-RX-MT-RX ::= ENUMERATED {supported, not-supported} + +DU-TX-MT-TX ::= ENUMERATED {supported, not-supported} + +DU-RX-MT-TX ::= ENUMERATED {supported, not-supported} + +DU-TX-MT-RX ::= ENUMERATED {supported, not-supported} + +DUtoCURRCInformation ::= SEQUENCE { + cellGroupConfig CellGroupConfig, + measGapConfig MeasGapConfig OPTIONAL, + requestedP-MaxFR1 OCTET STRING OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DUtoCURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +DUtoCURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DRX-LongCycleStartOffset CRITICALITY ignore EXTENSION DRX-LongCycleStartOffset PRESENCE optional }| + { ID id-SelectedBandCombinationIndex CRITICALITY ignore EXTENSION SelectedBandCombinationIndex PRESENCE optional }| + { ID id-SelectedFeatureSetEntryIndex CRITICALITY ignore EXTENSION SelectedFeatureSetEntryIndex PRESENCE optional }| + { ID id-Ph-InfoSCG CRITICALITY ignore EXTENSION Ph-InfoSCG PRESENCE optional }| + { ID id-RequestedBandCombinationIndex CRITICALITY ignore EXTENSION RequestedBandCombinationIndex PRESENCE optional }| + { ID id-RequestedFeatureSetEntryIndex CRITICALITY ignore EXTENSION RequestedFeatureSetEntryIndex PRESENCE optional }| + { ID id-DRX-Config CRITICALITY ignore EXTENSION DRX-Config PRESENCE optional }| + { ID id-PDCCH-BlindDetectionSCG CRITICALITY ignore EXTENSION PDCCH-BlindDetectionSCG PRESENCE optional }| + { ID id-Requested-PDCCH-BlindDetectionSCG CRITICALITY ignore EXTENSION Requested-PDCCH-BlindDetectionSCG PRESENCE optional }| + { ID id-Ph-InfoMCG CRITICALITY ignore EXTENSION Ph-InfoMCG PRESENCE optional }| + { ID id-MeasGapSharingConfig CRITICALITY ignore EXTENSION MeasGapSharingConfig PRESENCE optional }| + { ID id-SL-PHY-MAC-RLC-Config CRITICALITY ignore EXTENSION SL-PHY-MAC-RLC-Config PRESENCE optional }| + { ID id-SL-ConfigDedicatedEUTRA CRITICALITY ignore EXTENSION SL-ConfigDedicatedEUTRA PRESENCE optional }| + { ID id-RequestedP-MaxFR2 CRITICALITY ignore EXTENSION RequestedP-MaxFR2 PRESENCE optional }, + ... +} + +DuplicationActivation ::= ENUMERATED{active,inactive,... } + +DuplicationIndication ::= ENUMERATED {true, ... , false } + +DuplicationState ::= ENUMERATED { + active, + inactive, + ... +} + +Dynamic5QIDescriptor ::= SEQUENCE { + qoSPriorityLevel INTEGER (1..127), + packetDelayBudget PacketDelayBudget, + packetErrorRate PacketErrorRate, + fiveQI INTEGER (0..255, ...) OPTIONAL, + delayCritical ENUMERATED {delay-critical, non-delay-critical} OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + averagingWindow AveragingWindow OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Dynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +Dynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ExtendedPacketDelayBudget CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetDownlink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetUplink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }, + ... +} + +DynamicPQIDescriptor ::= SEQUENCE { + resourceType ENUMERATED {gbr, non-gbr, delay-critical-grb, ...} OPTIONAL, + qoSPriorityLevel INTEGER (1..8, ...), + packetDelayBudget PacketDelayBudget, + packetErrorRate PacketErrorRate, + averagingWindow AveragingWindow OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DynamicPQIDescriptor-ExtIEs } } OPTIONAL +} + +DynamicPQIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- E + +E-CID-MeasurementPeriodicity ::= ENUMERATED { + ms120, + ms240, + ms480, + ms640, + ms1024, + ms2048, + ms5120, + ms10240, + min1, + min6, + min12, + min30, + min60, + ... +} + +E-CID-MeasurementQuantities ::= SEQUENCE (SIZE (1.. maxnoofMeasE-CID)) OF ProtocolIE-SingleContainer { {E-CID-MeasurementQuantities-ItemIEs} } + +E-CID-MeasurementQuantities-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-E-CID-MeasurementQuantities-Item CRITICALITY reject TYPE E-CID-MeasurementQuantities-Item PRESENCE mandatory} +} + +E-CID-MeasurementQuantities-Item ::= SEQUENCE { + e-CIDmeasurementQuantitiesValue E-CID-MeasurementQuantitiesValue, + iE-Extensions ProtocolExtensionContainer { { E-CID-MeasurementQuantitiesValue-ExtIEs} } OPTIONAL +} + +E-CID-MeasurementQuantitiesValue-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasurementQuantitiesValue ::= ENUMERATED { + cell-Portion, + angleOfArrivalNR, + ... +} + +E-CID-MeasurementResult ::= SEQUENCE { + geographicalCoordinates GeographicalCoordinates OPTIONAL, + measuredResults-List E-CID-MeasuredResults-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { E-CID-MeasurementResult-ExtIEs} } OPTIONAL +} + +E-CID-MeasurementResult-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasuredResults-List ::= SEQUENCE (SIZE(1..maxnoofMeasE-CID)) OF E-CID-MeasuredResults-Item + +E-CID-MeasuredResults-Item ::= SEQUENCE { + e-CID-MeasuredResults-Value E-CID-MeasuredResults-Value, + iE-Extensions ProtocolExtensionContainer {{ E-CID-MeasuredResults-Item-ExtIEs }} OPTIONAL +} + +E-CID-MeasuredResults-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasuredResults-Value ::= CHOICE { + valueAngleofArrivalNR UL-AoA, + choice-extension ProtocolIE-SingleContainer { { E-CID-MeasuredResults-Value-ExtIEs} } +} + +E-CID-MeasuredResults-Value-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +E-CID-ReportCharacteristics ::= ENUMERATED { + onDemand, + periodic, + ... +} + +EgressBHRLCCHList ::= SEQUENCE (SIZE(1..maxnoofEgressLinks)) OF EgressBHRLCCHItem + +EgressBHRLCCHItem ::= SEQUENCE { + nextHopBAPAddress BAPAddress, + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer {{EgressBHRLCCHItemExtIEs }} OPTIONAL +} + +EgressBHRLCCHItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Endpoint-IP-address-and-port ::=SEQUENCE { + endpointIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { Endpoint-IP-address-and-port-ExtIEs} } OPTIONAL +} + +Endpoint-IP-address-and-port-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-portNumber CRITICALITY reject EXTENSION PortNumber PRESENCE optional}, + ... +} + +ExtendedAvailablePLMN-List ::= SEQUENCE (SIZE(1..maxnoofExtendedBPLMNs)) OF ExtendedAvailablePLMN-Item + +ExtendedAvailablePLMN-Item ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { ExtendedAvailablePLMN-Item-ExtIEs} } OPTIONAL +} + +ExplicitFormat ::= SEQUENCE { + permutation Permutation, + noofDownlinkSymbols NoofDownlinkSymbols OPTIONAL, + noofUplinkSymbols NoofUplinkSymbols OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExplicitFormat-ExtIEs} } OPTIONAL +} + +ExplicitFormat-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExtendedAvailablePLMN-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExtendedServedPLMNs-List ::= SEQUENCE (SIZE(1.. maxnoofExtendedBPLMNs)) OF ExtendedServedPLMNs-Item + +ExtendedServedPLMNs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + tAISliceSupportList SliceSupportList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExtendedServedPLMNs-ItemExtIEs} } OPTIONAL, + ... +} + +ExtendedServedPLMNs-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-NPNSupportInfo CRITICALITY reject EXTENSION NPNSupportInfo PRESENCE optional }| +{ ID id-ExtendedTAISliceSupportList CRITICALITY reject EXTENSION ExtendedSliceSupportList PRESENCE optional }, + ... +} + +ExtendedSliceSupportList ::= SEQUENCE (SIZE(1.. maxnoofExtSliceItems)) OF SliceSupportItem + +EUTRACells-List ::= SEQUENCE (SIZE (1.. maxCellineNB)) OF EUTRACells-List-item + +EUTRACells-List-item ::= SEQUENCE { + eUTRA-Cell-ID EUTRA-Cell-ID, + served-EUTRA-Cells-Information Served-EUTRA-Cells-Information, + iE-Extensions ProtocolExtensionContainer { { EUTRACells-List-itemExtIEs } } OPTIONAL +} + +EUTRACells-List-itemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +EUTRA-Cell-ID ::= BIT STRING (SIZE(28)) + +EUTRA-Coex-FDD-Info ::= SEQUENCE { + uL-EARFCN ExtendedEARFCN OPTIONAL, + dL-EARFCN ExtendedEARFCN, + uL-Transmission-Bandwidth EUTRA-Transmission-Bandwidth OPTIONAL, + dL-Transmission-Bandwidth EUTRA-Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {EUTRA-Coex-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-Coex-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ULCarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }| + { ID id-DLCarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }, + ... +} + +EUTRA-Coex-Mode-Info ::= CHOICE { + fDD EUTRA-Coex-FDD-Info, + tDD EUTRA-Coex-TDD-Info, + ... +} + +EUTRA-Coex-TDD-Info ::= SEQUENCE { + eARFCN ExtendedEARFCN, + transmission-Bandwidth EUTRA-Transmission-Bandwidth, + subframeAssignment EUTRA-SubframeAssignment, + specialSubframe-Info EUTRA-SpecialSubframe-Info, + iE-Extensions ProtocolExtensionContainer { {EUTRA-Coex-TDD-Info-ExtIEs} } OPTIONAL, + ... +} +EUTRA-Coex-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +EUTRA-CyclicPrefixDL ::= ENUMERATED { + normal, + extended, + ... +} + +EUTRA-CyclicPrefixUL ::= ENUMERATED { + normal, + extended, + ... +} + +EUTRA-PRACH-Configuration ::= SEQUENCE { + rootSequenceIndex INTEGER (0..837), + zeroCorrelationIndex INTEGER (0..15), + highSpeedFlag BOOLEAN, + prach-FreqOffset INTEGER (0..94), + prach-ConfigIndex INTEGER (0..63) OPTIONAL, + -- C-ifTDD: This IE shall be present if the EUTRA-Mode-Info IE in the Resource Coordination E-UTRA Cell Information IE is set to the value "TDD" + iE-Extensions ProtocolExtensionContainer { {EUTRA-PRACH-Configuration-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-PRACH-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +EUTRA-SpecialSubframe-Info ::= SEQUENCE { + specialSubframePatterns EUTRA-SpecialSubframePatterns, + cyclicPrefixDL EUTRA-CyclicPrefixDL, + cyclicPrefixUL EUTRA-CyclicPrefixUL, + iE-Extensions ProtocolExtensionContainer { { EUTRA-SpecialSubframe-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-SpecialSubframe-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-SpecialSubframePatterns ::= ENUMERATED { + ssp0, + ssp1, + ssp2, + ssp3, + ssp4, + ssp5, + ssp6, + ssp7, + ssp8, + ssp9, + ssp10, + ... +} + +EUTRA-SubframeAssignment ::= ENUMERATED { + sa0, + sa1, + sa2, + sa3, + sa4, + sa5, + sa6, + ... +} + +EUTRA-Transmission-Bandwidth ::= ENUMERATED { + bw6, + bw15, + bw25, + bw50, + bw75, + bw100, + ... +} + +EUTRANQoS ::= SEQUENCE { + qCI QCI, + allocationAndRetentionPriority AllocationAndRetentionPriority, + gbrQosInformation GBR-QosInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { EUTRANQoS-ExtIEs} } OPTIONAL, + ... +} + +EUTRANQoS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExecuteDuplication ::= ENUMERATED{true,...} + +ExtendedEARFCN ::= INTEGER (0..262143) + +EUTRA-Mode-Info ::= CHOICE { + eUTRAFDD EUTRA-FDD-Info, + eUTRATDD EUTRA-TDD-Info, + choice-extension ProtocolIE-SingleContainer { { EUTRA-Mode-Info-ExtIEs} } +} + +EUTRA-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +EUTRA-NR-CellResourceCoordinationReq-Container ::= OCTET STRING + +EUTRA-NR-CellResourceCoordinationReqAck-Container ::= OCTET STRING + +EUTRA-FDD-Info ::= SEQUENCE { + uL-offsetToPointA OffsetToPointA, + dL-offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-TDD-Info ::= SEQUENCE { + offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EventType ::= ENUMERATED { + on-demand, + periodic, + stop, + ... +} + +ExtendedPacketDelayBudget ::= INTEGER (1..65535, ...) + +-- F + +FDD-Info ::= SEQUENCE { + uL-NRFreqInfo NRFreqInfo, + dL-NRFreqInfo NRFreqInfo, + uL-Transmission-Bandwidth Transmission-Bandwidth, + dL-Transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Flows-Mapped-To-DRB-List ::= SEQUENCE (SIZE(1.. maxnoofQoSFlows)) OF Flows-Mapped-To-DRB-Item + +Flows-Mapped-To-DRB-Item ::= SEQUENCE { + qoSFlowIdentifier QoSFlowIdentifier, + qoSFlowLevelQoSParameters QoSFlowLevelQoSParameters, + iE-Extensions ProtocolExtensionContainer { { Flows-Mapped-To-DRB-ItemExtIEs} } OPTIONAL +} + +Flows-Mapped-To-DRB-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-QoSFlowMappingIndication CRITICALITY ignore EXTENSION QoSFlowMappingIndication PRESENCE optional}| + {ID id-TSCTrafficCharacteristics CRITICALITY ignore EXTENSION TSCTrafficCharacteristics PRESENCE optional}, + ... +} + +FR1-Bandwidth ::= ENUMERATED {bw5, bw10, bw20, bw40, bw50, bw80, bw100, ...} + +FR2-Bandwidth ::= ENUMERATED {bw50, bw100, bw200, bw400, ...} + +FreqBandNrItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + supportedSULBandList SEQUENCE (SIZE(0..maxnoofNrCellBands)) OF SupportedSULFreqBandItem, + iE-Extensions ProtocolExtensionContainer { {FreqBandNrItem-ExtIEs} } OPTIONAL, + ... +} + +FreqBandNrItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +FreqDomainLength ::= CHOICE { + l839 L839Info, + l139 L139Info, + choice-extension ProtocolIE-SingleContainer { {FreqDomainLength-ExtIEs} } +} + +FreqDomainLength-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +FrequencyShift7p5khz ::= ENUMERATED {false, true, ...} + +FullConfiguration ::= ENUMERATED {full, ...} + +FlowsMappedToSLDRB-List ::= SEQUENCE (SIZE(1.. maxnoofPC5QoSFlows)) OF FlowsMappedToSLDRB-Item + +FlowsMappedToSLDRB-Item ::= SEQUENCE { + pc5QoSFlowIdentifier PC5QoSFlowIdentifier, + iE-Extensions ProtocolExtensionContainer { {FlowsMappedToSLDRB-Item-ExtIEs} } OPTIONAL, + ... +} + +FlowsMappedToSLDRB-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- G + + +GBR-QosInformation ::= SEQUENCE { + e-RAB-MaximumBitrateDL BitRate, + e-RAB-MaximumBitrateUL BitRate, + e-RAB-GuaranteedBitrateDL BitRate, + e-RAB-GuaranteedBitrateUL BitRate, + iE-Extensions ProtocolExtensionContainer { { GBR-QosInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GBR-QoSFlowInformation::= SEQUENCE { + maxFlowBitRateDownlink BitRate, + maxFlowBitRateUplink BitRate, + guaranteedFlowBitRateDownlink BitRate, + guaranteedFlowBitRateUplink BitRate, + maxPacketLossRateDownlink MaxPacketLossRate OPTIONAL, + maxPacketLossRateUplink MaxPacketLossRate OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GBR-QosFlowInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosFlowInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AlternativeQoSParaSetList CRITICALITY ignore EXTENSION AlternativeQoSParaSetList PRESENCE optional }, + ... +} + +CG-Config ::= OCTET STRING + +GeographicalCoordinates ::= SEQUENCE { + tRPPositionDefinitionType TRPPositionDefinitionType, + dLPRSResourceCoordinates DLPRSResourceCoordinates OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GeographicalCoordinates-ExtIEs } } OPTIONAL +} + +GeographicalCoordinates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNBCUMeasurementID ::= INTEGER (0.. 4095, ...) + +GNBDUMeasurementID ::= INTEGER (0.. 4095, ...) + +GNB-CUSystemInformation::= SEQUENCE { + sibtypetobeupdatedlist SEQUENCE (SIZE(1.. maxnoofSIBTypes)) OF SibtypetobeupdatedListItem, + iE-Extensions ProtocolExtensionContainer { { GNB-CUSystemInformation-ExtIEs} } OPTIONAL, + ... +} + +GNB-CUSystemInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-systemInformationAreaID CRITICALITY ignore EXTENSION SystemInformationAreaID PRESENCE optional}, + ... +} + +GNB-CU-TNL-Association-Setup-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + cause Cause, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +GNB-CU-TNL-Association-To-Add-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Add-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Add-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-To-Remove-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Remove-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-TNLAssociationTransportLayerAddressgNBDU CRITICALITY reject EXTENSION CP-TransportLayerAddress PRESENCE optional}, + ... +} + + +GNB-CU-TNL-Association-To-Update-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Update-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Update-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-Cell-Resource-Configuration ::= SEQUENCE { + subcarrierSpacing SubcarrierSpacing, + dUFTransmissionPeriodicity DUFTransmissionPeriodicity OPTIONAL, + dUF-Slot-Config-List DUF-Slot-Config-List OPTIONAL, + hSNATransmissionPeriodicity HSNATransmissionPeriodicity, + hNSASlotConfigList HSNASlotConfigList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Cell-Resource-Configuration-ExtIEs } } OPTIONAL +} + +GNB-DU-Cell-Resource-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-ID ::= INTEGER (0..68719476735) + +GNB-CU-Name ::= PrintableString(SIZE(1..150,...)) + +GNB-DU-Name ::= PrintableString(SIZE(1..150,...)) + +Extended-GNB-CU-Name ::= SEQUENCE { + gNB-CU-NameVisibleString GNB-CU-NameVisibleString OPTIONAL, + gNB-CU-NameUTF8String GNB-CU-NameUTF8String OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Extended-GNB-CU-Name-ExtIEs } } OPTIONAL, + ... +} + +Extended-GNB-CU-Name-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-NameVisibleString ::= VisibleString(SIZE(1..150,...)) + +GNB-CU-NameUTF8String ::= UTF8String(SIZE(1..150,...)) + +Extended-GNB-DU-Name ::= SEQUENCE { + gNB-DU-NameVisibleString GNB-DU-NameVisibleString OPTIONAL, + gNB-DU-NameUTF8String GNB-DU-NameUTF8String OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Extended-GNB-DU-Name-ExtIEs } } OPTIONAL, + ... +} + +Extended-GNB-DU-Name-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-NameVisibleString ::= VisibleString(SIZE(1..150,...)) + +GNB-DU-NameUTF8String ::= UTF8String(SIZE(1..150,...)) + + +GNB-DU-Served-Cells-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Served-Cells-ItemExtIEs} } OPTIONAL, + ... +} + +GNB-DU-Served-Cells-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-System-Information ::= SEQUENCE { + mIB-message MIB-message, + sIB1-message SIB1-message, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-System-Information-ExtIEs } } OPTIONAL, + ... +} + +GNB-DU-System-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-SIB12-message CRITICALITY ignore EXTENSION SIB12-message PRESENCE optional}| + { ID id-SIB13-message CRITICALITY ignore EXTENSION SIB13-message PRESENCE optional}| + { ID id-SIB14-message CRITICALITY ignore EXTENSION SIB14-message PRESENCE optional}| + { ID id-SIB10-message CRITICALITY ignore EXTENSION SIB10-message PRESENCE optional}, + ... +} + +GNB-DUConfigurationQuery ::= ENUMERATED {true, ...} + +GNBDUOverloadInformation ::= ENUMERATED {overloaded, not-overloaded} + +GNB-DU-TNL-Association-To-Remove-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationTransportLayerAddressgNBCU CP-TransportLayerAddress OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-TNL-Association-To-Remove-Item-ExtIEs} } OPTIONAL +} + +GNB-DU-TNL-Association-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-RxTxTimeDiff ::= SEQUENCE { + rxTxTimeDiff GNBRxTxTimeDiffMeas, + additionalPath-List AdditionalPath-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-RxTxTimeDiff-ExtIEs} } OPTIONAL +} + +GNB-RxTxTimeDiff-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + + ... +} + +GNBRxTxTimeDiffMeas ::= CHOICE { + k0 INTEGER (0.. 1970049), + k1 INTEGER (0.. 985025), + k2 INTEGER (0.. 492513), + k3 INTEGER (0.. 246257), + k4 INTEGER (0.. 123129), + k5 INTEGER (0.. 61565), + choice-extension ProtocolIE-SingleContainer { { GNBRxTxTimeDiffMeas-ExtIEs } } +} + +GNBRxTxTimeDiffMeas-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +GNBSetID ::= BIT STRING (SIZE(22)) + +GTP-TEID ::= OCTET STRING (SIZE (4)) + +GTPTLAs ::= SEQUENCE (SIZE(1.. maxnoofGTPTLAs)) OF GTPTLA-Item + + +GTPTLA-Item ::= SEQUENCE { + gTPTransportLayerAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { GTPTLA-Item-ExtIEs } } OPTIONAL +} + +GTPTLA-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GTPTunnel ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { GTPTunnel-ExtIEs } } OPTIONAL, + ... +} + +GTPTunnel-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- H + +HandoverPreparationInformation ::= OCTET STRING + +HardwareLoadIndicator ::= SEQUENCE { + dLHardwareLoadIndicator INTEGER (0..100, ...), + uLHardwareLoadIndicator INTEGER (0..100, ...), + iE-Extensions ProtocolExtensionContainer { { HardwareLoadIndicator-ExtIEs } } OPTIONAL, + ... +} + +HardwareLoadIndicator-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +HSNASlotConfigList ::= SEQUENCE (SIZE(1..maxnoofHSNASlots)) OF HSNASlotConfigItem + +HSNASlotConfigItem ::= SEQUENCE { + hSNADownlink HSNADownlink OPTIONAL, + hSNAUplink HSNAUplink OPTIONAL, + hSNAFlexible HSNAFlexible OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { HSNASlotConfigItem-ExtIEs } } OPTIONAL +} + +HSNASlotConfigItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +HSNADownlink ::= ENUMERATED { hard, soft, notavailable } + +HSNAFlexible ::= ENUMERATED { hard, soft, notavailable } + +HSNAUplink ::= ENUMERATED { hard, soft, notavailable } + +HSNATransmissionPeriodicity ::= ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10, ms20, ms40, ms80, ms160, ...} + +-- I + +IAB-Barred ::= ENUMERATED {barred, not-barred, ...} + +IAB-Info-IAB-donor-CU ::= SEQUENCE{ + iAB-STC-Info IAB-STC-Info OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Info-IAB-donor-CU-ExtIEs } } OPTIONAL +} + +IAB-Info-IAB-donor-CU-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-Info-IAB-DU ::= SEQUENCE{ + multiplexingInfo MultiplexingInfo OPTIONAL, + iAB-STC-Info IAB-STC-Info OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Info-IAB-DU-ExtIEs } } OPTIONAL +} + +IAB-Info-IAB-DU-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-MT-Cell-List ::= SEQUENCE (SIZE(1..maxnoofServingCells)) OF IAB-MT-Cell-List-Item + +IAB-MT-Cell-List-Item ::= SEQUENCE { + nRCellIdentity NRCellIdentity, + dU-RX-MT-RX DU-RX-MT-RX, + dU-TX-MT-TX DU-TX-MT-TX, + dU-RX-MT-TX DU-RX-MT-TX, + dU-TX-MT-RX DU-TX-MT-RX, + iE-Extensions ProtocolExtensionContainer { { IAB-MT-Cell-List-Item-ExtIEs } } OPTIONAL +} + +IAB-MT-Cell-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-STC-Info ::= SEQUENCE{ + iAB-STC-Info-List IAB-STC-Info-List, + iE-Extensions ProtocolExtensionContainer { { IAB-STC-Info-ExtIEs } } OPTIONAL +} + +IAB-STC-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-STC-Info-List ::= SEQUENCE (SIZE(1..maxnoofIABSTCInfo)) OF IAB-STC-Info-Item + +IAB-STC-Info-Item::= SEQUENCE { + sSB-freqInfo SSB-freqInfo, + sSB-subcarrierSpacing SSB-subcarrierSpacing, + sSB-transmissionPeriodicity SSB-transmissionPeriodicity, + sSB-transmissionTimingOffset SSB-transmissionTimingOffset, + sSB-transmissionBitmap SSB-transmissionBitmap, + iE-Extensions ProtocolExtensionContainer { { IAB-STC-Info-Item-ExtIEs } } OPTIONAL +} + +IAB-STC-Info-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-Allocated-TNL-Address-Item ::= SEQUENCE { + iABTNLAddress IABTNLAddress, + iABTNLAddressUsage IABTNLAddressUsage OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Allocated-TNL-Address-Item-ExtIEs } } OPTIONAL +} + +IAB-Allocated-TNL-Address-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-Mode-Info ::= CHOICE { + fDD IAB-DU-Cell-Resource-Configuration-FDD-Info, + tDD IAB-DU-Cell-Resource-Configuration-TDD-Info, + choice-extension ProtocolIE-SingleContainer { { IAB-DU-Cell-Resource-Configuration-Mode-Info-ExtIEs} } +} + +IAB-DU-Cell-Resource-Configuration-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-FDD-Info ::= SEQUENCE { + gNB-DU-Cell-Resource-Configuration-FDD-UL GNB-DU-Cell-Resource-Configuration, + gNB-DU-Cell-Resource-Configuration-FDD-DL GNB-DU-Cell-Resource-Configuration, + iE-Extensions ProtocolExtensionContainer { {IAB-DU-Cell-Resource-Configuration-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +IAB-DU-Cell-Resource-Configuration-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-TDD-Info ::= SEQUENCE { + gNB-DU-Cell-Resourc-Configuration-TDD GNB-DU-Cell-Resource-Configuration, + iE-Extensions ProtocolExtensionContainer { {IAB-DU-Cell-Resource-Configuration-TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +IAB-DU-Cell-Resource-Configuration-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IABIPv6RequestType ::= CHOICE { + iPv6Address IABTNLAddressesRequested, + iPv6Prefix IABTNLAddressesRequested, + choice-extension ProtocolIE-SingleContainer { { IABIPv6RequestType-ExtIEs} } +} + +IABIPv6RequestType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IABTNLAddress ::= CHOICE { + iPv4Address BIT STRING (SIZE(32)), + iPv6Address BIT STRING (SIZE(128)), + iPv6Prefix BIT STRING (SIZE(64)), + choice-extension ProtocolIE-SingleContainer { { IABTNLAddress-ExtIEs} } +} + +IABTNLAddress-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IABTNLAddressesRequested ::= SEQUENCE { + tNLAddressesOrPrefixesRequestedAllTraffic INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedF1-C INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedF1-U INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedNoNF1 INTEGER (1..256) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IABTNLAddressesRequested-ExtIEs } } OPTIONAL +} + +IABTNLAddressesRequested-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-TNL-Addresses-To-Remove-Item ::= SEQUENCE { + iABTNLAddress IABTNLAddress, + iE-Extensions ProtocolExtensionContainer { { IAB-TNL-Addresses-To-Remove-Item-ExtIEs} } OPTIONAL +} + +IAB-TNL-Addresses-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IABTNLAddressUsage ::= ENUMERATED { + f1-c, + f1-u, + non-f1, + ... +} + + +IABv4AddressesRequested ::= SEQUENCE { + iABv4AddressesRequested IABTNLAddressesRequested, + iE-Extensions ProtocolExtensionContainer { { IABv4AddressesRequested-ExtIEs} } OPTIONAL +} + +IABv4AddressesRequested-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ImplicitFormat ::= SEQUENCE { + dUFSlotformatIndex DUFSlotformatIndex, + iE-Extensions ProtocolExtensionContainer { { ImplicitFormat-ExtIEs } } OPTIONAL +} + +ImplicitFormat-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IgnorePRACHConfiguration::= ENUMERATED { true,...} + +IgnoreResourceCoordinationContainer ::= ENUMERATED { yes,...} +InactivityMonitoringRequest ::= ENUMERATED { true,...} +InactivityMonitoringResponse ::= ENUMERATED { not-supported,...} +InterfacesToTrace ::= BIT STRING (SIZE(8)) + +IntendedTDD-DL-ULConfig ::= SEQUENCE { + nRSCS ENUMERATED { scs15, scs30, scs60, scs120,...}, + nRCP ENUMERATED { normal, extended,...}, + nRDLULTxPeriodicity ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms3, ms4, ms5, ms10, ms20, ms40, ms60, ms80, ms100, ms120, ms140, ms160, ...}, + slot-Configuration-List Slot-Configuration-List, + iE-Extensions ProtocolExtensionContainer { {IntendedTDD-DL-ULConfig-ExtIEs} } OPTIONAL +} + +IntendedTDD-DL-ULConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IPHeaderInformation ::= SEQUENCE { + destinationIABTNLAddress IABTNLAddress, + dsInformationList DSInformationList OPTIONAL, + iPv6FlowLabel BIT STRING (SIZE (20)) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IPHeaderInformation-ItemExtIEs} } OPTIONAL, + ... +} + +IPHeaderInformation-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IPtolayer2TrafficMappingInfo ::= SEQUENCE { + iPtolayer2TrafficMappingInfoToAdd IPtolayer2TrafficMappingInfoList OPTIONAL, + iPtolayer2TrafficMappingInfoToRemove MappingInformationtoRemove OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IPtolayer2TrafficMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +IPtolayer2TrafficMappingInfoList ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF IPtolayer2TrafficMappingInfo-Item + +IPtolayer2TrafficMappingInfo-Item ::= SEQUENCE { + mappingInformationIndex MappingInformationIndex, + iPHeaderInformation IPHeaderInformation, + bHInfo BHInfo, iE-Extensions ProtocolExtensionContainer { { IPtolayer2TrafficMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +IPtolayer2TrafficMappingInfo-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- J + +-- K + +-- L + +L139Info ::= SEQUENCE { + msg1SCS ENUMERATED {scs15, scs30, scs60, scs120, ...}, + rootSequenceIndex INTEGER (0..137) OPTIONAL, + iE-Extension ProtocolExtensionContainer { {L139Info-ExtIEs} } OPTIONAL, + ... +} + +L139Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +L839Info ::= SEQUENCE { + rootSequenceIndex INTEGER (0..837), + restrictedSetConfig ENUMERATED {unrestrictedSet, restrictedSetTypeA, + restrictedSetTypeB, ...}, + iE-Extension ProtocolExtensionContainer { {L839Info-ExtIEs} } OPTIONAL, + ... +} + +L839Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LCID ::= INTEGER (1..32, ...) + + +LCStoGCSTranslationList ::= SEQUENCE (SIZE (1.. maxnooflcs-gcs-translation)) OF LCStoGCSTranslation + +LCStoGCSTranslation ::= SEQUENCE { + alpha INTEGER (0..359), + alpha-fine INTEGER (0..9), + beta INTEGER (0..359), + beta-fine INTEGER (0..9), + gamma INTEGER (0..359), + gamma-fine INTEGER (0..9), + iE-Extensions ProtocolExtensionContainer { {LCStoGCSTranslation-ExtIEs} } OPTIONAL +} + +LCStoGCSTranslation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LMF-MeasurementID ::= INTEGER (1.. 65536, ...) + +LMF-UE-MeasurementID ::= INTEGER (1.. 256, ...) + +LocationUncertainty ::= SEQUENCE { + horizontalUncertainty INTEGER (0..255), + horizontalConfidence INTEGER (0..100), + verticalUncertainty INTEGER (0..255), + verticalConfidence INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { LocationUncertainty-ExtIEs} } OPTIONAL +} + +LocationUncertainty-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LongDRXCycleLength ::= ENUMERATED +{ms10, ms20, ms32, ms40, ms60, ms64, ms70, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ms1024, ms1280, ms2048, ms2560, ms5120, ms10240, ...} + +LowerLayerPresenceStatusChange ::= ENUMERATED { + suspend-lower-layers, + resume-lower-layers, + ... + +} + +LTEUESidelinkAggregateMaximumBitrate ::= SEQUENCE { + uELTESidelinkAggregateMaximumBitrate BitRate, + iE-Extensions ProtocolExtensionContainer { {LTEUESidelinkAggregateMaximumBitrate-ExtIEs} } OPTIONAL +} + +LTEUESidelinkAggregateMaximumBitrate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LTEV2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, + pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {LTEV2XServicesAuthorized-ExtIEs} } OPTIONAL +} + +LTEV2XServicesAuthorized-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- M + +MappingInformationIndex ::= BIT STRING (SIZE (26)) + +MappingInformationtoRemove ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF MappingInformationIndex + +MaskedIMEISV ::= BIT STRING (SIZE (64)) + +MaxDataBurstVolume ::= INTEGER (0..4095, ..., 4096.. 2000000) +MaxPacketLossRate ::= INTEGER (0..1000) + +MIB-message ::= OCTET STRING + +MeasConfig ::= OCTET STRING + +MeasGapConfig ::= OCTET STRING + +MeasGapSharingConfig ::= OCTET STRING + +MeasurementBeamInfoRequest ::= ENUMERATED {true, ...} + +MeasurementBeamInfo ::= SEQUENCE { + pRS-Resource-ID PRS-Resource-ID OPTIONAL, + pRS-Resource-Set-ID PRS-Resource-Set-ID OPTIONAL, + sSB-Index SSB-Index OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { MeasurementBeamInfo-ExtIEs} } OPTIONAL +} + +MeasurementBeamInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +MeasurementTimingConfiguration ::= OCTET STRING + +MessageIdentifier ::= BIT STRING (SIZE (16)) + +MultiplexingInfo ::= SEQUENCE{ + iAB-MT-Cell-List IAB-MT-Cell-List, + iE-Extensions ProtocolExtensionContainer { {MultiplexingInfo-ExtIEs} } OPTIONAL +} + +MultiplexingInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M2Configuration ::= ENUMERATED {true, ...} + + +M5Configuration ::= SEQUENCE { + m5period M5period, + m5-links-to-log M5-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M5Configuration-ExtIEs} } OPTIONAL, + ... +} + +M5Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M5period ::= ENUMERATED { ms1024, ms2048, ms5120, ms10240, min1, ... } + +M5-Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + + +M6Configuration ::= SEQUENCE { + m6report-Interval M6report-Interval, + m6-links-to-log M6-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M6Configuration-ExtIEs} } OPTIONAL, + ... +} + +M6Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M6report-Interval ::= ENUMERATED { ms120, ms240, ms640, ms1024, ms2048, ms5120, ms10240, ms20480, ms40960, min1, min6, min12, min30, ... } + + + +M6-Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + + +M7Configuration ::= SEQUENCE { + m7period M7period, + m7-links-to-log M7-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M7Configuration-ExtIEs} } OPTIONAL, + ... +} + +M7Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M7period ::= INTEGER(1..60, ...) + +M7-Links-to-log ::= ENUMERATED {downlink, ...} + +MDT-Activation ::= ENUMERATED { + immediate-MDT-only, + immediate-MDT-and-Trace, + ... +} + +MDTConfiguration ::= SEQUENCE { + mdt-Activation MDT-Activation, + measurementsToActivate MeasurementsToActivate, + m2Configuration M2Configuration OPTIONAL, + -- C-ifM2: This IE shall be present if the Measurements to Activate IE has the second bit set to "1". + m5Configuration M5Configuration OPTIONAL, + -- C-ifM5: This IE shall be present if the Measurements to Activate IE has the fifth bit set to "1". + m6Configuration M6Configuration OPTIONAL, + -- C-ifM6: This IE shall be present if the Measurements to Activate IE has the seventh bit set to "1". + m7Configuration M7Configuration OPTIONAL, + -- C-ifM7: This IE shall be present if the Measurements to Activate IE has the eighth bit set to "1". + iE-Extensions ProtocolExtensionContainer { { MDTConfiguration-ExtIEs} } OPTIONAL, + ... +} +MDTConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +MDTPLMNList ::= SEQUENCE (SIZE(1..maxnoofMDTPLMNs)) OF PLMN-Identity + + +MeasuredResultsValue ::= CHOICE { + uL-AngleOfArrival UL-AoA, + uL-SRS-RSRP UL-SRS-RSRP, + uL-RTOA UL-RTOA-Measurement, + gNB-RxTxTimeDiff GNB-RxTxTimeDiff, + choice-extension ProtocolIE-SingleContainer { { MeasuredResultsValue-ExtIEs } } +} + +MeasuredResultsValue-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +MeasurementsToActivate ::= BIT STRING (SIZE (8)) + +-- N + +NeedforGap::= ENUMERATED {true, ...} + +Neighbour-Cell-Information-Item ::= SEQUENCE { + nRCGI NRCGI, + intendedTDD-DL-ULConfig IntendedTDD-DL-ULConfig OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Neighbour-Cell-Information-ItemExtIEs } } OPTIONAL +} + +Neighbour-Cell-Information-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NGRANAllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {NGRANAllocationAndRetentionPriority-ExtIEs} } OPTIONAL +} + +NGRANAllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +NGRANHighAccuracyAccessPointPosition ::= SEQUENCE { + latitude INTEGER (-2147483648.. 2147483647), + longitude INTEGER (-2147483648.. 2147483647), + altitude INTEGER (-64000..1280000), + uncertaintySemi-major INTEGER (0..255), + uncertaintySemi-minor INTEGER (0..255), + orientationOfMajorAxis INTEGER (0..179), + horizontalConfidence INTEGER (0..100), + uncertaintyAltitude INTEGER (0..255), + verticalConfidence INTEGER (0..100), + + iE-Extensions ProtocolExtensionContainer { { NGRANHighAccuracyAccessPointPosition-ExtIEs} } OPTIONAL +} + +NGRANHighAccuracyAccessPointPosition-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NID ::= BIT STRING (SIZE(44)) + +NR-CGI-List-For-Restart-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { NR-CGI-List-For-Restart-ItemExtIEs } } OPTIONAL, + ... +} + +NR-CGI-List-For-Restart-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-PRSBeamInformation ::= SEQUENCE { + nR-PRSBeamInformationList NR-PRSBeamInformationList, + lCStoGCSTranslationList LCStoGCSTranslationList, + iE-Extensions ProtocolExtensionContainer { { NR-PRSBeamInformation-ExtIEs } } OPTIONAL +} + +NR-PRSBeamInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-PRSBeamInformationList ::= SEQUENCE (SIZE(1.. maxnoofPRS-ResourceSets)) OF NR-PRSBeamInformationItem + +NR-PRSBeamInformationItem ::= SEQUENCE { + pRSResourceSetID INTEGER (0..7), + pRSAngleList PRSAngleList, + iE-Extensions ProtocolExtensionContainer { { NR-PRSBeamInformationItem-ExtIEs } } OPTIONAL +} + +NR-PRSBeamInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NonDynamic5QIDescriptor ::= SEQUENCE { + fiveQI INTEGER (0..255, ...), + qoSPriorityLevel INTEGER (1..127) OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NonDynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +NonDynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CNPacketDelayBudgetDownlink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetUplink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }, + ... +} + +NonDynamicPQIDescriptor ::= SEQUENCE { + fiveQI INTEGER (0..255, ...), + qoSPriorityLevel INTEGER (1..8, ...) OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NonDynamicPQIDescriptor-ExtIEs } } OPTIONAL +} + +NonDynamicPQIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NonUPTrafficType ::= ENUMERATED {ue-associated, non-ue-associated, non-f1, bap-control-pdu,...} + +NoofDownlinkSymbols ::= INTEGER (0..14) + +NoofUplinkSymbols ::= INTEGER (0..14) + +Notification-Cause ::= ENUMERATED {fulfilled, not-fulfilled, ...} + +NotificationControl ::= ENUMERATED {active, not-active, ...} + +NotificationInformation ::= SEQUENCE { + message-Identifier MessageIdentifier, + serialNumber SerialNumber, + iE-Extensions ProtocolExtensionContainer { { NotificationInformationExtIEs} } OPTIONAL, + ... +} + +NotificationInformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NPNBroadcastInformation ::= CHOICE { + sNPN-Broadcast-Information NPN-Broadcast-Information-SNPN, + pNI-NPN-Broadcast-Information NPN-Broadcast-Information-PNI-NPN, + choice-extension ProtocolIE-SingleContainer { {NPNBroadcastInformation-ExtIEs} } +} + +NPNBroadcastInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +NPN-Broadcast-Information-SNPN ::= SEQUENCE { + broadcastSNPNID-List BroadcastSNPN-ID-List, + iE-Extension ProtocolExtensionContainer { {NPN-Broadcast-Information-SNPN-ExtIEs} } OPTIONAL, + ... +} + +NPN-Broadcast-Information-SNPN-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +NPN-Broadcast-Information-PNI-NPN ::= SEQUENCE { + broadcastPNI-NPN-ID-Information BroadcastPNI-NPN-ID-List, + iE-Extension ProtocolExtensionContainer { {NPN-Broadcast-Information-PNI-NPN-ExtIEs} } OPTIONAL, + ... +} + +NPN-Broadcast-Information-PNI-NPN-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +NPNSupportInfo ::= CHOICE { + sNPN-Information NID, + choice-extension ProtocolIE-SingleContainer { { NPNSupportInfo-ExtIEs } } +} + +NPNSupportInfo-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +NRCarrierList ::= SEQUENCE (SIZE(1..maxnoofNRSCSs)) OF NRCarrierItem + +NRCarrierItem ::= SEQUENCE { + carrierSCS NRSCS, + offsetToCarrier INTEGER (0..2199, ...), + carrierBandwidth INTEGER (0..maxnoofPhysicalResourceBlocks, ...), + iE-Extension ProtocolExtensionContainer { {NRCarrierItem-ExtIEs} } OPTIONAL, + ... +} + +NRCarrierItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRFreqInfo ::= SEQUENCE { + nRARFCN INTEGER (0..maxNRARFCN), + sul-Information SUL-Information OPTIONAL, + freqBandListNr SEQUENCE (SIZE(1..maxnoofNrCellBands)) OF FreqBandNrItem, + iE-Extensions ProtocolExtensionContainer { { NRFreqInfoExtIEs} } OPTIONAL, + ... +} + +NRFreqInfoExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-FrequencyShift7p5khz CRITICALITY ignore EXTENSION FrequencyShift7p5khz PRESENCE optional }, + ... +} + +NRCGI ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + nRCellIdentity NRCellIdentity, + iE-Extensions ProtocolExtensionContainer { {NRCGI-ExtIEs} } OPTIONAL, + ... +} + +NRCGI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-Mode-Info ::= CHOICE { + fDD FDD-Info, + tDD TDD-Info, + choice-extension ProtocolIE-SingleContainer { { NR-Mode-Info-ExtIEs} } +} + +NR-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + + +NRPRACHConfig ::= SEQUENCE { + ulPRACHConfigList NRPRACHConfigList OPTIONAL, + sulPRACHConfigList NRPRACHConfigList OPTIONAL, + iE-Extension ProtocolExtensionContainer { {NRPRACHConfig-ExtIEs} } OPTIONAL, + ... +} + +NRPRACHConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRCellIdentity ::= BIT STRING (SIZE(36)) + +NRNRB ::= ENUMERATED { nrb11, nrb18, nrb24, nrb25, nrb31, nrb32, nrb38, nrb51, nrb52, nrb65, nrb66, nrb78, nrb79, nrb93, nrb106, nrb107, nrb121, nrb132, nrb133, nrb135, nrb160, nrb162, nrb189, nrb216, nrb217, nrb245, nrb264, nrb270, nrb273, ...} + +NRPCI ::= INTEGER(0..1007) + + +NRPRACHConfigList ::= SEQUENCE (SIZE(0..maxnoofPRACHconfigs)) OF NRPRACHConfigItem + +NRPRACHConfigItem ::= SEQUENCE { + nRSCS NRSCS, + prachFreqStartfromCarrier INTEGER (0..maxnoofPhysicalResourceBlocks-1, ...), + msg1FDM ENUMERATED {one, two, four, eight, ...}, + parchConfigIndex INTEGER (0..255, ...), + ssb-perRACH-Occasion ENUMERATED {oneEighth, oneFourth, oneHalf, one, + two, four, eight, sixteen, ...}, + freqDomainLength FreqDomainLength, + zeroCorrelZoneConfig INTEGER (0..15), + iE-Extension ProtocolExtensionContainer { { NRPRACHConfigItem-ExtIEs} } OPTIONAL, + ... +} + +NRPRACHConfigItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRSCS ::= ENUMERATED { scs15, scs30, scs60, scs120, ...} + +NRUERLFReportContainer ::= OCTET STRING + +NumberofActiveUEs ::= INTEGER(0..16777215, ...) + +NumberOfBroadcasts ::= INTEGER (0..65535) + +NumberofBroadcastRequest ::= INTEGER (0..65535) + +NumDLULSymbols ::= SEQUENCE { + numDLSymbols INTEGER (0..13, ...), + numULSymbols INTEGER (0..13, ...), + iE-Extensions ProtocolExtensionContainer { { NumDLULSymbols-ExtIEs} } OPTIONAL +} + +NumDLULSymbols-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRV2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, + pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {NRV2XServicesAuthorized-ExtIEs} } OPTIONAL +} + +NRV2XServicesAuthorized-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRUESidelinkAggregateMaximumBitrate ::= SEQUENCE { + uENRSidelinkAggregateMaximumBitrate BitRate, + iE-Extensions ProtocolExtensionContainer { {NRUESidelinkAggregateMaximumBitrate-ExtIEs} } OPTIONAL +} + +NRUESidelinkAggregateMaximumBitrate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NZP-CSI-RS-ResourceID::= INTEGER (0..191, ...) + + +-- O + +OffsetToPointA ::= INTEGER (0..2199,...) + + +-- P + +PacketDelayBudget ::= INTEGER (0..1023, ...) + +PacketErrorRate ::= SEQUENCE { + pER-Scalar PER-Scalar, + pER-Exponent PER-Exponent, + iE-Extensions ProtocolExtensionContainer { {PacketErrorRate-ExtIEs} } OPTIONAL, + ... +} + +PacketErrorRate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PER-Scalar ::= INTEGER (0..9, ...) +PER-Exponent ::= INTEGER (0..9, ...) + +PagingCell-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { PagingCell-ItemExtIEs } } OPTIONAL +} + +PagingCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PagingDRX ::= ENUMERATED { + v32, + v64, + v128, + v256, + ... +} + +PagingIdentity ::= CHOICE { + rANUEPagingIdentity RANUEPagingIdentity, + cNUEPagingIdentity CNUEPagingIdentity, + choice-extension ProtocolIE-SingleContainer { { PagingIdentity-ExtIEs } } +} + +PagingIdentity-ExtIEs F1AP-PROTOCOL-IES::= { + ... +} + +PagingOrigin ::= ENUMERATED { non-3gpp, ...} + +PagingPriority ::= ENUMERATED { priolevel1, priolevel2, priolevel3, priolevel4, priolevel5, priolevel6, priolevel7, priolevel8,...} + + +RelativePathDelay ::= CHOICE { + k0 INTEGER (0..16351,...), + k1 INTEGER (0..8176,...), + k2 INTEGER (0..4088,...), + k3 INTEGER (0..2044,...), + k4 INTEGER (0..1022,...), + k5 INTEGER (0..511,...), + choice-extension ProtocolIE-SingleContainer { { RelativePathDelay-ExtIEs } } +} + +RelativePathDelay-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PathlossReferenceInfo ::= SEQUENCE { + pathlossReferenceSignal PathlossReferenceSignal, + iE-Extensions ProtocolExtensionContainer { {PathlossReferenceInfo-ExtIEs} } OPTIONAL +} + +PathlossReferenceInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PathlossReferenceSignal ::= CHOICE { + sSB SSB, + dL-PRS DL-PRS, + choice-extension ProtocolIE-SingleContainer {{PathlossReferenceSignal-ExtIEs }} +} + +PathlossReferenceSignal-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PC5QoSFlowIdentifier ::= INTEGER (1..2048) + +PC5-QoS-Characteristics ::= CHOICE { + non-Dynamic-PQI NonDynamicPQIDescriptor, + dynamic-PQI DynamicPQIDescriptor, + choice-extension ProtocolIE-SingleContainer { { PC5-QoS-Characteristics-ExtIEs } } +} + +PC5-QoS-Characteristics-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +PC5QoSParameters ::= SEQUENCE { + pC5-QoS-Characteristics PC5-QoS-Characteristics, + pC5-QoS-Flow-Bit-Rates PC5FlowBitRates OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PC5QoSParameters-ExtIEs } } OPTIONAL, + ... +} + +PC5QoSParameters-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PC5FlowBitRates ::= SEQUENCE { + guaranteedFlowBitRate BitRate, + maximumFlowBitRate BitRate, + iE-Extensions ProtocolExtensionContainer { { PC5FlowBitRates-ExtIEs } } OPTIONAL, + ... +} + +PC5FlowBitRates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PDCCH-BlindDetectionSCG ::= OCTET STRING + +PDCP-SN ::= INTEGER (0..4095) + +PDCPSNLength ::= ENUMERATED { twelve-bits,eighteen-bits,...} + +PDUSessionID ::= INTEGER (0..255) + +ReportingPeriodicityValue ::= INTEGER (0..512, ...) + +Periodicity ::= INTEGER (0..640000, ...) + +PeriodicitySRS ::= ENUMERATED { ms0p125, ms0p25, ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms4, ms5, ms8, ms10, ms16, ms20, ms32, ms40, ms64, ms80, ms160, ms320, ms640, ms1280, ms2560, ms5120, ms10240, ...} + +PeriodicityList ::= SEQUENCE (SIZE(1.. maxnoSRS-ResourcePerSet)) OF PeriodicityList-Item + +PeriodicityList-Item ::= SEQUENCE { + periodicitySRS PeriodicitySRS, + iE-Extensions ProtocolExtensionContainer { { PeriodicityList-ItemExtIEs} } OPTIONAL +} + +PeriodicityList-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Permutation ::= ENUMERATED {dfu, ufd, ...} + +Ph-InfoMCG ::= OCTET STRING + +Ph-InfoSCG ::= OCTET STRING + +PLMN-Identity ::= OCTET STRING (SIZE(3)) + +PortNumber ::= BIT STRING (SIZE (16)) + + +PosAssistance-Information ::= OCTET STRING + +PosAssistanceInformationFailureList ::= OCTET STRING + +PosBroadcast ::= ENUMERATED { + start, + stop, + ... +} + +PositioningBroadcastCells ::= SEQUENCE (SIZE (1..maxnoBcastCell)) OF NRCGI + +PosMeasurementPeriodicity ::= ENUMERATED +{ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, min1, min6, min12, min30, min60, ...} + + +PosMeasurementQuantities ::= SEQUENCE (SIZE(1.. maxnoofPosMeas)) OF PosMeasurementQuantities-Item + +PosMeasurementQuantities-Item ::= SEQUENCE { + posMeasurementType PosMeasurementType, + timingReportingGranularityFactor INTEGER (0..5) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementQuantities-ItemExtIEs} } OPTIONAL +} + +PosMeasurementQuantities-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementResult ::= SEQUENCE (SIZE (1.. maxnoofPosMeas)) OF PosMeasurementResultItem + +PosMeasurementResultItem ::= SEQUENCE { + measuredResultsValue MeasuredResultsValue, + timeStamp TimeStamp, + measurementQuality TRPMeasurementQuality OPTIONAL, + measurementBeamInfo MeasurementBeamInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementResultItemExtIEs } } OPTIONAL +} + +PosMeasurementResultItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementResultList ::= SEQUENCE (SIZE(1.. maxNoOfMeasTRPs)) OF PosMeasurementResultList-Item + +PosMeasurementResultList-Item ::= SEQUENCE { + posMeasurementResult PosMeasurementResult, + tRPID TRPID, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementResultList-ItemExtIEs} } OPTIONAL +} + +PosMeasurementResultList-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementType ::= ENUMERATED { + gnb-rx-tx, + ul-srs-rsrp, + ul-aoa, + ul-rtoa, + ... +} + +PosReportCharacteristics ::= ENUMERATED { + ondemand, + periodic, + ... +} + +PosResourceSetType ::= CHOICE { + periodic PosResourceSetTypePR, + semi-persistent PosResourceSetTypeSP, + aperiodic PosResourceSetTypeAP, + choice-extension ProtocolIE-SingleContainer {{ PosResourceSetType-ExtIEs }} +} + +PosResourceSetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PosResourceSetTypePR ::= SEQUENCE { + posperiodicSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypePR-ExtIEs} } OPTIONAL +} + +PosResourceSetTypePR-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosResourceSetTypeSP ::= SEQUENCE { + possemi-persistentSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypeSP-ExtIEs} } OPTIONAL +} + +PosResourceSetTypeSP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosResourceSetTypeAP ::= SEQUENCE { + sRSResourceTrigger-List INTEGER(1..3), + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypeAP-ExtIEs} } OPTIONAL +} + +PosResourceSetTypeAP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResourceID-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResourcePerSet)) OF SRSPosResourceID + +PosSRSResource-Item ::= SEQUENCE { + srs-PosResourceId SRSPosResourceID, + transmissionCombPos TransmissionCombPos, + startPosition INTEGER (0..13), + nrofSymbols ENUMERATED {n1, n2, n4, n8, n12}, + freqDomainShift INTEGER (0..268), + c-SRS INTEGER (0..63), + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + resourceTypePos ResourceTypePos, + sequenceId INTEGER (0.. 65535), + spatialRelationPos SpatialRelationPos OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosSRSResource-Item-ExtIEs} } OPTIONAL +} + +PosSRSResource-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResource-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResources)) OF PosSRSResource-Item + +PosSRSResourceSet-Item ::= SEQUENCE { + possrsResourceSetID INTEGER(0..15), + possRSResourceID-List PosSRSResourceID-List, + posresourceSetType PosResourceSetType, + iE-Extensions ProtocolExtensionContainer { { PosSRSResourceSet-Item-ExtIEs} } OPTIONAL +} + +PosSRSResourceSet-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResourceSet-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResourceSets)) OF PosSRSResourceSet-Item + +PrimaryPathIndication ::= ENUMERATED { + true, + false, + ... +} + +Pre-emptionCapability ::= ENUMERATED { + shall-not-trigger-pre-emption, + may-trigger-pre-emption +} + +Pre-emptionVulnerability ::= ENUMERATED { + not-pre-emptable, + pre-emptable +} + +PriorityLevel ::= INTEGER { spare (0), highest (1), lowest (14), no-priority (15) } (0..15) + +ProtectedEUTRAResourceIndication ::= OCTET STRING + +Protected-EUTRA-Resources-Item ::= SEQUENCE { + spectrumSharingGroupID SpectrumSharingGroupID, + eUTRACells-List EUTRACells-List, + iE-Extensions ProtocolExtensionContainer { { Protected-EUTRA-Resources-ItemExtIEs } } OPTIONAL +} + +Protected-EUTRA-Resources-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSConfiguration ::= SEQUENCE { + pRSResourceSet-List PRSResourceSet-List, + iE-Extensions ProtocolExtensionContainer { { PRSConfiguration-ExtIEs } } OPTIONAL +} + +PRSConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSInformationPos ::= SEQUENCE { + pRS-IDPos INTEGER(0..255) OPTIONAL, + pRS-Resource-Set-IDPos INTEGER(0..7), + pRS-Resource-IDPos INTEGER(0..63), + iE-Extensions ProtocolExtensionContainer { { PRSInformationPos-ExtIEs} } OPTIONAL +} + +PRSInformationPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Potential-SpCell-Item ::= SEQUENCE { + potential-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Potential-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Potential-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +PRSAngleList ::= SEQUENCE (SIZE(1.. maxnoofPRS-ResourcesPerSet)) OF PRSAngleItem + +PRSAngleItem ::= SEQUENCE { + nR-PRS-Azimuth INTEGER (0..359), + nR-PRS-Azimuth-fine INTEGER (0..9), + nR-PRS-Elevation INTEGER (0..180), + nR-PRS-Elevation-fine INTEGER (0..9), + iE-Extensions ProtocolExtensionContainer { { PRSAngleItem-ItemExtIEs } } OPTIONAL +} + +PRSAngleItem-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMuting::= SEQUENCE { + pRSMutingOption1 PRSMutingOption1, + pRSMutingOption2 PRSMutingOption2, + iE-Extensions ProtocolExtensionContainer { { PRSMuting-ExtIEs} } OPTIONAL +} + +PRSMuting-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMutingOption1 ::= SEQUENCE { + mutingPattern DL-PRSMutingPattern, + mutingBitRepetitionFactor ENUMERATED{rf1,rf2,rf4,rf8,...}, + iE-Extensions ProtocolExtensionContainer { { PRSMutingOption1-ExtIEs} } OPTIONAL +} + +PRSMutingOption1-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMutingOption2 ::= SEQUENCE { + mutingPattern DL-PRSMutingPattern, + iE-Extensions ProtocolExtensionContainer { { PRSMutingOption2-ExtIEs} } OPTIONAL +} + +PRSMutingOption2-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRS-Resource-ID ::= INTEGER (0..63) + +PRSResource-List::= SEQUENCE (SIZE (1..maxnoofPRSresources)) OF PRSResource-Item + +PRSResource-Item ::= SEQUENCE { + pRSResourceID INTEGER(0..63), + sequenceID INTEGER(0..4095,...), + rEOffset INTEGER(0..11), + resourceSlotOffset INTEGER(0..511,...), + resourceSymbolOffset INTEGER(0..12,...), + qCLInfo PRSResource-QCLInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-Item-ExtIEs} } OPTIONAL +} + +PRSResource-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSResource-QCLInfo ::= SEQUENCE { + qCLSourceSSBIndex INTEGER(0..63) OPTIONAL, + qCLSourcePRSInfo PRSResource-QCLSourcePRSInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-QCLInfo-ExtIEs} } OPTIONAL, + ... +} +PRSResource-QCLInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSResource-QCLSourcePRSInfo ::= SEQUENCE { + qCLSourcePRSResourceSetID INTEGER(0..7), + qCLSourcePRSResourceID INTEGER(0..63) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-QCLSourcePRSInfo-ExtIEs} } OPTIONAL +} + +PRSResource-QCLSourcePRSInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRS-Resource-Set-ID ::= INTEGER(0..7) + +PRSResourceSet-List ::= SEQUENCE (SIZE (1.. maxnoofPRSresourceSets)) OF PRSResourceSet-Item +PRSResourceSet-Item ::= SEQUENCE { + pRSResourceSetID PRS-Resource-Set-ID, + subcarrierSpacing ENUMERATED{kHz15, kHz30, kHz60, kHz120, ...}, + pRSbandwidth INTEGER(1..63), + startPRB INTEGER(0..2176), + pointA INTEGER (0..3279165), + combSize ENUMERATED{n2, n4, n6, n12, ...}, + cPType ENUMERATED{normal, extended, ...}, + resourceSetPeriodicity ENUMERATED{n4,n5,n8,n10,n16,n20,n32,n40,n64,n80,n160,n320,n640,n1280,n2560,n5120,n10240,n20480,n40960, n81920,...}, + resourceSetSlotOffset INTEGER(0..81919,...), + resourceRepetitionFactor ENUMERATED{rf1,rf2,rf4,rf6,rf8,rf16,rf32,...}, + resourceTimeGap ENUMERATED{tg1,tg2,tg4,tg8,tg16,tg32,...}, + resourceNumberofSymbols ENUMERATED{n2,n4,n6,n12,...}, + pRSMuting PRSMuting OPTIONAL, + pRSResourceTransmitPower INTEGER(-60..50), + pRSResource-List PRSResource-List, + iE-Extensions ProtocolExtensionContainer { { PRSResourceSet-Item-ExtIEs} } OPTIONAL +} + +PRSResourceSet-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWS-Failed-NR-CGI-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { PWS-Failed-NR-CGI-ItemExtIEs } } OPTIONAL, + ... +} + +PWS-Failed-NR-CGI-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWSSystemInformation ::= SEQUENCE { + sIBtype SIBType-PWS, + sIBmessage OCTET STRING, + iE-Extensions ProtocolExtensionContainer { { PWSSystemInformationExtIEs } } OPTIONAL, + ... +} + +PWSSystemInformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-NotificationInformation CRITICALITY ignore EXTENSION NotificationInformation PRESENCE optional}| + { ID id-AdditionalSIBMessageList CRITICALITY reject EXTENSION AdditionalSIBMessageList PRESENCE optional}, + ... +} + +PrivacyIndicator ::= ENUMERATED {immediate-MDT, logged-MDT, ...} + +-- Q + +QCI ::= INTEGER (0..255) + +QoS-Characteristics ::= CHOICE { + non-Dynamic-5QI NonDynamic5QIDescriptor, + dynamic-5QI Dynamic5QIDescriptor, + choice-extension ProtocolIE-SingleContainer { { QoS-Characteristics-ExtIEs } } +} + +QoS-Characteristics-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +QoSFlowIdentifier ::= INTEGER (0..63) + +QoSFlowLevelQoSParameters ::= SEQUENCE { + qoS-Characteristics QoS-Characteristics, + nGRANallocationRetentionPriority NGRANAllocationAndRetentionPriority, + gBR-QoS-Flow-Information GBR-QoSFlowInformation OPTIONAL, + reflective-QoS-Attribute ENUMERATED {subject-to, ...} OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { QoSFlowLevelQoSParameters-ExtIEs } } OPTIONAL +} + +QoSFlowLevelQoSParameters-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-PDUSessionID CRITICALITY ignore EXTENSION PDUSessionID PRESENCE optional}| + { ID id-ULPDUSessionAggregateMaximumBitRate CRITICALITY ignore EXTENSION BitRate PRESENCE optional}| + { ID id-QosMonitoringRequest CRITICALITY ignore EXTENSION QosMonitoringRequest PRESENCE optional}, + ... +} + +QoSFlowMappingIndication ::= ENUMERATED {ul,dl,...} + +QoSInformation ::= CHOICE { + eUTRANQoS EUTRANQoS, + choice-extension ProtocolIE-SingleContainer { { QoSInformation-ExtIEs} } +} + +QoSInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Information CRITICALITY ignore TYPE DRB-Information PRESENCE mandatory}, + ... +} + +QosMonitoringRequest ::= ENUMERATED {ul, dl, both, ...} + +QoSParaSetIndex ::= INTEGER (1..8, ...) + +QoSParaSetNotifyIndex ::= INTEGER (0..8, ...) + +-- R + +RACH-Config-Common ::= OCTET STRING + +RACH-Config-Common-IAB ::= OCTET STRING + +RACHReportContainer::= OCTET STRING + +RACHReportInformationList ::= SEQUENCE (SIZE(1.. maxnoofRACHReports)) OF RACHReportInformationItem + +RACHReportInformationItem ::= SEQUENCE { + rACHReportContainer RACHReportContainer, + uEAssitantIdentifier GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RACHReportInformationItem-ExtIEs} } OPTIONAL, + ... +} + +RACHReportInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + + +RadioResourceStatus ::= SEQUENCE { + sSBAreaRadioResourceStatusList SSBAreaRadioResourceStatusList, + iE-Extensions ProtocolExtensionContainer { { RadioResourceStatus-ExtIEs} } OPTIONAL +} + +RadioResourceStatus-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RANAC ::= INTEGER (0..255) + +RAN-MeasurementID ::= INTEGER (1.. 65536, ...) + +RAN-UE-MeasurementID ::= INTEGER (1.. 256, ...) + +RANUEID ::= OCTET STRING (SIZE (8)) + +RANUEPagingIdentity ::= SEQUENCE { + iRNTI BIT STRING (SIZE(40)), + iE-Extensions ProtocolExtensionContainer { { RANUEPagingIdentity-ExtIEs } } OPTIONAL} + +RANUEPagingIdentity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RAT-FrequencyPriorityInformation::= CHOICE { + eNDC SubscriberProfileIDforRFP, + nGRAN RAT-FrequencySelectionPriority, + choice-extension ProtocolIE-SingleContainer { { RAT-FrequencyPriorityInformation-ExtIEs} } +} + +RAT-FrequencyPriorityInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +RAT-FrequencySelectionPriority::= INTEGER (1.. 256, ...) + +Reestablishment-Indication ::= ENUMERATED { + reestablished, + ... +} + +ReferencePoint ::= CHOICE { + coordinateID CoordinateID, + referencePointCoordinate AccessPointPosition, + referencePointCoordinateHA NGRANHighAccuracyAccessPointPosition, + choice-Extension ProtocolIE-SingleContainer { { ReferencePoint-ExtIEs} } +} + +ReferencePoint-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ReferenceSFN ::= INTEGER (0..1023) + +ReferenceSignal ::= CHOICE { + nZP-CSI-RS NZP-CSI-RS-ResourceID, + sSB SSB, + sRS SRSResourceID, + positioningSRS SRSPosResourceID, + dL-PRS DL-PRS, + choice-extension ProtocolIE-SingleContainer {{ReferenceSignal-ExtIEs }} +} + +ReferenceSignal-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +RelativeCartesianLocation ::= SEQUENCE { + xYZunit ENUMERATED {mm, cm, dm, ...}, + xvalue INTEGER (-65536..65535), + yvalue INTEGER (-65536..65535), + zvalue INTEGER (-32768..32767), + locationUncertainty LocationUncertainty, + iE-Extensions ProtocolExtensionContainer { { RelativeCartesianLocation-ExtIEs} } OPTIONAL +} + +RelativeCartesianLocation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RelativeGeodeticLocation ::= SEQUENCE { + milli-Arc-SecondUnits ENUMERATED {zerodot03, zerodot3, three, ...}, + heightUnits ENUMERATED {mm, cm, m, ...}, + deltaLatitude INTEGER (-1024.. 1023), + deltaLongitude INTEGER (-1024.. 1023), + deltaHeight INTEGER (-1024.. 1023), + locationUncertainty LocationUncertainty, + iE-extensions ProtocolExtensionContainer {{RelativeGeodeticLocation-ExtIEs }} OPTIONAL +} + +RelativeGeodeticLocation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ReferenceTime ::= OCTET STRING + +RegistrationRequest ::= ENUMERATED{start, stop, add, ...} + +ReportCharacteristics ::= BIT STRING (SIZE(32)) + +ReportingPeriodicity ::= ENUMERATED{ms500, ms1000, ms2000, ms5000, ms10000, ...} + +RequestedBandCombinationIndex ::= OCTET STRING + +RequestedFeatureSetEntryIndex ::= OCTET STRING + +RequestedP-MaxFR2 ::= OCTET STRING + +Requested-PDCCH-BlindDetectionSCG ::= OCTET STRING + + +RequestedSRSTransmissionCharacteristics ::= SEQUENCE { + numberOfTransmissions INTEGER (0..500, ...) OPTIONAL, + resourceType ENUMERATED {periodic, semi-persistent, aperiodic,...}, + bandwidthSRS BandwidthSRS, + sRSResourceSetList SRSResourceSetList OPTIONAL, + sSBInformation SSBInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RequestedSRSTransmissionCharacteristics-ExtIEs} } OPTIONAL +} + +RequestedSRSTransmissionCharacteristics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RequestType ::= ENUMERATED {offer, execution, ...} + +ResourceCoordinationEUTRACellInfo ::= SEQUENCE { + eUTRA-Mode-Info EUTRA-Coex-Mode-Info, + eUTRA-PRACH-Configuration EUTRA-PRACH-Configuration, + iE-Extensions ProtocolExtensionContainer { { ResourceCoordinationEUTRACellInfo-ExtIEs } } OPTIONAL, + ... +} + +ResourceCoordinationEUTRACellInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-IgnorePRACHConfiguration CRITICALITY reject EXTENSION IgnorePRACHConfiguration PRESENCE optional }, + ... +} + +ResourceCoordinationTransferInformation ::= SEQUENCE { + meNB-Cell-ID EUTRA-Cell-ID, + resourceCoordinationEUTRACellInfo ResourceCoordinationEUTRACellInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ResourceCoordinationTransferInformation-ExtIEs } } OPTIONAL, + ... +} + +ResourceCoordinationTransferInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceCoordinationTransferContainer ::= OCTET STRING + +ResourceSetType ::= CHOICE { + periodic ResourceSetTypePeriodic, + semi-persistent ResourceSetTypeSemi-persistent, + aperiodic ResourceSetTypeAperiodic, + choice-extension ProtocolIE-SingleContainer {{ ResourceSetType-ExtIEs }} +} + +ResourceSetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceSetTypePeriodic ::= SEQUENCE { + periodicSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypePeriodic-ExtIEs} } OPTIONAL +} + +ResourceSetTypePeriodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceSetTypeSemi-persistent ::= SEQUENCE { + semi-persistentSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypeSemi-persistent-ExtIEs} } OPTIONAL +} + +ResourceSetTypeSemi-persistent-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceSetTypeAperiodic ::= SEQUENCE { + sRSResourceTrigger-List INTEGER(1..3), + slotoffset INTEGER(1..32), + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypeAperiodic-ExtIEs} } OPTIONAL +} + +ResourceSetTypeAperiodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RepetitionPeriod ::= INTEGER (0..131071, ...) + +ReportingRequestType ::= SEQUENCE { + eventType EventType, + reportingPeriodicityValue ReportingPeriodicityValue OPTIONAL, + -- C-ifEventTypeisPeriodic: This IE shall be present if the Event Type IE is set to "periodic" in the Event Type IE. + iE-Extensions ProtocolExtensionContainer { {ReportingRequestType-ExtIEs} } OPTIONAL +} + +ReportingRequestType-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceType ::= CHOICE { + periodic ResourceTypePeriodic, + semi-persistent ResourceTypeSemi-persistent, + aperiodic ResourceTypeAperiodic, + choice-extension ProtocolIE-SingleContainer {{ ResourceType-ExtIEs }} +} + +ResourceType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceTypePeriodic ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, ...}, + offset INTEGER(0..2559, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypePeriodic-ExtIEs} } OPTIONAL +} + +ResourceTypePeriodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeSemi-persistent ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, ...}, + offset INTEGER(0..2559, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeSemi-persistent-ExtIEs} } OPTIONAL +} + +ResourceTypeSemi-persistent-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeAperiodic ::= SEQUENCE { + aperiodicResourceType ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceTypeAperiodic-ExtIEs} } OPTIONAL +} + +ResourceTypeAperiodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypePos ::= CHOICE { + periodic ResourceTypePeriodicPos, + semi-persistent ResourceTypeSemi-persistentPos, + aperiodic ResourceTypeAperiodicPos, + choice-extension ProtocolIE-SingleContainer {{ ResourceTypePos-ExtIEs }} +} + +ResourceTypePos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceTypePeriodicPos ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, slot5120, slot10240, slot20480, slot40960, slot81920, ...}, + offset INTEGER(0..81919, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypePeriodicPos-ExtIEs} } OPTIONAL +} + +ResourceTypePeriodicPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeSemi-persistentPos ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, slot5120, slot10240, slot20480, slot40960, slot81920, ...}, + offset INTEGER(0..81919, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeSemi-persistentPos-ExtIEs} } OPTIONAL +} + +ResourceTypeSemi-persistentPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeAperiodicPos ::= SEQUENCE { + slotOffset INTEGER (1..32), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeAperiodicPos-ExtIEs} } OPTIONAL +} + +ResourceTypeAperiodicPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCDuplicationInformation ::= SEQUENCE { + rLCDuplicationStateList RLCDuplicationStateList, + primaryPathIndication PrimaryPathIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {RLCDuplicationInformation-ExtIEs} } OPTIONAL +} + +RLCDuplicationInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCDuplicationStateList ::= SEQUENCE (SIZE(1..maxnoofRLCDuplicationState)) OF RLCDuplicationState-Item + +RLCDuplicationState-Item ::=SEQUENCE { + duplicationState DuplicationState, + iE-Extensions ProtocolExtensionContainer { {RLCDuplicationState-Item-ExtIEs } } OPTIONAL, + ... +} + + +RLCDuplicationState-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCFailureIndication ::= SEQUENCE { + assocatedLCID LCID, + iE-Extensions ProtocolExtensionContainer { {RLCFailureIndication-ExtIEs} } OPTIONAL +} + +RLCFailureIndication-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCMode ::= ENUMERATED { + rlc-am, + rlc-um-bidirectional, + rlc-um-unidirectional-ul, + rlc-um-unidirectional-dl, + ... +} + +RLC-Status ::= SEQUENCE { + reestablishment-Indication Reestablishment-Indication, + iE-Extensions ProtocolExtensionContainer { { RLC-Status-ExtIEs } } OPTIONAL, + ... +} + +RLC-Status-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLFReportInformationList ::= SEQUENCE (SIZE(1.. maxnoofRLFReports)) OF RLFReportInformationItem + +RLFReportInformationItem ::= SEQUENCE { + nRUERLFReportContainer NRUERLFReportContainer, + uEAssitantIdentifier GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RLFReportInformationItem-ExtIEs} } OPTIONAL, + ... +} + +RLFReportInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RIMRSDetectionStatus ::= ENUMERATED {rs-detected, rs-disappeared, ...} + +RRCContainer ::= OCTET STRING + +RRCContainer-RRCSetupComplete ::= OCTET STRING + +RRCDeliveryStatus ::= SEQUENCE { + delivery-status PDCP-SN, + triggering-message PDCP-SN, + iE-Extensions ProtocolExtensionContainer { { RRCDeliveryStatus-ExtIEs } } OPTIONAL} + +RRCDeliveryStatus-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +RRCDeliveryStatusRequest ::= ENUMERATED {true, ...} + +RRCReconfigurationCompleteIndicator ::= ENUMERATED { + true, + ..., + failure +} + +RRC-Version ::= SEQUENCE { + latest-RRC-Version BIT STRING (SIZE(3)), + iE-Extensions ProtocolExtensionContainer { { RRC-Version-ExtIEs } } OPTIONAL} + +RRC-Version-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-latest-RRC-Version-Enhanced CRITICALITY ignore EXTENSION OCTET STRING (SIZE(3)) PRESENCE optional }, + ... +} + +RoutingID ::= OCTET STRING + +-- S + +SCell-FailedtoSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-FailedtoSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeRemoved-Item ::= SEQUENCE { + sCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeRemoved-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeRemoved-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ServingCellMO CRITICALITY ignore EXTENSION ServingCellMO PRESENCE optional }, + ... +} + +SCell-ToBeSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ServingCellMO CRITICALITY ignore EXTENSION ServingCellMO PRESENCE optional }, + ... +} + +SCellIndex ::=INTEGER (1..31, ...) + +SCS-SpecificCarrier ::= SEQUENCE { + offsetToCarrier INTEGER (0..2199,...), + subcarrierSpacing ENUMERATED {kHz15, kHz30, kHz60, kHz120,...}, + carrierBandwidth INTEGER (0..275,...), + iE-Extensions ProtocolExtensionContainer { { SCS-SpecificCarrier-ExtIEs } } OPTIONAL +} + +SCS-SpecificCarrier-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Search-window-information ::= SEQUENCE { + expectedPropagationDelay INTEGER (-3841..3841,...), + delayUncertainty INTEGER (1..246,...), + iE-Extensions ProtocolExtensionContainer { { Search-window-information-ExtIEs } } OPTIONAL +} + +Search-window-information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SerialNumber ::= BIT STRING (SIZE (16)) + +SIBType-PWS ::=INTEGER (6..8, ...) + +SelectedBandCombinationIndex ::= OCTET STRING + +SelectedFeatureSetEntryIndex ::= OCTET STRING + +CG-ConfigInfo ::= OCTET STRING + +ServCellIndex ::= INTEGER (0..31, ...) + +ServingCellMO ::= INTEGER (1..64, ...) + +Served-Cell-Information ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI, + fiveGS-TAC FiveGS-TAC OPTIONAL, + configured-EPS-TAC Configured-EPS-TAC OPTIONAL, + servedPLMNs ServedPLMNs-List, + nR-Mode-Info NR-Mode-Info, + measurementTimingConfiguration OCTET STRING, + iE-Extensions ProtocolExtensionContainer { {Served-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RANAC CRITICALITY ignore EXTENSION RANAC PRESENCE optional }| + { ID id-ExtendedServedPLMNs-List CRITICALITY ignore EXTENSION ExtendedServedPLMNs-List PRESENCE optional }| + { ID id-Cell-Direction CRITICALITY ignore EXTENSION Cell-Direction PRESENCE optional }| + { ID id-BPLMN-ID-Info-List CRITICALITY ignore EXTENSION BPLMN-ID-Info-List PRESENCE optional }| + { ID id-Cell-Type CRITICALITY ignore EXTENSION CellType PRESENCE optional}| + { ID id-ConfiguredTACIndication CRITICALITY ignore EXTENSION ConfiguredTACIndication PRESENCE optional }| + { ID id-AggressorgNBSetID CRITICALITY ignore EXTENSION AggressorgNBSetID PRESENCE optional}| + { ID id-VictimgNBSetID CRITICALITY ignore EXTENSION VictimgNBSetID PRESENCE optional}| + { ID id-IAB-Info-IAB-DU CRITICALITY ignore EXTENSION IAB-Info-IAB-DU PRESENCE optional}| + { ID id-SSB-PositionsInBurst CRITICALITY ignore EXTENSION SSB-PositionsInBurst PRESENCE optional }| + { ID id-NRPRACHConfig CRITICALITY ignore EXTENSION NRPRACHConfig PRESENCE optional }, + ... +} + +Served-Cells-To-Add-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Add-ItemExtIEs} } OPTIONAL, + ... +} + +Served-Cells-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Delete-Item ::= SEQUENCE { + oldNRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Delete-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Delete-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Modify-Item ::= SEQUENCE { + oldNRCGI NRCGI , + served-Cell-Information Served-Cell-Information , + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Modify-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Modify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-EUTRA-Cells-Information::= SEQUENCE { + eUTRA-Mode-Info EUTRA-Mode-Info, + protectedEUTRAResourceIndication ProtectedEUTRAResourceIndication, + iE-Extensions ProtocolExtensionContainer { {Served-EUTRA-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-EUTRA-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Service-State ::= ENUMERATED { + in-service, + out-of-service, + ... +} + +Service-Status ::= SEQUENCE { + service-state Service-State, + switchingOffOngoing ENUMERATED {true, ...} OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Service-Status-ExtIEs } } OPTIONAL, + ... +} + +Service-Status-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SFNInitialisationTime ::= BIT STRING (SIZE (64)) + +ShortDRXCycleLength ::= ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ...} + +ShortDRXCycleTimer ::= INTEGER (1..16) + +SIB1-message ::= OCTET STRING + +SIB10-message ::= OCTET STRING + +SIB12-message ::= OCTET STRING + +SIB13-message ::= OCTET STRING + +SIB14-message ::= OCTET STRING + +SItype ::= INTEGER (1..32, ...) + +SItype-List ::= SEQUENCE (SIZE(1.. maxnoofSITypes)) OF SItype-Item + +SItype-Item ::= SEQUENCE { + sItype SItype , + iE-Extensions ProtocolExtensionContainer { { SItype-ItemExtIEs } } OPTIONAL +} + +SItype-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SibtypetobeupdatedListItem ::= SEQUENCE { + sIBtype INTEGER (2..32,...), + sIBmessage OCTET STRING, + valueTag INTEGER (0..31,...), + iE-Extensions ProtocolExtensionContainer { { SibtypetobeupdatedListItem-ExtIEs } } OPTIONAL, + ... +} + +SibtypetobeupdatedListItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-areaScope CRITICALITY ignore EXTENSION AreaScope PRESENCE optional}, + ... +} + +SLDRBID ::= INTEGER (1..512, ...) + +SLDRBInformation ::= SEQUENCE { + sLDRB-QoS PC5QoSParameters, + flowsMappedToSLDRB-List FlowsMappedToSLDRB-List, + ... +} + +SLDRBs-FailedToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-FailedToBeSetup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Modified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Modified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ModifiedConf-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ModifiedConf-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Required-ToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Setup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Setup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-SetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-SetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation OPTIONAL, + rLCMode RLCMode OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeReleased-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeSetup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation, + rLCMode RLCMode, + + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeSetup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeSetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation, + rLCMode RLCMode OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SL-PHY-MAC-RLC-Config ::= OCTET STRING + +SL-ConfigDedicatedEUTRA ::= OCTET STRING + +SliceAvailableCapacity ::= SEQUENCE { + sliceAvailableCapacityList SliceAvailableCapacityList, + iE-Extensions ProtocolExtensionContainer { { SliceAvailableCapacity-ExtIEs} } OPTIONAL +} + +SliceAvailableCapacity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceAvailableCapacityList ::= SEQUENCE (SIZE(1.. maxnoofBPLMNsNR)) OF SliceAvailableCapacityItem + +SliceAvailableCapacityItem ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + sNSSAIAvailableCapacity-List SNSSAIAvailableCapacity-List, + iE-Extensions ProtocolExtensionContainer { { SliceAvailableCapacityItem-ExtIEs} } OPTIONAL +} + +SliceAvailableCapacityItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SNSSAIAvailableCapacity-List ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SNSSAIAvailableCapacity-Item + +SNSSAIAvailableCapacity-Item ::= SEQUENCE { + sNSSAI SNSSAI, + sliceAvailableCapacityValueDownlink INTEGER (0..100) OPTIONAL, + sliceAvailableCapacityValueUplink INTEGER (0..100) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SNSSAIAvailableCapacity-Item-ExtIEs } } OPTIONAL +} + +SNSSAIAvailableCapacity-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceSupportList ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SliceSupportItem + +SliceSupportItem ::= SEQUENCE { + sNSSAI SNSSAI, + iE-Extensions ProtocolExtensionContainer { { SliceSupportItem-ExtIEs } } OPTIONAL +} + +SliceSupportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceToReportList ::= SEQUENCE (SIZE(1.. maxnoofBPLMNsNR)) OF SliceToReportItem + +SliceToReportItem ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + sNSSAIlist SNSSAI-list, + iE-Extensions ProtocolExtensionContainer { { SliceToReportItem-ExtIEs} } OPTIONAL +} + +SliceToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SlotNumber ::= INTEGER (0..79) + +SNSSAI-list ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SNSSAI-Item + +SNSSAI-Item ::= SEQUENCE { + sNSSAI SNSSAI, + iE-Extensions ProtocolExtensionContainer { { SNSSAI-Item-ExtIEs } } OPTIONAL +} + +SNSSAI-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Slot-Configuration-List ::= SEQUENCE (SIZE(1.. maxnoofslots)) OF Slot-Configuration-Item + +Slot-Configuration-Item ::= SEQUENCE { + slotIndex INTEGER (0..5119, ...), + symbolAllocInSlot SymbolAllocInSlot, + iE-Extensions ProtocolExtensionContainer { { Slot-Configuration-ItemExtIEs } } OPTIONAL +} + +Slot-Configuration-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SNSSAI ::= SEQUENCE { + sST OCTET STRING (SIZE(1)), + sD OCTET STRING (SIZE(3)) OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SNSSAI-ExtIEs } } OPTIONAL +} + +SNSSAI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialDirectionInformation ::= SEQUENCE { + nR-PRSBeamInformation NR-PRSBeamInformation, + iE-Extensions ProtocolExtensionContainer { { SpatialDirectionInformation-ExtIEs } } OPTIONAL +} + +SpatialDirectionInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationInfo ::= SEQUENCE { + spatialRelationforResourceID SpatialRelationforResourceID, + iE-Extensions ProtocolExtensionContainer { {SpatialRelationInfo-ExtIEs} } OPTIONAL +} + +SpatialRelationInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationforResourceID ::= SEQUENCE (SIZE(1..maxnoofSpatialRelations)) OF SpatialRelationforResourceIDItem + +SpatialRelationforResourceIDItem ::= SEQUENCE { + referenceSignal ReferenceSignal, + iE-Extensions ProtocolExtensionContainer { {SpatialRelationforResourceIDItem-ExtIEs} } OPTIONAL +} + +SpatialRelationforResourceIDItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationPos ::= CHOICE { + sSBPos SSBPos, + pRSInformationPos PRSInformationPos, + choice-extension ProtocolIE-SingleContainer {{ SpatialInformationPos-ExtIEs }} +} + +SpatialInformationPos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SpectrumSharingGroupID ::= INTEGER (1..maxCellineNB) + +SRBID ::= INTEGER (0..3, ...) + +SRBs-FailedToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Modified-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Setup-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-SetupMod-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalDuplicationIndication CRITICALITY ignore EXTENSION AdditionalDuplicationIndication PRESENCE optional }, + ... +} + +SRBs-ToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID, + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalDuplicationIndication CRITICALITY ignore EXTENSION AdditionalDuplicationIndication PRESENCE optional }, + ... +} + +SRSCarrier-List ::= SEQUENCE (SIZE(1.. maxnoSRS-Carriers)) OF SRSCarrier-List-Item + +SRSCarrier-List-Item ::= SEQUENCE { + pointA INTEGER (0..3279165,...), + uplinkChannelBW-PerSCS-List UplinkChannelBW-PerSCS-List, + activeULBWP ActiveULBWP, + pci NRPCI, + iE-Extensions ProtocolExtensionContainer { { SRSCarrier-List-Item-ExtIEs } } OPTIONAL +} + +SRSCarrier-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSConfig ::= SEQUENCE { + sRSResource-List SRSResource-List OPTIONAL, + posSRSResource-List PosSRSResource-List OPTIONAL, + sRSResourceSet-List SRSResourceSet-List OPTIONAL, + posSRSResourceSet-List PosSRSResourceSet-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRSConfig-ExtIEs } } OPTIONAL +} + +SRSConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSConfiguration ::= SEQUENCE { + sRSCarrier-List SRSCarrier-List, + iE-Extensions ProtocolExtensionContainer { { SRSConfiguration-ExtIEs } } OPTIONAL +} + +SRSConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSPosResourceID ::= INTEGER (0..63, ...) + +SRSResource::= SEQUENCE { + sRSResourceID SRSResourceID, + nrofSRS-Ports ENUMERATED {port1, ports2, ports4}, + transmissionComb TransmissionComb, + startPosition INTEGER (0..13), + nrofSymbols ENUMERATED {n1, n2, n4}, + repetitionFactor ENUMERATED {n1, n2, n4}, + freqDomainPosition INTEGER (0..67), + freqDomainShift INTEGER (0..268), + c-SRS INTEGER (0..63), + b-SRS INTEGER (0..3), + b-hop INTEGER (0..3), + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + resourceType ResourceType, + slotOffset INTEGER (0..2559), + sequenceId INTEGER (0..1023), + iE-Extensions ProtocolExtensionContainer { { SRSResource-ExtIEs } } OPTIONAL +} + +SRSResource-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceID ::= INTEGER (0..63, ...) + +SRSResourceID-List::= SEQUENCE (SIZE (1..maxnoSRS-ResourcePerSet)) OF SRSResourceID + +SRSResource-List ::= SEQUENCE (SIZE (1..maxnoSRS-Resources)) OF SRSResource + +SRSResourceSet::= SEQUENCE { + sRSResourceSetID SRSResourceSetID, + sRSResourceID-List SRSResourceID-List, + resourceSetType ResourceSetType, + iE-Extensions ProtocolExtensionContainer { { SRSResourceSet-ExtIEs } } OPTIONAL +} + +SRSResourceSet-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceSetID ::= INTEGER (0..15, ...) + +SRSResourceSetList ::= SEQUENCE (SIZE(1.. maxnoSRS-ResourceSets)) OF SRSResourceSetItem + +SRSResourceSetItem ::= SEQUENCE { + numSRSresourcesperset INTEGER (1..16, ...) OPTIONAL, + periodicityList PeriodicityList OPTIONAL, + spatialRelationInfo SpatialRelationInfo OPTIONAL, + pathlossReferenceInfo PathlossReferenceInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRSResourceSetItemExtIEs } } OPTIONAL +} + +SRSResourceSetItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceSet-List ::= SEQUENCE (SIZE (1..maxnoSRS-ResourceSets)) OF SRSResourceSet + +SRSResourceTrigger ::= SEQUENCE { + aperiodicSRSResourceTriggerList AperiodicSRSResourceTriggerList, + iE-Extensions ProtocolExtensionContainer { {SRSResourceTrigger-ExtIEs} } OPTIONAL +} + +SRSResourceTrigger-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSSpatialRelation ::= SEQUENCE { + spatialRelationforResourceID SpatialRelationforResourceID, + iE-Extensions ProtocolExtensionContainer { {SRSSpatialRelation-ExtIEs} } OPTIONAL +} + +SRSSpatialRelation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB ::= SEQUENCE { + pCI-NR NRPCI, + ssb-index SSB-Index OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {SSB-ExtIEs} } OPTIONAL +} + +SSB-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-freqInfo ::= INTEGER (0..maxNRARFCN) + +SSB-Index ::= INTEGER(0..63) + +SSBPos ::= SEQUENCE { + pCI-NR NRPCI OPTIONAL, + ssb-index SSB-Index, + iE-Extensions ProtocolExtensionContainer { {SSBPos-ExtIEs} } OPTIONAL +} + +SSBPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-subcarrierSpacing ::= ENUMERATED {kHz15, kHz30, kHz120, kHz240, spare3, spare2, spare1, ...} + +SSB-transmissionPeriodicity ::= ENUMERATED {sf10, sf20, sf40, sf80, sf160, sf320, sf640, ...} + +SSB-transmissionTimingOffset ::= INTEGER (0..127, ...) + +SSB-transmissionBitmap ::= CHOICE { + shortBitmap BIT STRING (SIZE (4)), + mediumBitmap BIT STRING (SIZE (8)), + longBitmap BIT STRING (SIZE (64)), + choice-extension ProtocolIE-SingleContainer { { SSB-transmisisonBitmap-ExtIEs} } +} + +SSB-transmisisonBitmap-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SSBAreaCapacityValueList ::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBAreaCapacityValueItem + +SSBAreaCapacityValueItem ::= SEQUENCE { + sSBIndex INTEGER(0..63), + sSBAreaCapacityValue INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { SSBAreaCapacityValueItem-ExtIEs} } OPTIONAL +} + +SSBAreaCapacityValueItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBAreaRadioResourceStatusList::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBAreaRadioResourceStatusItem + +SSBAreaRadioResourceStatusItem::= SEQUENCE { + sSBIndex INTEGER(0..63), + sSBAreaDLGBRPRBusage INTEGER (0..100), + sSBAreaULGBRPRBusage INTEGER (0..100), + sSBAreaDLnon-GBRPRBusage INTEGER (0..100), + sSBAreaULnon-GBRPRBusage INTEGER (0..100), + sSBAreaDLTotalPRBusage INTEGER (0..100), + sSBAreaULTotalPRBusage INTEGER (0..100), + dLschedulingPDCCHCCEusage INTEGER (0..100) OPTIONAL, + uLschedulingPDCCHCCEusage INTEGER (0..100) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SSBAreaRadioResourceStatusItem-ExtIEs} } OPTIONAL +} + +SSBAreaRadioResourceStatusItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBInformation ::= SEQUENCE { + sSBInformationList SSBInformationList, + iE-Extensions ProtocolExtensionContainer { { SSBInformation-ExtIEs } } OPTIONAL +} + +SSBInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBInformationList ::= SEQUENCE (SIZE(1.. maxnoofSSBs)) OF SSBInformationItem + +SSBInformationItem ::= SEQUENCE { + sSB-Configuration SSB-TF-Configuration, + pCI-NR NRPCI, + iE-Extensions ProtocolExtensionContainer { { SSBInformationItem-ExtIEs } } OPTIONAL +} + +SSBInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-PositionsInBurst ::= CHOICE { + shortBitmap BIT STRING (SIZE (4)), + mediumBitmap BIT STRING (SIZE (8)), + longBitmap BIT STRING (SIZE (64)), + choice-extension ProtocolIE-SingleContainer { {SSB-PositionsInBurst-ExtIEs} } +} + +SSB-PositionsInBurst-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SSB-TF-Configuration ::= SEQUENCE { + sSB-frequency INTEGER (0..3279165), + sSB-subcarrier-spacing ENUMERATED {kHz15, kHz30, kHz60, kHz120, kHz240, ...}, + sSB-Transmit-power INTEGER (-60..50), + sSB-periodicity ENUMERATED {ms5, ms10, ms20, ms40, ms80, ms160, ...}, + sSB-half-frame-offset INTEGER(0..1), + sSB-SFN-offset INTEGER(0..15), + sSB-position-in-burst SSB-PositionsInBurst OPTIONAL, + sFNInitialisationTime SFNInitialisationTime OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SSB-TF-Configuration-ExtIEs} } OPTIONAL +} + +SSB-TF-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SSBToReportList ::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBToReportItem + +SSBToReportItem ::= SEQUENCE { + sSBIndex INTEGER(0..63), + iE-Extensions ProtocolExtensionContainer { { SSBToReportItem-ExtIEs} } OPTIONAL +} + +SSBToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SUL-Information ::= SEQUENCE { + sUL-NRARFCN INTEGER (0..maxNRARFCN), + sUL-transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { { SUL-InformationExtIEs} } OPTIONAL, + ... +} + +SUL-InformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }| + { ID id-FrequencyShift7p5khz CRITICALITY ignore EXTENSION FrequencyShift7p5khz PRESENCE optional }, + ... +} + +SubcarrierSpacing ::= ENUMERATED { kHz15, kHz30, kHz60, kHz120, kHz240, spare3, spare2, spare1, ...} + +SubscriberProfileIDforRFP ::= INTEGER (1..256, ...) + +SULAccessIndication ::= ENUMERATED {true,...} + + +SupportedSULFreqBandItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + iE-Extensions ProtocolExtensionContainer { { SupportedSULFreqBandItem-ExtIEs} } OPTIONAL, + ... +} + +SupportedSULFreqBandItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SymbolAllocInSlot ::= CHOICE { + all-DL NULL, + all-UL NULL, + both-DL-and-UL NumDLULSymbols, + choice-extension ProtocolIE-SingleContainer { { SymbolAllocInSlot-ExtIEs } } +} + +SymbolAllocInSlot-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SystemFrameNumber ::= INTEGER (0..1023) + +SystemInformationAreaID ::=BIT STRING (SIZE (24)) + +-- T + +FiveGS-TAC ::= OCTET STRING (SIZE(3)) + +Configured-EPS-TAC ::= OCTET STRING (SIZE(2)) + +TargetCellList ::= SEQUENCE (SIZE(1..maxnoofCHOcells)) OF TargetCellList-Item + +TargetCellList-Item ::= SEQUENCE { + target-cell NRCGI, + iE-Extensions ProtocolExtensionContainer { { TargetCellList-Item-ExtIEs} } OPTIONAL +} + +TargetCellList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TDD-Info ::= SEQUENCE { + nRFreqInfo NRFreqInfo, + transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-IntendedTDD-DL-ULConfig CRITICALITY ignore EXTENSION IntendedTDD-DL-ULConfig PRESENCE optional}| + {ID id-TDD-UL-DLConfigCommonNR CRITICALITY ignore EXTENSION TDD-UL-DLConfigCommonNR PRESENCE optional }| + {ID id-CarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }, + ... +} + +TDD-UL-DLConfigCommonNR ::= OCTET STRING + +TimeReferenceInformation ::= SEQUENCE { + referenceTime ReferenceTime, + referenceSFN ReferenceSFN, + uncertainty Uncertainty, + timeInformationType TimeInformationType, + iE-Extensions ProtocolExtensionContainer { {TimeReferenceInformation-ExtIEs} } OPTIONAL +} + +TimeReferenceInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeInformationType ::= ENUMERATED {localClock} + +TimeStamp ::= SEQUENCE { + systemFrameNumber SystemFrameNumber, + slotIndex TimeStampSlotIndex, + measurementTime SFNInitialisationTime OPTIONAL, + iE-Extension ProtocolExtensionContainer { { TimeStamp-ExtIEs} } OPTIONAL +} + +TimeStamp-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeStampSlotIndex ::= CHOICE { + sCS-15 INTEGER(0..9), + sCS-30 INTEGER(0..19), + sCS-60 INTEGER(0..39), + sCS-120 INTEGER(0..79), + choice-extension ProtocolIE-SingleContainer { { TimeStampSlotIndex-ExtIEs} } +} + +TimeStampSlotIndex-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TimeToWait ::= ENUMERATED {v1s, v2s, v5s, v10s, v20s, v60s, ...} + +TimingMeasurementQuality ::= SEQUENCE { + measurementQuality INTEGER(0..31), + resolution ENUMERATED{m0dot1, m1, m10, m30, ...}, + iE-Extensions ProtocolExtensionContainer { { TimingMeasurementQuality-ExtIEs} } OPTIONAL +} + +TimingMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TNLAssociationUsage ::= ENUMERATED { + ue, + non-ue, + both, + ... +} + +TNLCapacityIndicator::= SEQUENCE { + dLTNLOfferedCapacity INTEGER (1.. 16777216,...), + dLTNLAvailableCapacity INTEGER (0.. 100,...), + uLTNLOfferedCapacity INTEGER (1.. 16777216,...), + uLTNLAvailableCapacity INTEGER (0.. 100,...), + iE-Extensions ProtocolExtensionContainer { { TNLCapacityIndicator-ExtIEs} } OPTIONAL +} + +TNLCapacityIndicator-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TraceActivation ::= SEQUENCE { + traceID TraceID, + interfacesToTrace InterfacesToTrace, + traceDepth TraceDepth, + traceCollectionEntityIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { {TraceActivation-ExtIEs} } OPTIONAL +} + +TraceActivation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-mdtConfiguration CRITICALITY ignore EXTENSION MDTConfiguration PRESENCE optional}| + {ID id-TraceCollectionEntityURI CRITICALITY ignore EXTENSION URI-address PRESENCE optional }, + ... +} + +TraceDepth ::= ENUMERATED { + minimum, + medium, + maximum, + minimumWithoutVendorSpecificExtension, + mediumWithoutVendorSpecificExtension, + maximumWithoutVendorSpecificExtension, + ... +} + +TraceID ::= OCTET STRING (SIZE(8)) + +TrafficMappingInfo ::= CHOICE { + iPtolayer2TrafficMappingInfo IPtolayer2TrafficMappingInfo, + bAPlayerBHRLCchannelMappingInfo BAPlayerBHRLCchannelMappingInfo, + choice-extension ProtocolIE-SingleContainer { { TrafficMappingInfo-ExtIEs} } +} + +TrafficMappingInfo-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...)) + +TransactionID ::= INTEGER (0..255, ...) + +Transmission-Bandwidth ::= SEQUENCE { + nRSCS NRSCS, + nRNRB NRNRB, + iE-Extensions ProtocolExtensionContainer { { Transmission-Bandwidth-ExtIEs} } OPTIONAL, + ... +} + +Transmission-Bandwidth-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionComb ::= CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + cyclicShift-n4 INTEGER (0..11) + }, + choice-extension ProtocolIE-SingleContainer { { TransmissionComb-ExtIEs} } +} +TransmissionComb-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TransmissionCombPos ::= CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + cyclicShift-n4 INTEGER (0..11) + }, + n8 SEQUENCE { + combOffset-n8 INTEGER (0..7), + cyclicShift-n8 INTEGER (0..5) + }, + + choice-extension ProtocolIE-SingleContainer { { TransmissionCombPos-ExtIEs} } +} +TransmissionCombPos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +Transport-UP-Layer-Address-Info-To-Add-List ::= SEQUENCE (SIZE(1.. maxnoofTLAs)) OF Transport-UP-Layer-Address-Info-To-Add-Item + +Transport-UP-Layer-Address-Info-To-Add-Item ::= SEQUENCE { + iP-SecTransportLayerAddress TransportLayerAddress, + gTPTransportLayerAddressToAdd GTPTLAs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-UP-Layer-Address-Info-To-Add-ItemExtIEs } } OPTIONAL +} + +Transport-UP-Layer-Address-Info-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Transport-UP-Layer-Address-Info-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTLAs)) OF Transport-UP-Layer-Address-Info-To-Remove-Item + +Transport-UP-Layer-Address-Info-To-Remove-Item ::= SEQUENCE { + iP-SecTransportLayerAddress TransportLayerAddress, + gTPTransportLayerAddressToRemove GTPTLAs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-UP-Layer-Address-Info-To-Remove-ItemExtIEs } } OPTIONAL +} + +Transport-UP-Layer-Address-Info-To-Remove-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionActionIndicator ::= ENUMERATED {stop, ..., restart } + +TRPID ::= INTEGER (0.. maxnoofTRPs, ...) + +TRPInformation ::= SEQUENCE { + tRPID TRPID, + tRPInformationTypeResponseList TRPInformationTypeResponseList, + iE-Extensions ProtocolExtensionContainer { { TRPInformation-ExtIEs } } OPTIONAL +} + +TRPInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPInformationItem ::= SEQUENCE { + tRPInformation TRPInformation, + iE-Extensions ProtocolExtensionContainer { { TRPInformationItem-ExtIEs } } OPTIONAL +} + +TRPInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPInformationTypeItem ::= ENUMERATED { + nrPCI, + nG-RAN-CGI, + arfcn, + pRSConfig, + sSBConfig, + sFNInitTime, + spatialDirectInfo, + geoCoord, +...} + + +TRPInformationTypeResponseList ::= SEQUENCE (SIZE(1.. maxnoofTRPInfoTypes)) OF TRPInformationTypeResponseItem + +TRPInformationTypeResponseItem ::= CHOICE { + pCI-NR NRPCI, + nG-RAN-CGI NRCGI, + nRARFCN INTEGER (0..maxNRARFCN), + pRSConfiguration PRSConfiguration, + sSBinformation SSBInformation, + sFNInitialisationTime SFNInitialisationTime, + spatialDirectionInformation SpatialDirectionInformation, + geographicalCoordinates GeographicalCoordinates, + choice-extension ProtocolIE-SingleContainer { { TRPInformationTypeResponseItem-ExtIEs} } +} + +TRPInformationTypeResponseItem-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +TRPList ::= SEQUENCE (SIZE(1.. maxnoofTRPs)) OF TRPListItem + +TRPListItem ::= SEQUENCE { + tRPID TRPID, + iE-Extensions ProtocolExtensionContainer { { TRPListItem-ExtIEs } } OPTIONAL +} + +TRPListItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPMeasurementQuality ::= SEQUENCE { + tRPmeasurementQuality-Item TRPMeasurementQuality-Item, + iE-Extensions ProtocolExtensionContainer { {TRPMeasurementQuality-ExtIEs} } OPTIONAL +} + +TRPMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPMeasurementQuality-Item ::= CHOICE { + timingMeasurementQuality TimingMeasurementQuality, + angleMeasurementQuality AngleMeasurementQuality, + choice-extension ProtocolIE-SingleContainer { { TRPMeasurementQuality-Item-ExtIEs } } +} + +TRPMeasurementQuality-Item-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRP-MeasurementRequestList ::= SEQUENCE (SIZE (1..maxNoOfMeasTRPs)) OF TRP-MeasurementRequestItem + +TRP-MeasurementRequestItem ::= SEQUENCE { + tRPID TRPID, + search-window-information Search-window-information OPTIONAL, + iE-extensions ProtocolExtensionContainer { { TRP-MeasurementRequestItem-ExtIEs } } OPTIONAL +} + +TRP-MeasurementRequestItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPPositionDefinitionType ::= CHOICE { + direct TRPPositionDirect, + referenced TRPPositionReferenced, + choice-extension ProtocolIE-SingleContainer { { TRPPositionDefinitionType-ExtIEs } } +} + +TRPPositionDefinitionType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRPPositionDirect ::= SEQUENCE { + accuracy TRPPositionDirectAccuracy, + iE-extensions ProtocolExtensionContainer { { TRPPositionDirect-ExtIEs } } OPTIONAL +} + +TRPPositionDirect-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPPositionDirectAccuracy ::= CHOICE { + tRPPosition AccessPointPosition, + tRPHAposition NGRANHighAccuracyAccessPointPosition, + choice-extension ProtocolIE-SingleContainer { { TRPPositionDirectAccuracy-ExtIEs } } +} + +TRPPositionDirectAccuracy-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRPPositionReferenced ::= SEQUENCE { + referencePoint ReferencePoint, + referencePointType TRPReferencePointType, + iE-extensions ProtocolExtensionContainer { { TRPPositionReferenced-ExtIEs } } OPTIONAL +} + +TRPPositionReferenced-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPReferencePointType ::= CHOICE { + tRPPositionRelativeGeodetic RelativeGeodeticLocation, + tRPPositionRelativeCartesian RelativeCartesianLocation, + choice-extension ProtocolIE-SingleContainer { { TRPReferencePointType-ExtIEs } } +} + +TRPReferencePointType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TypeOfError ::= ENUMERATED { + not-understood, + missing, + ... +} + +Transport-Layer-Address-Info ::= SEQUENCE { + transport-UP-Layer-Address-Info-To-Add-List Transport-UP-Layer-Address-Info-To-Add-List OPTIONAL, + transport-UP-Layer-Address-Info-To-Remove-List Transport-UP-Layer-Address-Info-To-Remove-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-Layer-Address-Info-ExtIEs } } OPTIONAL +} + +Transport-Layer-Address-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TSCAssistanceInformation ::= SEQUENCE { + periodicity Periodicity, + burstArrivalTime BurstArrivalTime OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {TSCAssistanceInformation-ExtIEs} } OPTIONAL, + ... +} + +TSCAssistanceInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TSCTrafficCharacteristics ::= SEQUENCE { + tSCAssistanceInformationDL TSCAssistanceInformation OPTIONAL, + tSCAssistanceInformationUL TSCAssistanceInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {TSCTrafficCharacteristics-ExtIEs} } OPTIONAL, + ... +} + +TSCTrafficCharacteristics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- U +UAC-Assistance-Info ::= SEQUENCE { + uACPLMN-List UACPLMN-List, + iE-Extensions ProtocolExtensionContainer { { UAC-Assistance-InfoExtIEs} } OPTIONAL +} + +UAC-Assistance-InfoExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UACPLMN-List ::= SEQUENCE (SIZE(1..maxnoofUACPLMNs)) OF UACPLMN-Item + +UACPLMN-Item::= SEQUENCE { + pLMNIdentity PLMN-Identity, + uACType-List UACType-List, iE-Extensions ProtocolExtensionContainer { { UACPLMN-Item-ExtIEs} } OPTIONAL +} + +UACPLMN-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-NID CRITICALITY ignore EXTENSION NID PRESENCE optional }, + ... +} + +UACType-List ::= SEQUENCE (SIZE(1..maxnoofUACperPLMN)) OF UACType-Item + +UACType-Item::= SEQUENCE { + uACReductionIndication UACReductionIndication, + uACCategoryType UACCategoryType, + iE-Extensions ProtocolExtensionContainer { { UACType-Item-ExtIEs } } OPTIONAL +} + +UACType-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UACCategoryType ::= CHOICE { + uACstandardized UACAction, + uACOperatorDefined UACOperatorDefined, + choice-extension ProtocolIE-SingleContainer { { UACCategoryType-ExtIEs } } +} + +UACCategoryType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UACOperatorDefined ::= SEQUENCE { + accessCategory INTEGER (32..63,...), + accessIdentity BIT STRING (SIZE(7)), + iE-Extensions ProtocolExtensionContainer { { UACOperatorDefined-ExtIEs} } OPTIONAL +} + +UACOperatorDefined-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +UACAction ::= ENUMERATED { + reject-non-emergency-mo-dt, + reject-rrc-cr-signalling, + permit-emergency-sessions-and-mobile-terminated-services-only, + permit-high-priority-sessions-and-mobile-terminated-services-only, + ... +} + +UACReductionIndication ::= INTEGER (0..100) + + +UE-associatedLogicalF1-ConnectionItem ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID OPTIONAL, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UE-associatedLogicalF1-ConnectionItemExtIEs} } OPTIONAL, + ... +} + +UEAssistanceInformation ::= OCTET STRING + +UEAssistanceInformationEUTRA ::= OCTET STRING + +UE-associatedLogicalF1-ConnectionItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-CapabilityRAT-ContainerList::= OCTET STRING + +UEContextNotRetrievable ::= ENUMERATED {true, ...} + +UEIdentityIndexValue ::= CHOICE { + indexLength10 BIT STRING (SIZE (10)), + choice-extension ProtocolIE-SingleContainer { {UEIdentityIndexValueChoice-ExtIEs} } +} + +UEIdentityIndexValueChoice-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UL-AoA ::= SEQUENCE { + azimuthAoA INTEGER (0..3599), + zenithAoA INTEGER (0..1799) OPTIONAL, + angleCoordinateSystem ENUMERATED {lCS, gCS} OPTIONAL, + iE-extensions ProtocolExtensionContainer { { UL-AoA-ExtIEs } } +} + +UL-AoA-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-BH-Non-UP-Traffic-Mapping ::= SEQUENCE { + uL-BH-Non-UP-Traffic-Mapping-List UL-BH-Non-UP-Traffic-Mapping-List, + iE-Extensions ProtocolExtensionContainer { { UL-BH-Non-UP-Traffic-Mapping-ExtIEs } } OPTIONAL +} + +UL-BH-Non-UP-Traffic-Mapping-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-BH-Non-UP-Traffic-Mapping-List ::= SEQUENCE (SIZE(1..maxnoofNonUPTrafficMappings)) OF UL-BH-Non-UP-Traffic-Mapping-Item + +UL-BH-Non-UP-Traffic-Mapping-Item ::= SEQUENCE { + nonUPTrafficType NonUPTrafficType, + bHInfo BHInfo, + iE-Extensions ProtocolExtensionContainer { { UL-BH-Non-UP-Traffic-Mapping-ItemExtIEs } } OPTIONAL +} + +UL-BH-Non-UP-Traffic-Mapping-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULConfiguration ::= SEQUENCE { + uLUEConfiguration ULUEConfiguration, + iE-Extensions ProtocolExtensionContainer { { ULConfigurationExtIEs } } OPTIONAL, + ... +} +ULConfigurationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-RTOA-Measurement ::= SEQUENCE { + uL-RTOA-MeasurementItem UL-RTOA-MeasurementItem, + additionalPath-List AdditionalPath-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UL-RTOA-Measurement-ExtIEs } } OPTIONAL +} + +UL-RTOA-Measurement-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-RTOA-MeasurementItem ::= CHOICE { + k0 INTEGER (0..1970049), + k1 INTEGER (0..985025), + k2 INTEGER (0..492513), + k3 INTEGER (0..246257), + k4 INTEGER (0..123129), + k5 INTEGER (0..61565), + choice-extension ProtocolIE-SingleContainer { { UL-RTOA-MeasurementItem-ExtIEs } } +} + +UL-RTOA-MeasurementItem-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UL-SRS-RSRP ::= INTEGER (0..127) + +ULUEConfiguration ::= ENUMERATED {no-data, shared, only, ...} + +UL-UP-TNL-Information-to-Update-List-Item ::= SEQUENCE { + uLUPTNLInformation UPTransportLayerInformation, + newULUPTNLInformation UPTransportLayerInformation OPTIONAL, + bHInfo BHInfo, + iE-Extensions ProtocolExtensionContainer { { UL-UP-TNL-Information-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +UL-UP-TNL-Information-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-UP-TNL-Address-to-Update-List-Item ::= SEQUENCE { + oldIPAdress TransportLayerAddress, + newIPAdress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { UL-UP-TNL-Address-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +UL-UP-TNL-Address-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofULUPTNLInformation)) OF ULUPTNLInformation-ToBeSetup-Item + +ULUPTNLInformation-ToBeSetup-Item ::=SEQUENCE { + uLUPTNLInformation UPTransportLayerInformation, + iE-Extensions ProtocolExtensionContainer { { ULUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +ULUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-BHInfo CRITICALITY ignore EXTENSION BHInfo PRESENCE optional }, + ... +} + +Uncertainty ::= INTEGER (0..32767, ...) + +UplinkChannelBW-PerSCS-List ::= SEQUENCE (SIZE (1..maxnoSCSs)) OF SCS-SpecificCarrier + +UplinkTxDirectCurrentListInformation ::= OCTET STRING + +UPTransportLayerInformation ::= CHOICE { + gTPTunnel GTPTunnel, + choice-extension ProtocolIE-SingleContainer { { UPTransportLayerInformation-ExtIEs} } +} + +UPTransportLayerInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +URI-address ::= VisibleString + +-- V + +VictimgNBSetID ::= SEQUENCE { + victimgNBSetID GNBSetID, + iE-Extensions ProtocolExtensionContainer { { VictimgNBSetID-ExtIEs } } OPTIONAL +} + +VictimgNBSetID-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +VehicleUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +PedestrianUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +-- W + +-- X + +-- Y + +-- Z + +END +-- ASN1STOP + +-- ASN1START +-- ************************************************************** +-- +-- Common definitions +-- +-- ************************************************************** + +F1AP-CommonDataTypes { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-CommonDataTypes (3) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +Criticality ::= ENUMERATED { reject, ignore, notify } + +Presence ::= ENUMERATED { optional, conditional, mandatory } + +PrivateIE-ID ::= CHOICE { + local INTEGER (0..65535), + global OBJECT IDENTIFIER +} + +ProcedureCode ::= INTEGER (0..255) + +ProtocolExtensionID ::= INTEGER (0..65535) + +ProtocolIE-ID ::= INTEGER (0..65535) + +TriggeringMessage ::= ENUMERATED { initiating-message, successful-outcome, unsuccessful-outcome } + +END +-- ASN1STOP + +-- ASN1START +-- ************************************************************** +-- +-- Constant definitions +-- +-- ************************************************************** + +F1AP-Constants { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Constants (4) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + ProcedureCode, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes; + + +-- ************************************************************** +-- +-- Elementary Procedures +-- +-- ************************************************************** + +id-Reset ProcedureCode ::= 0 +id-F1Setup ProcedureCode ::= 1 +id-ErrorIndication ProcedureCode ::= 2 +id-gNBDUConfigurationUpdate ProcedureCode ::= 3 +id-gNBCUConfigurationUpdate ProcedureCode ::= 4 +id-UEContextSetup ProcedureCode ::= 5 +id-UEContextRelease ProcedureCode ::= 6 +id-UEContextModification ProcedureCode ::= 7 +id-UEContextModificationRequired ProcedureCode ::= 8 +id-UEMobilityCommand ProcedureCode ::= 9 +id-UEContextReleaseRequest ProcedureCode ::= 10 +id-InitialULRRCMessageTransfer ProcedureCode ::= 11 +id-DLRRCMessageTransfer ProcedureCode ::= 12 +id-ULRRCMessageTransfer ProcedureCode ::= 13 +id-privateMessage ProcedureCode ::= 14 +id-UEInactivityNotification ProcedureCode ::= 15 +id-GNBDUResourceCoordination ProcedureCode ::= 16 +id-SystemInformationDeliveryCommand ProcedureCode ::= 17 +id-Paging ProcedureCode ::= 18 +id-Notify ProcedureCode ::= 19 +id-WriteReplaceWarning ProcedureCode ::= 20 +id-PWSCancel ProcedureCode ::= 21 +id-PWSRestartIndication ProcedureCode ::= 22 +id-PWSFailureIndication ProcedureCode ::= 23 +id-GNBDUStatusIndication ProcedureCode ::= 24 +id-RRCDeliveryReport ProcedureCode ::= 25 +id-F1Removal ProcedureCode ::= 26 +id-NetworkAccessRateReduction ProcedureCode ::= 27 +id-TraceStart ProcedureCode ::= 28 +id-DeactivateTrace ProcedureCode ::= 29 +id-DUCURadioInformationTransfer ProcedureCode ::= 30 +id-CUDURadioInformationTransfer ProcedureCode ::= 31 +id-BAPMappingConfiguration ProcedureCode ::= 32 +id-GNBDUResourceConfiguration ProcedureCode ::= 33 +id-IABTNLAddressAllocation ProcedureCode ::= 34 +id-IABUPConfigurationUpdate ProcedureCode ::= 35 +id-resourceStatusReportingInitiation ProcedureCode ::= 36 +id-resourceStatusReporting ProcedureCode ::= 37 +id-accessAndMobilityIndication ProcedureCode ::= 38 +id-accessSuccess ProcedureCode ::= 39 +id-cellTrafficTrace ProcedureCode ::= 40 +id-PositioningMeasurementExchange ProcedureCode ::= 41 +id-PositioningAssistanceInformationControl ProcedureCode ::= 42 +id-PositioningAssistanceInformationFeedback ProcedureCode ::= 43 +id-PositioningMeasurementReport ProcedureCode ::= 44 +id-PositioningMeasurementAbort ProcedureCode ::= 45 +id-PositioningMeasurementFailureIndication ProcedureCode ::= 46 +id-PositioningMeasurementUpdate ProcedureCode ::= 47 +id-TRPInformationExchange ProcedureCode ::= 48 +id-PositioningInformationExchange ProcedureCode ::= 49 +id-PositioningActivation ProcedureCode ::= 50 +id-PositioningDeactivation ProcedureCode ::= 51 +id-E-CIDMeasurementInitiation ProcedureCode ::= 52 +id-E-CIDMeasurementFailureIndication ProcedureCode ::= 53 +id-E-CIDMeasurementReport ProcedureCode ::= 54 +id-E-CIDMeasurementTermination ProcedureCode ::= 55 +id-PositioningInformationUpdate ProcedureCode ::= 56 +id-ReferenceTimeInformationReport ProcedureCode ::= 57 +id-ReferenceTimeInformationReportingControl ProcedureCode ::= 58 + + + +-- ************************************************************** +-- +-- Extension constants +-- +-- ************************************************************** + +maxPrivateIEs INTEGER ::= 65535 +maxProtocolExtensions INTEGER ::= 65535 +maxProtocolIEs INTEGER ::= 65535 +-- ************************************************************** +-- +-- Lists +-- +-- ************************************************************** + +maxNRARFCN INTEGER ::= 3279165 +maxnoofErrors INTEGER ::= 256 +maxnoofIndividualF1ConnectionsToReset INTEGER ::= 65536 +maxCellingNBDU INTEGER ::= 512 +maxnoofSCells INTEGER ::= 32 +maxnoofSRBs INTEGER ::= 8 +maxnoofDRBs INTEGER ::= 64 +maxnoofULUPTNLInformation INTEGER ::= 2 +maxnoofDLUPTNLInformation INTEGER ::= 2 +maxnoofBPLMNs INTEGER ::= 6 +maxnoofCandidateSpCells INTEGER ::= 64 +maxnoofPotentialSpCells INTEGER ::= 64 +maxnoofNrCellBands INTEGER ::= 32 +maxnoofSIBTypes INTEGER ::= 32 +maxnoofSITypes INTEGER ::= 32 +maxnoofPagingCells INTEGER ::= 512 +maxnoofTNLAssociations INTEGER ::= 32 +maxnoofQoSFlows INTEGER ::= 64 +maxnoofSliceItems INTEGER ::= 1024 +maxCellineNB INTEGER ::= 256 +maxnoofExtendedBPLMNs INTEGER ::= 6 +maxnoofUEIDs INTEGER ::= 65536 +maxnoofBPLMNsNR INTEGER ::= 12 +maxnoofUACPLMNs INTEGER ::= 12 +maxnoofUACperPLMN INTEGER ::= 64 +maxnoofAdditionalSIBs INTEGER ::= 63 +maxnoofslots INTEGER ::= 5120 +maxnoofTLAs INTEGER ::= 16 +maxnoofGTPTLAs INTEGER ::= 16 +maxnoofBHRLCChannels INTEGER ::= 65536 +maxnoofRoutingEntries INTEGER ::= 1024 +maxnoofIABSTCInfo INTEGER ::= 45 +maxnoofSymbols INTEGER ::= 14 +maxnoofServingCells INTEGER ::= 32 +maxnoofDUFSlots INTEGER ::= 320 +maxnoofHSNASlots INTEGER ::= 5120 +maxnoofServedCellsIAB INTEGER ::= 512 +maxnoofChildIABNodes INTEGER ::= 1024 +maxnoofNonUPTrafficMappings INTEGER ::= 32 +maxnoofTLAsIAB INTEGER ::= 1024 +maxnoofMappingEntries INTEGER ::= 67108864 +maxnoofDSInfo INTEGER ::= 64 +maxnoofEgressLinks INTEGER ::= 2 +maxnoofULUPTNLInformationforIAB INTEGER ::= 32678 +maxnoofUPTNLAddresses INTEGER ::= 8 +maxnoofSLDRBs INTEGER ::= 512 +maxnoofQoSParaSets INTEGER ::= 8 +maxnoofPC5QoSFlows INTEGER ::= 2048 +maxnoofSSBAreas INTEGER ::= 64 +maxnoofPhysicalResourceBlocks INTEGER ::= 275 +maxnoofPhysicalResourceBlocks-1 INTEGER ::= 274 +maxnoofPRACHconfigs INTEGER ::= 16 +maxnoofRACHReports INTEGER ::= 64 +maxnoofRLFReports INTEGER ::= 64 +maxnoofAdditionalPDCPDuplicationTNL INTEGER ::= 2 +maxnoofRLCDuplicationState INTEGER ::= 3 +maxnoofCHOcells INTEGER ::= 8 +maxnoofMDTPLMNs INTEGER ::= 16 +maxnoofCAGsupported INTEGER ::= 12 +maxnoofNIDsupported INTEGER ::= 12 +maxnoofNRSCSs INTEGER ::= 5 +maxnoofExtSliceItems INTEGER ::= 65535 +maxnoofPosMeas INTEGER ::= 16384 +maxnoofTRPInfoTypes INTEGER ::= 64 +maxnoofTRPs INTEGER ::= 65535 +maxnoofSRSTriggerStates INTEGER ::= 3 +maxnoofSpatialRelations INTEGER ::= 64 +maxnoBcastCell INTEGER ::= 16384 +maxnoofAngleInfo INTEGER ::= 65535 +maxnooflcs-gcs-translation INTEGER ::= 3 +maxnoofPath INTEGER ::= 2 +maxnoofMeasE-CID INTEGER ::= 64 +maxnoofSSBs INTEGER ::= 255 +maxnoSRS-ResourceSets INTEGER ::= 16 +maxnoSRS-ResourcePerSet INTEGER ::= 16 +maxnoSRS-Carriers INTEGER ::= 32 +maxnoSCSs INTEGER ::= 5 +maxnoSRS-Resources INTEGER ::= 64 +maxnoSRS-PosResources INTEGER ::= 64 +maxnoSRS-PosResourceSets INTEGER ::= 16 +maxnoSRS-PosResourcePerSet INTEGER ::= 16 +maxnoofPRS-ResourceSets INTEGER ::= 2 +maxnoofPRS-ResourcesPerSet INTEGER ::= 64 +maxNoOfMeasTRPs INTEGER ::= 64 +maxnoofPRSresourceSets INTEGER ::= 8 +maxnoofPRSresources INTEGER ::= 64 + + + +-- ************************************************************** +-- +-- IEs +-- +-- ************************************************************** + +id-Cause ProtocolIE-ID ::= 0 +id-Cells-Failed-to-be-Activated-List ProtocolIE-ID ::= 1 +id-Cells-Failed-to-be-Activated-List-Item ProtocolIE-ID ::= 2 +id-Cells-to-be-Activated-List ProtocolIE-ID ::= 3 +id-Cells-to-be-Activated-List-Item ProtocolIE-ID ::= 4 +id-Cells-to-be-Deactivated-List ProtocolIE-ID ::= 5 +id-Cells-to-be-Deactivated-List-Item ProtocolIE-ID ::= 6 +id-CriticalityDiagnostics ProtocolIE-ID ::= 7 +id-CUtoDURRCInformation ProtocolIE-ID ::= 9 +id-DRBs-FailedToBeModified-Item ProtocolIE-ID ::= 12 +id-DRBs-FailedToBeModified-List ProtocolIE-ID ::= 13 +id-DRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 14 +id-DRBs-FailedToBeSetup-List ProtocolIE-ID ::= 15 +id-DRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 16 +id-DRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 17 +id-DRBs-ModifiedConf-Item ProtocolIE-ID ::= 18 +id-DRBs-ModifiedConf-List ProtocolIE-ID ::= 19 +id-DRBs-Modified-Item ProtocolIE-ID ::= 20 +id-DRBs-Modified-List ProtocolIE-ID ::= 21 +id-DRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 22 +id-DRBs-Required-ToBeModified-List ProtocolIE-ID ::= 23 +id-DRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 24 +id-DRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 25 +id-DRBs-Setup-Item ProtocolIE-ID ::= 26 +id-DRBs-Setup-List ProtocolIE-ID ::= 27 +id-DRBs-SetupMod-Item ProtocolIE-ID ::= 28 +id-DRBs-SetupMod-List ProtocolIE-ID ::= 29 +id-DRBs-ToBeModified-Item ProtocolIE-ID ::= 30 +id-DRBs-ToBeModified-List ProtocolIE-ID ::= 31 +id-DRBs-ToBeReleased-Item ProtocolIE-ID ::= 32 +id-DRBs-ToBeReleased-List ProtocolIE-ID ::= 33 +id-DRBs-ToBeSetup-Item ProtocolIE-ID ::= 34 +id-DRBs-ToBeSetup-List ProtocolIE-ID ::= 35 +id-DRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 36 +id-DRBs-ToBeSetupMod-List ProtocolIE-ID ::= 37 +id-DRXCycle ProtocolIE-ID ::= 38 +id-DUtoCURRCInformation ProtocolIE-ID ::= 39 +id-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 40 +id-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 41 +id-gNB-DU-ID ProtocolIE-ID ::= 42 +id-GNB-DU-Served-Cells-Item ProtocolIE-ID ::= 43 +id-gNB-DU-Served-Cells-List ProtocolIE-ID ::= 44 +id-gNB-DU-Name ProtocolIE-ID ::= 45 +id-NRCellID ProtocolIE-ID ::= 46 +id-oldgNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 47 +id-ResetType ProtocolIE-ID ::= 48 +id-ResourceCoordinationTransferContainer ProtocolIE-ID ::= 49 +id-RRCContainer ProtocolIE-ID ::= 50 +id-SCell-ToBeRemoved-Item ProtocolIE-ID ::= 51 +id-SCell-ToBeRemoved-List ProtocolIE-ID ::= 52 +id-SCell-ToBeSetup-Item ProtocolIE-ID ::= 53 +id-SCell-ToBeSetup-List ProtocolIE-ID ::= 54 +id-SCell-ToBeSetupMod-Item ProtocolIE-ID ::= 55 +id-SCell-ToBeSetupMod-List ProtocolIE-ID ::= 56 +id-Served-Cells-To-Add-Item ProtocolIE-ID ::= 57 +id-Served-Cells-To-Add-List ProtocolIE-ID ::= 58 +id-Served-Cells-To-Delete-Item ProtocolIE-ID ::= 59 +id-Served-Cells-To-Delete-List ProtocolIE-ID ::= 60 +id-Served-Cells-To-Modify-Item ProtocolIE-ID ::= 61 +id-Served-Cells-To-Modify-List ProtocolIE-ID ::= 62 +id-SpCell-ID ProtocolIE-ID ::= 63 +id-SRBID ProtocolIE-ID ::= 64 +id-SRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 65 +id-SRBs-FailedToBeSetup-List ProtocolIE-ID ::= 66 +id-SRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 67 +id-SRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 68 +id-SRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 69 +id-SRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 70 +id-SRBs-ToBeReleased-Item ProtocolIE-ID ::= 71 +id-SRBs-ToBeReleased-List ProtocolIE-ID ::= 72 +id-SRBs-ToBeSetup-Item ProtocolIE-ID ::= 73 +id-SRBs-ToBeSetup-List ProtocolIE-ID ::= 74 +id-SRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 75 +id-SRBs-ToBeSetupMod-List ProtocolIE-ID ::= 76 +id-TimeToWait ProtocolIE-ID ::= 77 +id-TransactionID ProtocolIE-ID ::= 78 +id-TransmissionActionIndicator ProtocolIE-ID ::= 79 +id-UE-associatedLogicalF1-ConnectionItem ProtocolIE-ID ::= 80 +id-UE-associatedLogicalF1-ConnectionListResAck ProtocolIE-ID ::= 81 +id-gNB-CU-Name ProtocolIE-ID ::= 82 +id-SCell-FailedtoSetup-List ProtocolIE-ID ::= 83 +id-SCell-FailedtoSetup-Item ProtocolIE-ID ::= 84 +id-SCell-FailedtoSetupMod-List ProtocolIE-ID ::= 85 +id-SCell-FailedtoSetupMod-Item ProtocolIE-ID ::= 86 +id-RRCReconfigurationCompleteIndicator ProtocolIE-ID ::= 87 +id-Cells-Status-Item ProtocolIE-ID ::= 88 +id-Cells-Status-List ProtocolIE-ID ::= 89 +id-Candidate-SpCell-List ProtocolIE-ID ::= 90 +id-Candidate-SpCell-Item ProtocolIE-ID ::= 91 +id-Potential-SpCell-List ProtocolIE-ID ::= 92 +id-Potential-SpCell-Item ProtocolIE-ID ::= 93 +id-FullConfiguration ProtocolIE-ID ::= 94 +id-C-RNTI ProtocolIE-ID ::= 95 +id-SpCellULConfigured ProtocolIE-ID ::= 96 +id-InactivityMonitoringRequest ProtocolIE-ID ::= 97 +id-InactivityMonitoringResponse ProtocolIE-ID ::= 98 +id-DRB-Activity-Item ProtocolIE-ID ::= 99 +id-DRB-Activity-List ProtocolIE-ID ::= 100 +id-EUTRA-NR-CellResourceCoordinationReq-Container ProtocolIE-ID ::= 101 +id-EUTRA-NR-CellResourceCoordinationReqAck-Container ProtocolIE-ID ::= 102 +id-Protected-EUTRA-Resources-List ProtocolIE-ID ::= 105 +id-RequestType ProtocolIE-ID ::= 106 +id-ServCellIndex ProtocolIE-ID ::= 107 +id-RAT-FrequencyPriorityInformation ProtocolIE-ID ::= 108 +id-ExecuteDuplication ProtocolIE-ID ::= 109 +id-NRCGI ProtocolIE-ID ::= 111 +id-PagingCell-Item ProtocolIE-ID ::= 112 +id-PagingCell-List ProtocolIE-ID ::= 113 +id-PagingDRX ProtocolIE-ID ::= 114 +id-PagingPriority ProtocolIE-ID ::= 115 +id-SItype-List ProtocolIE-ID ::= 116 +id-UEIdentityIndexValue ProtocolIE-ID ::= 117 +id-gNB-CUSystemInformation ProtocolIE-ID ::= 118 +id-HandoverPreparationInformation ProtocolIE-ID ::= 119 +id-GNB-CU-TNL-Association-To-Add-Item ProtocolIE-ID ::= 120 +id-GNB-CU-TNL-Association-To-Add-List ProtocolIE-ID ::= 121 +id-GNB-CU-TNL-Association-To-Remove-Item ProtocolIE-ID ::= 122 +id-GNB-CU-TNL-Association-To-Remove-List ProtocolIE-ID ::= 123 +id-GNB-CU-TNL-Association-To-Update-Item ProtocolIE-ID ::= 124 +id-GNB-CU-TNL-Association-To-Update-List ProtocolIE-ID ::= 125 +id-MaskedIMEISV ProtocolIE-ID ::= 126 +id-PagingIdentity ProtocolIE-ID ::= 127 +id-DUtoCURRCContainer ProtocolIE-ID ::= 128 +id-Cells-to-be-Barred-List ProtocolIE-ID ::= 129 +id-Cells-to-be-Barred-Item ProtocolIE-ID ::= 130 +id-TAISliceSupportList ProtocolIE-ID ::= 131 +id-GNB-CU-TNL-Association-Setup-List ProtocolIE-ID ::= 132 +id-GNB-CU-TNL-Association-Setup-Item ProtocolIE-ID ::= 133 +id-GNB-CU-TNL-Association-Failed-To-Setup-List ProtocolIE-ID ::= 134 +id-GNB-CU-TNL-Association-Failed-To-Setup-Item ProtocolIE-ID ::= 135 +id-DRB-Notify-Item ProtocolIE-ID ::= 136 +id-DRB-Notify-List ProtocolIE-ID ::= 137 +id-NotficationControl ProtocolIE-ID ::= 138 +id-RANAC ProtocolIE-ID ::= 139 +id-PWSSystemInformation ProtocolIE-ID ::= 140 +id-RepetitionPeriod ProtocolIE-ID ::= 141 +id-NumberofBroadcastRequest ProtocolIE-ID ::= 142 +id-Cells-To-Be-Broadcast-List ProtocolIE-ID ::= 144 +id-Cells-To-Be-Broadcast-Item ProtocolIE-ID ::= 145 +id-Cells-Broadcast-Completed-List ProtocolIE-ID ::= 146 +id-Cells-Broadcast-Completed-Item ProtocolIE-ID ::= 147 +id-Broadcast-To-Be-Cancelled-List ProtocolIE-ID ::= 148 +id-Broadcast-To-Be-Cancelled-Item ProtocolIE-ID ::= 149 +id-Cells-Broadcast-Cancelled-List ProtocolIE-ID ::= 150 +id-Cells-Broadcast-Cancelled-Item ProtocolIE-ID ::= 151 +id-NR-CGI-List-For-Restart-List ProtocolIE-ID ::= 152 +id-NR-CGI-List-For-Restart-Item ProtocolIE-ID ::= 153 +id-PWS-Failed-NR-CGI-List ProtocolIE-ID ::= 154 +id-PWS-Failed-NR-CGI-Item ProtocolIE-ID ::= 155 +id-ConfirmedUEID ProtocolIE-ID ::= 156 +id-Cancel-all-Warning-Messages-Indicator ProtocolIE-ID ::= 157 +id-GNB-DU-UE-AMBR-UL ProtocolIE-ID ::= 158 +id-DRXConfigurationIndicator ProtocolIE-ID ::= 159 +id-RLC-Status ProtocolIE-ID ::= 160 +id-DLPDCPSNLength ProtocolIE-ID ::= 161 +id-GNB-DUConfigurationQuery ProtocolIE-ID ::= 162 +id-MeasurementTimingConfiguration ProtocolIE-ID ::= 163 +id-DRB-Information ProtocolIE-ID ::= 164 +id-ServingPLMN ProtocolIE-ID ::= 165 +id-Protected-EUTRA-Resources-Item ProtocolIE-ID ::= 168 +id-GNB-CU-RRC-Version ProtocolIE-ID ::= 170 +id-GNB-DU-RRC-Version ProtocolIE-ID ::= 171 +id-GNBDUOverloadInformation ProtocolIE-ID ::= 172 +id-CellGroupConfig ProtocolIE-ID ::= 173 +id-RLCFailureIndication ProtocolIE-ID ::= 174 +id-UplinkTxDirectCurrentListInformation ProtocolIE-ID ::= 175 +id-DC-Based-Duplication-Configured ProtocolIE-ID ::= 176 +id-DC-Based-Duplication-Activation ProtocolIE-ID ::= 177 +id-SULAccessIndication ProtocolIE-ID ::= 178 +id-AvailablePLMNList ProtocolIE-ID ::= 179 +id-PDUSessionID ProtocolIE-ID ::= 180 +id-ULPDUSessionAggregateMaximumBitRate ProtocolIE-ID ::= 181 +id-ServingCellMO ProtocolIE-ID ::= 182 +id-QoSFlowMappingIndication ProtocolIE-ID ::= 183 +id-RRCDeliveryStatusRequest ProtocolIE-ID ::= 184 +id-RRCDeliveryStatus ProtocolIE-ID ::= 185 +id-BearerTypeChange ProtocolIE-ID ::= 186 +id-RLCMode ProtocolIE-ID ::= 187 +id-Duplication-Activation ProtocolIE-ID ::= 188 +id-Dedicated-SIDelivery-NeededUE-List ProtocolIE-ID ::= 189 +id-Dedicated-SIDelivery-NeededUE-Item ProtocolIE-ID ::= 190 +id-DRX-LongCycleStartOffset ProtocolIE-ID ::= 191 +id-ULPDCPSNLength ProtocolIE-ID ::= 192 +id-SelectedBandCombinationIndex ProtocolIE-ID ::= 193 +id-SelectedFeatureSetEntryIndex ProtocolIE-ID ::= 194 +id-ResourceCoordinationTransferInformation ProtocolIE-ID ::= 195 +id-ExtendedServedPLMNs-List ProtocolIE-ID ::= 196 +id-ExtendedAvailablePLMN-List ProtocolIE-ID ::= 197 +id-Associated-SCell-List ProtocolIE-ID ::= 198 +id-latest-RRC-Version-Enhanced ProtocolIE-ID ::= 199 +id-Associated-SCell-Item ProtocolIE-ID ::= 200 +id-Cell-Direction ProtocolIE-ID ::= 201 +id-SRBs-Setup-List ProtocolIE-ID ::= 202 +id-SRBs-Setup-Item ProtocolIE-ID ::= 203 +id-SRBs-SetupMod-List ProtocolIE-ID ::= 204 +id-SRBs-SetupMod-Item ProtocolIE-ID ::= 205 +id-SRBs-Modified-List ProtocolIE-ID ::= 206 +id-SRBs-Modified-Item ProtocolIE-ID ::= 207 +id-Ph-InfoSCG ProtocolIE-ID ::= 208 +id-RequestedBandCombinationIndex ProtocolIE-ID ::= 209 +id-RequestedFeatureSetEntryIndex ProtocolIE-ID ::= 210 +id-RequestedP-MaxFR2 ProtocolIE-ID ::= 211 +id-DRX-Config ProtocolIE-ID ::= 212 +id-IgnoreResourceCoordinationContainer ProtocolIE-ID ::= 213 +id-UEAssistanceInformation ProtocolIE-ID ::= 214 +id-NeedforGap ProtocolIE-ID ::= 215 +id-PagingOrigin ProtocolIE-ID ::= 216 +id-new-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 217 +id-RedirectedRRCmessage ProtocolIE-ID ::= 218 +id-new-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 219 +id-NotificationInformation ProtocolIE-ID ::= 220 +id-PLMNAssistanceInfoForNetShar ProtocolIE-ID ::= 221 +id-UEContextNotRetrievable ProtocolIE-ID ::= 222 +id-BPLMN-ID-Info-List ProtocolIE-ID ::= 223 +id-SelectedPLMNID ProtocolIE-ID ::= 224 +id-UAC-Assistance-Info ProtocolIE-ID ::= 225 +id-RANUEID ProtocolIE-ID ::= 226 +id-GNB-DU-TNL-Association-To-Remove-Item ProtocolIE-ID ::= 227 +id-GNB-DU-TNL-Association-To-Remove-List ProtocolIE-ID ::= 228 +id-TNLAssociationTransportLayerAddressgNBDU ProtocolIE-ID ::= 229 +id-portNumber ProtocolIE-ID ::= 230 +id-AdditionalSIBMessageList ProtocolIE-ID ::= 231 +id-Cell-Type ProtocolIE-ID ::= 232 +id-IgnorePRACHConfiguration ProtocolIE-ID ::= 233 +id-CG-Config ProtocolIE-ID ::= 234 +id-PDCCH-BlindDetectionSCG ProtocolIE-ID ::= 235 +id-Requested-PDCCH-BlindDetectionSCG ProtocolIE-ID ::= 236 +id-Ph-InfoMCG ProtocolIE-ID ::= 237 +id-MeasGapSharingConfig ProtocolIE-ID ::= 238 +id-systemInformationAreaID ProtocolIE-ID ::= 239 +id-areaScope ProtocolIE-ID ::= 240 +id-RRCContainer-RRCSetupComplete ProtocolIE-ID ::= 241 +id-TraceActivation ProtocolIE-ID ::= 242 +id-TraceID ProtocolIE-ID ::= 243 +id-Neighbour-Cell-Information-List ProtocolIE-ID ::= 244 +id-SymbolAllocInSlot ProtocolIE-ID ::= 246 +id-NumDLULSymbols ProtocolIE-ID ::= 247 +id-AdditionalRRMPriorityIndex ProtocolIE-ID ::= 248 +id-DUCURadioInformationType ProtocolIE-ID ::= 249 +id-CUDURadioInformationType ProtocolIE-ID ::= 250 +id-AggressorgNBSetID ProtocolIE-ID ::= 251 +id-VictimgNBSetID ProtocolIE-ID ::= 252 +id-LowerLayerPresenceStatusChange ProtocolIE-ID ::= 253 +id-Transport-Layer-Address-Info ProtocolIE-ID ::= 254 +id-Neighbour-Cell-Information-Item ProtocolIE-ID ::= 255 +id-IntendedTDD-DL-ULConfig ProtocolIE-ID ::= 256 +id-QosMonitoringRequest ProtocolIE-ID ::= 257 +id-BHChannels-ToBeSetup-List ProtocolIE-ID ::= 258 +id-BHChannels-ToBeSetup-Item ProtocolIE-ID ::= 259 +id-BHChannels-Setup-List ProtocolIE-ID ::= 260 +id-BHChannels-Setup-Item ProtocolIE-ID ::= 261 +id-BHChannels-ToBeModified-Item ProtocolIE-ID ::= 262 +id-BHChannels-ToBeModified-List ProtocolIE-ID ::= 263 +id-BHChannels-ToBeReleased-Item ProtocolIE-ID ::= 264 +id-BHChannels-ToBeReleased-List ProtocolIE-ID ::= 265 +id-BHChannels-ToBeSetupMod-Item ProtocolIE-ID ::= 266 +id-BHChannels-ToBeSetupMod-List ProtocolIE-ID ::= 267 +id-BHChannels-FailedToBeModified-Item ProtocolIE-ID ::= 268 +id-BHChannels-FailedToBeModified-List ProtocolIE-ID ::= 269 +id-BHChannels-FailedToBeSetupMod-Item ProtocolIE-ID ::= 270 +id-BHChannels-FailedToBeSetupMod-List ProtocolIE-ID ::= 271 +id-BHChannels-Modified-Item ProtocolIE-ID ::= 272 +id-BHChannels-Modified-List ProtocolIE-ID ::= 273 +id-BHChannels-SetupMod-Item ProtocolIE-ID ::= 274 +id-BHChannels-SetupMod-List ProtocolIE-ID ::= 275 +id-BHChannels-Required-ToBeReleased-Item ProtocolIE-ID ::= 276 +id-BHChannels-Required-ToBeReleased-List ProtocolIE-ID ::= 277 +id-BHChannels-FailedToBeSetup-Item ProtocolIE-ID ::= 278 +id-BHChannels-FailedToBeSetup-List ProtocolIE-ID ::= 279 +id-BHInfo ProtocolIE-ID ::= 280 +id-BAPAddress ProtocolIE-ID ::= 281 +id-ConfiguredBAPAddress ProtocolIE-ID ::= 282 +id-BH-Routing-Information-Added-List ProtocolIE-ID ::= 283 +id-BH-Routing-Information-Added-List-Item ProtocolIE-ID ::= 284 +id-BH-Routing-Information-Removed-List ProtocolIE-ID ::= 285 +id-BH-Routing-Information-Removed-List-Item ProtocolIE-ID ::= 286 +id-UL-BH-Non-UP-Traffic-Mapping ProtocolIE-ID ::= 287 +id-Activated-Cells-to-be-Updated-List ProtocolIE-ID ::= 288 +id-Child-Nodes-List ProtocolIE-ID ::= 289 +id-IAB-Info-IAB-DU ProtocolIE-ID ::= 290 +id-IAB-Info-IAB-donor-CU ProtocolIE-ID ::= 291 +id-IAB-TNL-Addresses-To-Remove-List ProtocolIE-ID ::= 292 +id-IAB-TNL-Addresses-To-Remove-Item ProtocolIE-ID ::= 293 +id-IAB-Allocated-TNL-Address-List ProtocolIE-ID ::= 294 +id-IAB-Allocated-TNL-Address-Item ProtocolIE-ID ::= 295 +id-IABIPv6RequestType ProtocolIE-ID ::= 296 +id-IABv4AddressesRequested ProtocolIE-ID ::= 297 +id-IAB-Barred ProtocolIE-ID ::= 298 +id-TrafficMappingInformation ProtocolIE-ID ::= 299 +id-UL-UP-TNL-Information-to-Update-List ProtocolIE-ID ::= 300 +id-UL-UP-TNL-Information-to-Update-List-Item ProtocolIE-ID ::= 301 +id-UL-UP-TNL-Address-to-Update-List ProtocolIE-ID ::= 302 +id-UL-UP-TNL-Address-to-Update-List-Item ProtocolIE-ID ::= 303 +id-DL-UP-TNL-Address-to-Update-List ProtocolIE-ID ::= 304 +id-DL-UP-TNL-Address-to-Update-List-Item ProtocolIE-ID ::= 305 +id-NRV2XServicesAuthorized ProtocolIE-ID ::= 306 +id-LTEV2XServicesAuthorized ProtocolIE-ID ::= 307 +id-NRUESidelinkAggregateMaximumBitrate ProtocolIE-ID ::= 308 +id-LTEUESidelinkAggregateMaximumBitrate ProtocolIE-ID ::= 309 +id-SIB12-message ProtocolIE-ID ::= 310 +id-SIB13-message ProtocolIE-ID ::= 311 +id-SIB14-message ProtocolIE-ID ::= 312 +id-SLDRBs-FailedToBeModified-Item ProtocolIE-ID ::= 313 +id-SLDRBs-FailedToBeModified-List ProtocolIE-ID ::= 314 +id-SLDRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 315 +id-SLDRBs-FailedToBeSetup-List ProtocolIE-ID ::= 316 +id-SLDRBs-Modified-Item ProtocolIE-ID ::= 317 +id-SLDRBs-Modified-List ProtocolIE-ID ::= 318 +id-SLDRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 319 +id-SLDRBs-Required-ToBeModified-List ProtocolIE-ID ::= 320 +id-SLDRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 321 +id-SLDRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 322 +id-SLDRBs-Setup-Item ProtocolIE-ID ::= 323 +id-SLDRBs-Setup-List ProtocolIE-ID ::= 324 +id-SLDRBs-ToBeModified-Item ProtocolIE-ID ::= 325 +id-SLDRBs-ToBeModified-List ProtocolIE-ID ::= 326 +id-SLDRBs-ToBeReleased-Item ProtocolIE-ID ::= 327 +id-SLDRBs-ToBeReleased-List ProtocolIE-ID ::= 328 +id-SLDRBs-ToBeSetup-Item ProtocolIE-ID ::= 329 +id-SLDRBs-ToBeSetup-List ProtocolIE-ID ::= 330 +id-SLDRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 331 +id-SLDRBs-ToBeSetupMod-List ProtocolIE-ID ::= 332 +id-SLDRBs-SetupMod-List ProtocolIE-ID ::= 333 +id-SLDRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 334 +id-SLDRBs-SetupMod-Item ProtocolIE-ID ::= 335 +id-SLDRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 336 +id-SLDRBs-ModifiedConf-List ProtocolIE-ID ::= 337 +id-SLDRBs-ModifiedConf-Item ProtocolIE-ID ::= 338 +id-UEAssistanceInformationEUTRA ProtocolIE-ID ::= 339 +id-PC5LinkAMBR ProtocolIE-ID ::= 340 +id-SL-PHY-MAC-RLC-Config ProtocolIE-ID ::= 341 +id-SL-ConfigDedicatedEUTRA ProtocolIE-ID ::= 342 +id-AlternativeQoSParaSetList ProtocolIE-ID ::= 343 +id-CurrentQoSParaSetIndex ProtocolIE-ID ::= 344 +id-gNBCUMeasurementID ProtocolIE-ID ::= 345 +id-gNBDUMeasurementID ProtocolIE-ID ::= 346 +id-RegistrationRequest ProtocolIE-ID ::= 347 +id-ReportCharacteristics ProtocolIE-ID ::= 348 +id-CellToReportList ProtocolIE-ID ::= 349 +id-CellMeasurementResultList ProtocolIE-ID ::= 350 +id-HardwareLoadIndicator ProtocolIE-ID ::= 351 +id-ReportingPeriodicity ProtocolIE-ID ::= 352 +id-TNLCapacityIndicator ProtocolIE-ID ::= 353 +id-CarrierList ProtocolIE-ID ::= 354 +id-ULCarrierList ProtocolIE-ID ::= 355 +id-FrequencyShift7p5khz ProtocolIE-ID ::= 356 +id-SSB-PositionsInBurst ProtocolIE-ID ::= 357 +id-NRPRACHConfig ProtocolIE-ID ::= 358 +id-RACHReportInformationList ProtocolIE-ID ::= 359 +id-RLFReportInformationList ProtocolIE-ID ::= 360 +id-TDD-UL-DLConfigCommonNR ProtocolIE-ID ::= 361 +id-CNPacketDelayBudgetDownlink ProtocolIE-ID ::= 362 +id-ExtendedPacketDelayBudget ProtocolIE-ID ::= 363 +id-TSCTrafficCharacteristics ProtocolIE-ID ::= 364 +id-ReportingRequestType ProtocolIE-ID ::= 365 +id-TimeReferenceInformation ProtocolIE-ID ::= 366 +id-CNPacketDelayBudgetUplink ProtocolIE-ID ::= 369 +id-AdditionalPDCPDuplicationTNL-List ProtocolIE-ID ::= 370 +id-RLCDuplicationInformation ProtocolIE-ID ::= 371 +id-AdditionalDuplicationIndication ProtocolIE-ID ::= 372 +id-ConditionalInterDUMobilityInformation ProtocolIE-ID ::= 373 +id-ConditionalIntraDUMobilityInformation ProtocolIE-ID ::= 374 +id-targetCellsToCancel ProtocolIE-ID ::= 375 +id-requestedTargetCellGlobalID ProtocolIE-ID ::= 376 +id-ManagementBasedMDTPLMNList ProtocolIE-ID ::= 377 +id-TraceCollectionEntityIPAddress ProtocolIE-ID ::= 378 +id-PrivacyIndicator ProtocolIE-ID ::= 379 +id-TraceCollectionEntityURI ProtocolIE-ID ::= 380 +id-mdtConfiguration ProtocolIE-ID ::= 381 +id-ServingNID ProtocolIE-ID ::= 382 +id-NPNBroadcastInformation ProtocolIE-ID ::= 383 +id-NPNSupportInfo ProtocolIE-ID ::= 384 +id-NID ProtocolIE-ID ::= 385 +id-AvailableSNPN-ID-List ProtocolIE-ID ::= 386 +id-SIB10-message ProtocolIE-ID ::= 387 +id-DLCarrierList ProtocolIE-ID ::= 389 + id-ExtendedTAISliceSupportList ProtocolIE-ID ::= 390 +id-RequestedSRSTransmissionCharacteristics ProtocolIE-ID ::= 391 +id-PosAssistance-Information ProtocolIE-ID ::= 392 +id-PosBroadcast ProtocolIE-ID ::= 393 +id-RoutingID ProtocolIE-ID ::= 394 +id-PosAssistanceInformationFailureList ProtocolIE-ID ::= 395 +id-PosMeasurementQuantities ProtocolIE-ID ::= 396 +id-PosMeasurementResultList ProtocolIE-ID ::= 397 +id-TRPInformationTypeListTRPReq ProtocolIE-ID ::= 398 +id-TRPInformationTypeItem ProtocolIE-ID ::= 399 +id-TRPInformationListTRPResp ProtocolIE-ID ::= 400 +id-TRPInformationItem ProtocolIE-ID ::= 401 +id-LMF-MeasurementID ProtocolIE-ID ::= 402 +id-SRSType ProtocolIE-ID ::= 403 +id-ActivationTime ProtocolIE-ID ::= 404 +id-AbortTransmission ProtocolIE-ID ::= 405 +id-PositioningBroadcastCells ProtocolIE-ID ::= 406 +id-SRSConfiguration ProtocolIE-ID ::= 407 +id-PosReportCharacteristics ProtocolIE-ID ::= 408 +id-PosMeasurementPeriodicity ProtocolIE-ID ::= 409 +id-TRPList ProtocolIE-ID ::= 410 +id-RAN-MeasurementID ProtocolIE-ID ::= 411 +id-LMF-UE-MeasurementID ProtocolIE-ID ::= 412 +id-RAN-UE-MeasurementID ProtocolIE-ID ::= 413 +id-E-CID-MeasurementQuantities ProtocolIE-ID ::= 414 +id-E-CID-MeasurementQuantities-Item ProtocolIE-ID ::= 415 +id-E-CID-MeasurementPeriodicity ProtocolIE-ID ::= 416 +id-E-CID-MeasurementResult ProtocolIE-ID ::= 417 +id-Cell-Portion-ID ProtocolIE-ID ::= 418 +id-SFNInitialisationTime ProtocolIE-ID ::= 419 +id-SystemFrameNumber ProtocolIE-ID ::= 420 +id-SlotNumber ProtocolIE-ID ::= 421 +id-TRP-MeasurementRequestList ProtocolIE-ID ::= 422 +id-MeasurementBeamInfoRequest ProtocolIE-ID ::= 423 +id-E-CID-ReportCharacteristics ProtocolIE-ID ::= 424 +id-ConfiguredTACIndication ProtocolIE-ID ::= 425 +id-Extended-GNB-DU-Name ProtocolIE-ID ::= 426 +id-Extended-GNB-CU-Name ProtocolIE-ID ::= 427 + + +END +-- ASN1STOP + +-- ASN1START +-- ************************************************************** +-- +-- Container definitions +-- +-- ************************************************************** + +F1AP-Containers { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Containers (5) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + Presence, + PrivateIE-ID, + ProtocolExtensionID, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes + maxPrivateIEs, + maxProtocolExtensions, + maxProtocolIEs + +FROM F1AP-Constants; + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES-PAIR ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &firstCriticality Criticality, + &FirstValue, + &secondCriticality Criticality, + &SecondValue, + &presence Presence +} +WITH SYNTAX { + ID &id + FIRST CRITICALITY &firstCriticality + FIRST TYPE &FirstValue + SECOND CRITICALITY &secondCriticality + SECOND TYPE &SecondValue + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol Extensions +-- +-- ************************************************************** + +F1AP-PROTOCOL-EXTENSION ::= CLASS { + &id ProtocolExtensionID UNIQUE, + &criticality Criticality, + &Extension, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + EXTENSION &Extension + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Private IEs +-- +-- ************************************************************** + +F1AP-PRIVATE-IES ::= CLASS { + &id PrivateIE-ID, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Container for Protocol IEs +-- +-- ************************************************************** + +ProtocolIE-Container {F1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-SingleContainer {F1AP-PROTOCOL-IES : IEsSetParam} ::= + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Field {F1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES.&id ({IEsSetParam}), + criticality F1AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol IE Pairs +-- +-- ************************************************************** + +ProtocolIE-ContainerPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-FieldPair {{IEsSetParam}} + +ProtocolIE-FieldPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), + firstCriticality F1AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), + firstValue F1AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), + secondCriticality F1AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), + secondValue F1AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol Extensions +-- +-- ************************************************************** + +ProtocolExtensionContainer {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= + SEQUENCE (SIZE (1..maxProtocolExtensions)) OF + ProtocolExtensionField {{ExtensionSetParam}} + +ProtocolExtensionField {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}), + criticality F1AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}), + extensionValue F1AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Private IEs +-- +-- ************************************************************** + +PrivateIE-Container {F1AP-PRIVATE-IES : IEsSetParam } ::= + SEQUENCE (SIZE (1.. maxPrivateIEs)) OF + PrivateIE-Field {{IEsSetParam}} + +PrivateIE-Field {F1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PRIVATE-IES.&id ({IEsSetParam}), + criticality F1AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) +} + +END +-- ASN1STOP diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-CommonDataTypes.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-CommonDataTypes.asn new file mode 100644 index 0000000000..da3092376e --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-CommonDataTypes.asn @@ -0,0 +1,32 @@ +-- ************************************************************** +-- +-- Common definitions +-- +-- ************************************************************** + +F1AP-CommonDataTypes { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-CommonDataTypes (3) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +Criticality ::= ENUMERATED { reject, ignore, notify } + +Presence ::= ENUMERATED { optional, conditional, mandatory } + +PrivateIE-ID ::= CHOICE { + local INTEGER (0..65535), + global OBJECT IDENTIFIER +} + +ProcedureCode ::= INTEGER (0..255) + +ProtocolExtensionID ::= INTEGER (0..65535) + +ProtocolIE-ID ::= INTEGER (0..65535) + +TriggeringMessage ::= ENUMERATED { initiating-message, successful-outcome, unsuccessful-outcome } + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Constants.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Constants.asn new file mode 100644 index 0000000000..9b5a3dd624 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Constants.asn @@ -0,0 +1,622 @@ +-- ************************************************************** +-- +-- Constant definitions +-- +-- ************************************************************** + +F1AP-Constants { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Constants (4) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + ProcedureCode, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes; + + +-- ************************************************************** +-- +-- Elementary Procedures +-- +-- ************************************************************** + +id-Reset ProcedureCode ::= 0 +id-F1Setup ProcedureCode ::= 1 +id-ErrorIndication ProcedureCode ::= 2 +id-gNBDUConfigurationUpdate ProcedureCode ::= 3 +id-gNBCUConfigurationUpdate ProcedureCode ::= 4 +id-UEContextSetup ProcedureCode ::= 5 +id-UEContextRelease ProcedureCode ::= 6 +id-UEContextModification ProcedureCode ::= 7 +id-UEContextModificationRequired ProcedureCode ::= 8 +id-UEMobilityCommand ProcedureCode ::= 9 +id-UEContextReleaseRequest ProcedureCode ::= 10 +id-InitialULRRCMessageTransfer ProcedureCode ::= 11 +id-DLRRCMessageTransfer ProcedureCode ::= 12 +id-ULRRCMessageTransfer ProcedureCode ::= 13 +id-privateMessage ProcedureCode ::= 14 +id-UEInactivityNotification ProcedureCode ::= 15 +id-GNBDUResourceCoordination ProcedureCode ::= 16 +id-SystemInformationDeliveryCommand ProcedureCode ::= 17 +id-Paging ProcedureCode ::= 18 +id-Notify ProcedureCode ::= 19 +id-WriteReplaceWarning ProcedureCode ::= 20 +id-PWSCancel ProcedureCode ::= 21 +id-PWSRestartIndication ProcedureCode ::= 22 +id-PWSFailureIndication ProcedureCode ::= 23 +id-GNBDUStatusIndication ProcedureCode ::= 24 +id-RRCDeliveryReport ProcedureCode ::= 25 +id-F1Removal ProcedureCode ::= 26 +id-NetworkAccessRateReduction ProcedureCode ::= 27 +id-TraceStart ProcedureCode ::= 28 +id-DeactivateTrace ProcedureCode ::= 29 +id-DUCURadioInformationTransfer ProcedureCode ::= 30 +id-CUDURadioInformationTransfer ProcedureCode ::= 31 +id-BAPMappingConfiguration ProcedureCode ::= 32 +id-GNBDUResourceConfiguration ProcedureCode ::= 33 +id-IABTNLAddressAllocation ProcedureCode ::= 34 +id-IABUPConfigurationUpdate ProcedureCode ::= 35 +id-resourceStatusReportingInitiation ProcedureCode ::= 36 +id-resourceStatusReporting ProcedureCode ::= 37 +id-accessAndMobilityIndication ProcedureCode ::= 38 +id-accessSuccess ProcedureCode ::= 39 +id-cellTrafficTrace ProcedureCode ::= 40 +id-PositioningMeasurementExchange ProcedureCode ::= 41 +id-PositioningAssistanceInformationControl ProcedureCode ::= 42 +id-PositioningAssistanceInformationFeedback ProcedureCode ::= 43 +id-PositioningMeasurementReport ProcedureCode ::= 44 +id-PositioningMeasurementAbort ProcedureCode ::= 45 +id-PositioningMeasurementFailureIndication ProcedureCode ::= 46 +id-PositioningMeasurementUpdate ProcedureCode ::= 47 +id-TRPInformationExchange ProcedureCode ::= 48 +id-PositioningInformationExchange ProcedureCode ::= 49 +id-PositioningActivation ProcedureCode ::= 50 +id-PositioningDeactivation ProcedureCode ::= 51 +id-E-CIDMeasurementInitiation ProcedureCode ::= 52 +id-E-CIDMeasurementFailureIndication ProcedureCode ::= 53 +id-E-CIDMeasurementReport ProcedureCode ::= 54 +id-E-CIDMeasurementTermination ProcedureCode ::= 55 +id-PositioningInformationUpdate ProcedureCode ::= 56 +id-ReferenceTimeInformationReport ProcedureCode ::= 57 +id-ReferenceTimeInformationReportingControl ProcedureCode ::= 58 + + + +-- ************************************************************** +-- +-- Extension constants +-- +-- ************************************************************** + +maxPrivateIEs INTEGER ::= 65535 +maxProtocolExtensions INTEGER ::= 65535 +maxProtocolIEs INTEGER ::= 65535 +-- ************************************************************** +-- +-- Lists +-- +-- ************************************************************** + +maxNRARFCN INTEGER ::= 3279165 +maxnoofErrors INTEGER ::= 256 +maxnoofIndividualF1ConnectionsToReset INTEGER ::= 65536 +maxCellingNBDU INTEGER ::= 512 +maxnoofSCells INTEGER ::= 32 +maxnoofSRBs INTEGER ::= 8 +maxnoofDRBs INTEGER ::= 64 +maxnoofULUPTNLInformation INTEGER ::= 2 +maxnoofDLUPTNLInformation INTEGER ::= 2 +maxnoofBPLMNs INTEGER ::= 6 +maxnoofCandidateSpCells INTEGER ::= 64 +maxnoofPotentialSpCells INTEGER ::= 64 +maxnoofNrCellBands INTEGER ::= 32 +maxnoofSIBTypes INTEGER ::= 32 +maxnoofSITypes INTEGER ::= 32 +maxnoofPagingCells INTEGER ::= 512 +maxnoofTNLAssociations INTEGER ::= 32 +maxnoofQoSFlows INTEGER ::= 64 +maxnoofSliceItems INTEGER ::= 1024 +maxCellineNB INTEGER ::= 256 +maxnoofExtendedBPLMNs INTEGER ::= 6 +maxnoofUEIDs INTEGER ::= 65536 +maxnoofBPLMNsNR INTEGER ::= 12 +maxnoofUACPLMNs INTEGER ::= 12 +maxnoofUACperPLMN INTEGER ::= 64 +maxnoofAdditionalSIBs INTEGER ::= 63 +maxnoofslots INTEGER ::= 5120 +maxnoofTLAs INTEGER ::= 16 +maxnoofGTPTLAs INTEGER ::= 16 +maxnoofBHRLCChannels INTEGER ::= 65536 +maxnoofRoutingEntries INTEGER ::= 1024 +maxnoofIABSTCInfo INTEGER ::= 45 +maxnoofSymbols INTEGER ::= 14 +maxnoofServingCells INTEGER ::= 32 +maxnoofDUFSlots INTEGER ::= 320 +maxnoofHSNASlots INTEGER ::= 5120 +maxnoofServedCellsIAB INTEGER ::= 512 +maxnoofChildIABNodes INTEGER ::= 1024 +maxnoofNonUPTrafficMappings INTEGER ::= 32 +maxnoofTLAsIAB INTEGER ::= 1024 +maxnoofMappingEntries INTEGER ::= 67108864 +maxnoofDSInfo INTEGER ::= 64 +maxnoofEgressLinks INTEGER ::= 2 +maxnoofULUPTNLInformationforIAB INTEGER ::= 32678 +maxnoofUPTNLAddresses INTEGER ::= 8 +maxnoofSLDRBs INTEGER ::= 512 +maxnoofQoSParaSets INTEGER ::= 8 +maxnoofPC5QoSFlows INTEGER ::= 2048 +maxnoofSSBAreas INTEGER ::= 64 +maxnoofPhysicalResourceBlocks INTEGER ::= 275 +maxnoofPhysicalResourceBlocks-1 INTEGER ::= 274 +maxnoofPRACHconfigs INTEGER ::= 16 +maxnoofRACHReports INTEGER ::= 64 +maxnoofRLFReports INTEGER ::= 64 +maxnoofAdditionalPDCPDuplicationTNL INTEGER ::= 2 +maxnoofRLCDuplicationState INTEGER ::= 3 +maxnoofCHOcells INTEGER ::= 8 +maxnoofMDTPLMNs INTEGER ::= 16 +maxnoofCAGsupported INTEGER ::= 12 +maxnoofNIDsupported INTEGER ::= 12 +maxnoofNRSCSs INTEGER ::= 5 +maxnoofExtSliceItems INTEGER ::= 65535 +maxnoofPosMeas INTEGER ::= 16384 +maxnoofTRPInfoTypes INTEGER ::= 64 +maxnoofTRPs INTEGER ::= 65535 +maxnoofSRSTriggerStates INTEGER ::= 3 +maxnoofSpatialRelations INTEGER ::= 64 +maxnoBcastCell INTEGER ::= 16384 +maxnoofAngleInfo INTEGER ::= 65535 +maxnooflcs-gcs-translation INTEGER ::= 3 +maxnoofPath INTEGER ::= 2 +maxnoofMeasE-CID INTEGER ::= 64 +maxnoofSSBs INTEGER ::= 255 +maxnoSRS-ResourceSets INTEGER ::= 16 +maxnoSRS-ResourcePerSet INTEGER ::= 16 +maxnoSRS-Carriers INTEGER ::= 32 +maxnoSCSs INTEGER ::= 5 +maxnoSRS-Resources INTEGER ::= 64 +maxnoSRS-PosResources INTEGER ::= 64 +maxnoSRS-PosResourceSets INTEGER ::= 16 +maxnoSRS-PosResourcePerSet INTEGER ::= 16 +maxnoofPRS-ResourceSets INTEGER ::= 2 +maxnoofPRS-ResourcesPerSet INTEGER ::= 64 +maxNoOfMeasTRPs INTEGER ::= 64 +maxnoofPRSresourceSets INTEGER ::= 8 +maxnoofPRSresources INTEGER ::= 64 + + + +-- ************************************************************** +-- +-- IEs +-- +-- ************************************************************** + +id-Cause ProtocolIE-ID ::= 0 +id-Cells-Failed-to-be-Activated-List ProtocolIE-ID ::= 1 +id-Cells-Failed-to-be-Activated-List-Item ProtocolIE-ID ::= 2 +id-Cells-to-be-Activated-List ProtocolIE-ID ::= 3 +id-Cells-to-be-Activated-List-Item ProtocolIE-ID ::= 4 +id-Cells-to-be-Deactivated-List ProtocolIE-ID ::= 5 +id-Cells-to-be-Deactivated-List-Item ProtocolIE-ID ::= 6 +id-CriticalityDiagnostics ProtocolIE-ID ::= 7 +id-CUtoDURRCInformation ProtocolIE-ID ::= 9 +id-DRBs-FailedToBeModified-Item ProtocolIE-ID ::= 12 +id-DRBs-FailedToBeModified-List ProtocolIE-ID ::= 13 +id-DRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 14 +id-DRBs-FailedToBeSetup-List ProtocolIE-ID ::= 15 +id-DRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 16 +id-DRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 17 +id-DRBs-ModifiedConf-Item ProtocolIE-ID ::= 18 +id-DRBs-ModifiedConf-List ProtocolIE-ID ::= 19 +id-DRBs-Modified-Item ProtocolIE-ID ::= 20 +id-DRBs-Modified-List ProtocolIE-ID ::= 21 +id-DRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 22 +id-DRBs-Required-ToBeModified-List ProtocolIE-ID ::= 23 +id-DRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 24 +id-DRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 25 +id-DRBs-Setup-Item ProtocolIE-ID ::= 26 +id-DRBs-Setup-List ProtocolIE-ID ::= 27 +id-DRBs-SetupMod-Item ProtocolIE-ID ::= 28 +id-DRBs-SetupMod-List ProtocolIE-ID ::= 29 +id-DRBs-ToBeModified-Item ProtocolIE-ID ::= 30 +id-DRBs-ToBeModified-List ProtocolIE-ID ::= 31 +id-DRBs-ToBeReleased-Item ProtocolIE-ID ::= 32 +id-DRBs-ToBeReleased-List ProtocolIE-ID ::= 33 +id-DRBs-ToBeSetup-Item ProtocolIE-ID ::= 34 +id-DRBs-ToBeSetup-List ProtocolIE-ID ::= 35 +id-DRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 36 +id-DRBs-ToBeSetupMod-List ProtocolIE-ID ::= 37 +id-DRXCycle ProtocolIE-ID ::= 38 +id-DUtoCURRCInformation ProtocolIE-ID ::= 39 +id-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 40 +id-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 41 +id-gNB-DU-ID ProtocolIE-ID ::= 42 +id-GNB-DU-Served-Cells-Item ProtocolIE-ID ::= 43 +id-gNB-DU-Served-Cells-List ProtocolIE-ID ::= 44 +id-gNB-DU-Name ProtocolIE-ID ::= 45 +id-NRCellID ProtocolIE-ID ::= 46 +id-oldgNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 47 +id-ResetType ProtocolIE-ID ::= 48 +id-ResourceCoordinationTransferContainer ProtocolIE-ID ::= 49 +id-RRCContainer ProtocolIE-ID ::= 50 +id-SCell-ToBeRemoved-Item ProtocolIE-ID ::= 51 +id-SCell-ToBeRemoved-List ProtocolIE-ID ::= 52 +id-SCell-ToBeSetup-Item ProtocolIE-ID ::= 53 +id-SCell-ToBeSetup-List ProtocolIE-ID ::= 54 +id-SCell-ToBeSetupMod-Item ProtocolIE-ID ::= 55 +id-SCell-ToBeSetupMod-List ProtocolIE-ID ::= 56 +id-Served-Cells-To-Add-Item ProtocolIE-ID ::= 57 +id-Served-Cells-To-Add-List ProtocolIE-ID ::= 58 +id-Served-Cells-To-Delete-Item ProtocolIE-ID ::= 59 +id-Served-Cells-To-Delete-List ProtocolIE-ID ::= 60 +id-Served-Cells-To-Modify-Item ProtocolIE-ID ::= 61 +id-Served-Cells-To-Modify-List ProtocolIE-ID ::= 62 +id-SpCell-ID ProtocolIE-ID ::= 63 +id-SRBID ProtocolIE-ID ::= 64 +id-SRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 65 +id-SRBs-FailedToBeSetup-List ProtocolIE-ID ::= 66 +id-SRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 67 +id-SRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 68 +id-SRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 69 +id-SRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 70 +id-SRBs-ToBeReleased-Item ProtocolIE-ID ::= 71 +id-SRBs-ToBeReleased-List ProtocolIE-ID ::= 72 +id-SRBs-ToBeSetup-Item ProtocolIE-ID ::= 73 +id-SRBs-ToBeSetup-List ProtocolIE-ID ::= 74 +id-SRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 75 +id-SRBs-ToBeSetupMod-List ProtocolIE-ID ::= 76 +id-TimeToWait ProtocolIE-ID ::= 77 +id-TransactionID ProtocolIE-ID ::= 78 +id-TransmissionActionIndicator ProtocolIE-ID ::= 79 +id-UE-associatedLogicalF1-ConnectionItem ProtocolIE-ID ::= 80 +id-UE-associatedLogicalF1-ConnectionListResAck ProtocolIE-ID ::= 81 +id-gNB-CU-Name ProtocolIE-ID ::= 82 +id-SCell-FailedtoSetup-List ProtocolIE-ID ::= 83 +id-SCell-FailedtoSetup-Item ProtocolIE-ID ::= 84 +id-SCell-FailedtoSetupMod-List ProtocolIE-ID ::= 85 +id-SCell-FailedtoSetupMod-Item ProtocolIE-ID ::= 86 +id-RRCReconfigurationCompleteIndicator ProtocolIE-ID ::= 87 +id-Cells-Status-Item ProtocolIE-ID ::= 88 +id-Cells-Status-List ProtocolIE-ID ::= 89 +id-Candidate-SpCell-List ProtocolIE-ID ::= 90 +id-Candidate-SpCell-Item ProtocolIE-ID ::= 91 +id-Potential-SpCell-List ProtocolIE-ID ::= 92 +id-Potential-SpCell-Item ProtocolIE-ID ::= 93 +id-FullConfiguration ProtocolIE-ID ::= 94 +id-C-RNTI ProtocolIE-ID ::= 95 +id-SpCellULConfigured ProtocolIE-ID ::= 96 +id-InactivityMonitoringRequest ProtocolIE-ID ::= 97 +id-InactivityMonitoringResponse ProtocolIE-ID ::= 98 +id-DRB-Activity-Item ProtocolIE-ID ::= 99 +id-DRB-Activity-List ProtocolIE-ID ::= 100 +id-EUTRA-NR-CellResourceCoordinationReq-Container ProtocolIE-ID ::= 101 +id-EUTRA-NR-CellResourceCoordinationReqAck-Container ProtocolIE-ID ::= 102 +id-Protected-EUTRA-Resources-List ProtocolIE-ID ::= 105 +id-RequestType ProtocolIE-ID ::= 106 +id-ServCellIndex ProtocolIE-ID ::= 107 +id-RAT-FrequencyPriorityInformation ProtocolIE-ID ::= 108 +id-ExecuteDuplication ProtocolIE-ID ::= 109 +id-NRCGI ProtocolIE-ID ::= 111 +id-PagingCell-Item ProtocolIE-ID ::= 112 +id-PagingCell-List ProtocolIE-ID ::= 113 +id-PagingDRX ProtocolIE-ID ::= 114 +id-PagingPriority ProtocolIE-ID ::= 115 +id-SItype-List ProtocolIE-ID ::= 116 +id-UEIdentityIndexValue ProtocolIE-ID ::= 117 +id-gNB-CUSystemInformation ProtocolIE-ID ::= 118 +id-HandoverPreparationInformation ProtocolIE-ID ::= 119 +id-GNB-CU-TNL-Association-To-Add-Item ProtocolIE-ID ::= 120 +id-GNB-CU-TNL-Association-To-Add-List ProtocolIE-ID ::= 121 +id-GNB-CU-TNL-Association-To-Remove-Item ProtocolIE-ID ::= 122 +id-GNB-CU-TNL-Association-To-Remove-List ProtocolIE-ID ::= 123 +id-GNB-CU-TNL-Association-To-Update-Item ProtocolIE-ID ::= 124 +id-GNB-CU-TNL-Association-To-Update-List ProtocolIE-ID ::= 125 +id-MaskedIMEISV ProtocolIE-ID ::= 126 +id-PagingIdentity ProtocolIE-ID ::= 127 +id-DUtoCURRCContainer ProtocolIE-ID ::= 128 +id-Cells-to-be-Barred-List ProtocolIE-ID ::= 129 +id-Cells-to-be-Barred-Item ProtocolIE-ID ::= 130 +id-TAISliceSupportList ProtocolIE-ID ::= 131 +id-GNB-CU-TNL-Association-Setup-List ProtocolIE-ID ::= 132 +id-GNB-CU-TNL-Association-Setup-Item ProtocolIE-ID ::= 133 +id-GNB-CU-TNL-Association-Failed-To-Setup-List ProtocolIE-ID ::= 134 +id-GNB-CU-TNL-Association-Failed-To-Setup-Item ProtocolIE-ID ::= 135 +id-DRB-Notify-Item ProtocolIE-ID ::= 136 +id-DRB-Notify-List ProtocolIE-ID ::= 137 +id-NotficationControl ProtocolIE-ID ::= 138 +id-RANAC ProtocolIE-ID ::= 139 +id-PWSSystemInformation ProtocolIE-ID ::= 140 +id-RepetitionPeriod ProtocolIE-ID ::= 141 +id-NumberofBroadcastRequest ProtocolIE-ID ::= 142 +id-Cells-To-Be-Broadcast-List ProtocolIE-ID ::= 144 +id-Cells-To-Be-Broadcast-Item ProtocolIE-ID ::= 145 +id-Cells-Broadcast-Completed-List ProtocolIE-ID ::= 146 +id-Cells-Broadcast-Completed-Item ProtocolIE-ID ::= 147 +id-Broadcast-To-Be-Cancelled-List ProtocolIE-ID ::= 148 +id-Broadcast-To-Be-Cancelled-Item ProtocolIE-ID ::= 149 +id-Cells-Broadcast-Cancelled-List ProtocolIE-ID ::= 150 +id-Cells-Broadcast-Cancelled-Item ProtocolIE-ID ::= 151 +id-NR-CGI-List-For-Restart-List ProtocolIE-ID ::= 152 +id-NR-CGI-List-For-Restart-Item ProtocolIE-ID ::= 153 +id-PWS-Failed-NR-CGI-List ProtocolIE-ID ::= 154 +id-PWS-Failed-NR-CGI-Item ProtocolIE-ID ::= 155 +id-ConfirmedUEID ProtocolIE-ID ::= 156 +id-Cancel-all-Warning-Messages-Indicator ProtocolIE-ID ::= 157 +id-GNB-DU-UE-AMBR-UL ProtocolIE-ID ::= 158 +id-DRXConfigurationIndicator ProtocolIE-ID ::= 159 +id-RLC-Status ProtocolIE-ID ::= 160 +id-DLPDCPSNLength ProtocolIE-ID ::= 161 +id-GNB-DUConfigurationQuery ProtocolIE-ID ::= 162 +id-MeasurementTimingConfiguration ProtocolIE-ID ::= 163 +id-DRB-Information ProtocolIE-ID ::= 164 +id-ServingPLMN ProtocolIE-ID ::= 165 +id-Protected-EUTRA-Resources-Item ProtocolIE-ID ::= 168 +id-GNB-CU-RRC-Version ProtocolIE-ID ::= 170 +id-GNB-DU-RRC-Version ProtocolIE-ID ::= 171 +id-GNBDUOverloadInformation ProtocolIE-ID ::= 172 +id-CellGroupConfig ProtocolIE-ID ::= 173 +id-RLCFailureIndication ProtocolIE-ID ::= 174 +id-UplinkTxDirectCurrentListInformation ProtocolIE-ID ::= 175 +id-DC-Based-Duplication-Configured ProtocolIE-ID ::= 176 +id-DC-Based-Duplication-Activation ProtocolIE-ID ::= 177 +id-SULAccessIndication ProtocolIE-ID ::= 178 +id-AvailablePLMNList ProtocolIE-ID ::= 179 +id-PDUSessionID ProtocolIE-ID ::= 180 +id-ULPDUSessionAggregateMaximumBitRate ProtocolIE-ID ::= 181 +id-ServingCellMO ProtocolIE-ID ::= 182 +id-QoSFlowMappingIndication ProtocolIE-ID ::= 183 +id-RRCDeliveryStatusRequest ProtocolIE-ID ::= 184 +id-RRCDeliveryStatus ProtocolIE-ID ::= 185 +id-BearerTypeChange ProtocolIE-ID ::= 186 +id-RLCMode ProtocolIE-ID ::= 187 +id-Duplication-Activation ProtocolIE-ID ::= 188 +id-Dedicated-SIDelivery-NeededUE-List ProtocolIE-ID ::= 189 +id-Dedicated-SIDelivery-NeededUE-Item ProtocolIE-ID ::= 190 +id-DRX-LongCycleStartOffset ProtocolIE-ID ::= 191 +id-ULPDCPSNLength ProtocolIE-ID ::= 192 +id-SelectedBandCombinationIndex ProtocolIE-ID ::= 193 +id-SelectedFeatureSetEntryIndex ProtocolIE-ID ::= 194 +id-ResourceCoordinationTransferInformation ProtocolIE-ID ::= 195 +id-ExtendedServedPLMNs-List ProtocolIE-ID ::= 196 +id-ExtendedAvailablePLMN-List ProtocolIE-ID ::= 197 +id-Associated-SCell-List ProtocolIE-ID ::= 198 +id-latest-RRC-Version-Enhanced ProtocolIE-ID ::= 199 +id-Associated-SCell-Item ProtocolIE-ID ::= 200 +id-Cell-Direction ProtocolIE-ID ::= 201 +id-SRBs-Setup-List ProtocolIE-ID ::= 202 +id-SRBs-Setup-Item ProtocolIE-ID ::= 203 +id-SRBs-SetupMod-List ProtocolIE-ID ::= 204 +id-SRBs-SetupMod-Item ProtocolIE-ID ::= 205 +id-SRBs-Modified-List ProtocolIE-ID ::= 206 +id-SRBs-Modified-Item ProtocolIE-ID ::= 207 +id-Ph-InfoSCG ProtocolIE-ID ::= 208 +id-RequestedBandCombinationIndex ProtocolIE-ID ::= 209 +id-RequestedFeatureSetEntryIndex ProtocolIE-ID ::= 210 +id-RequestedP-MaxFR2 ProtocolIE-ID ::= 211 +id-DRX-Config ProtocolIE-ID ::= 212 +id-IgnoreResourceCoordinationContainer ProtocolIE-ID ::= 213 +id-UEAssistanceInformation ProtocolIE-ID ::= 214 +id-NeedforGap ProtocolIE-ID ::= 215 +id-PagingOrigin ProtocolIE-ID ::= 216 +id-new-gNB-CU-UE-F1AP-ID ProtocolIE-ID ::= 217 +id-RedirectedRRCmessage ProtocolIE-ID ::= 218 +id-new-gNB-DU-UE-F1AP-ID ProtocolIE-ID ::= 219 +id-NotificationInformation ProtocolIE-ID ::= 220 +id-PLMNAssistanceInfoForNetShar ProtocolIE-ID ::= 221 +id-UEContextNotRetrievable ProtocolIE-ID ::= 222 +id-BPLMN-ID-Info-List ProtocolIE-ID ::= 223 +id-SelectedPLMNID ProtocolIE-ID ::= 224 +id-UAC-Assistance-Info ProtocolIE-ID ::= 225 +id-RANUEID ProtocolIE-ID ::= 226 +id-GNB-DU-TNL-Association-To-Remove-Item ProtocolIE-ID ::= 227 +id-GNB-DU-TNL-Association-To-Remove-List ProtocolIE-ID ::= 228 +id-TNLAssociationTransportLayerAddressgNBDU ProtocolIE-ID ::= 229 +id-portNumber ProtocolIE-ID ::= 230 +id-AdditionalSIBMessageList ProtocolIE-ID ::= 231 +id-Cell-Type ProtocolIE-ID ::= 232 +id-IgnorePRACHConfiguration ProtocolIE-ID ::= 233 +id-CG-Config ProtocolIE-ID ::= 234 +id-PDCCH-BlindDetectionSCG ProtocolIE-ID ::= 235 +id-Requested-PDCCH-BlindDetectionSCG ProtocolIE-ID ::= 236 +id-Ph-InfoMCG ProtocolIE-ID ::= 237 +id-MeasGapSharingConfig ProtocolIE-ID ::= 238 +id-systemInformationAreaID ProtocolIE-ID ::= 239 +id-areaScope ProtocolIE-ID ::= 240 +id-RRCContainer-RRCSetupComplete ProtocolIE-ID ::= 241 +id-TraceActivation ProtocolIE-ID ::= 242 +id-TraceID ProtocolIE-ID ::= 243 +id-Neighbour-Cell-Information-List ProtocolIE-ID ::= 244 +id-SymbolAllocInSlot ProtocolIE-ID ::= 246 +id-NumDLULSymbols ProtocolIE-ID ::= 247 +id-AdditionalRRMPriorityIndex ProtocolIE-ID ::= 248 +id-DUCURadioInformationType ProtocolIE-ID ::= 249 +id-CUDURadioInformationType ProtocolIE-ID ::= 250 +id-AggressorgNBSetID ProtocolIE-ID ::= 251 +id-VictimgNBSetID ProtocolIE-ID ::= 252 +id-LowerLayerPresenceStatusChange ProtocolIE-ID ::= 253 +id-Transport-Layer-Address-Info ProtocolIE-ID ::= 254 +id-Neighbour-Cell-Information-Item ProtocolIE-ID ::= 255 +id-IntendedTDD-DL-ULConfig ProtocolIE-ID ::= 256 +id-QosMonitoringRequest ProtocolIE-ID ::= 257 +id-BHChannels-ToBeSetup-List ProtocolIE-ID ::= 258 +id-BHChannels-ToBeSetup-Item ProtocolIE-ID ::= 259 +id-BHChannels-Setup-List ProtocolIE-ID ::= 260 +id-BHChannels-Setup-Item ProtocolIE-ID ::= 261 +id-BHChannels-ToBeModified-Item ProtocolIE-ID ::= 262 +id-BHChannels-ToBeModified-List ProtocolIE-ID ::= 263 +id-BHChannels-ToBeReleased-Item ProtocolIE-ID ::= 264 +id-BHChannels-ToBeReleased-List ProtocolIE-ID ::= 265 +id-BHChannels-ToBeSetupMod-Item ProtocolIE-ID ::= 266 +id-BHChannels-ToBeSetupMod-List ProtocolIE-ID ::= 267 +id-BHChannels-FailedToBeModified-Item ProtocolIE-ID ::= 268 +id-BHChannels-FailedToBeModified-List ProtocolIE-ID ::= 269 +id-BHChannels-FailedToBeSetupMod-Item ProtocolIE-ID ::= 270 +id-BHChannels-FailedToBeSetupMod-List ProtocolIE-ID ::= 271 +id-BHChannels-Modified-Item ProtocolIE-ID ::= 272 +id-BHChannels-Modified-List ProtocolIE-ID ::= 273 +id-BHChannels-SetupMod-Item ProtocolIE-ID ::= 274 +id-BHChannels-SetupMod-List ProtocolIE-ID ::= 275 +id-BHChannels-Required-ToBeReleased-Item ProtocolIE-ID ::= 276 +id-BHChannels-Required-ToBeReleased-List ProtocolIE-ID ::= 277 +id-BHChannels-FailedToBeSetup-Item ProtocolIE-ID ::= 278 +id-BHChannels-FailedToBeSetup-List ProtocolIE-ID ::= 279 +id-BHInfo ProtocolIE-ID ::= 280 +id-BAPAddress ProtocolIE-ID ::= 281 +id-ConfiguredBAPAddress ProtocolIE-ID ::= 282 +id-BH-Routing-Information-Added-List ProtocolIE-ID ::= 283 +id-BH-Routing-Information-Added-List-Item ProtocolIE-ID ::= 284 +id-BH-Routing-Information-Removed-List ProtocolIE-ID ::= 285 +id-BH-Routing-Information-Removed-List-Item ProtocolIE-ID ::= 286 +id-UL-BH-Non-UP-Traffic-Mapping ProtocolIE-ID ::= 287 +id-Activated-Cells-to-be-Updated-List ProtocolIE-ID ::= 288 +id-Child-Nodes-List ProtocolIE-ID ::= 289 +id-IAB-Info-IAB-DU ProtocolIE-ID ::= 290 +id-IAB-Info-IAB-donor-CU ProtocolIE-ID ::= 291 +id-IAB-TNL-Addresses-To-Remove-List ProtocolIE-ID ::= 292 +id-IAB-TNL-Addresses-To-Remove-Item ProtocolIE-ID ::= 293 +id-IAB-Allocated-TNL-Address-List ProtocolIE-ID ::= 294 +id-IAB-Allocated-TNL-Address-Item ProtocolIE-ID ::= 295 +id-IABIPv6RequestType ProtocolIE-ID ::= 296 +id-IABv4AddressesRequested ProtocolIE-ID ::= 297 +id-IAB-Barred ProtocolIE-ID ::= 298 +id-TrafficMappingInformation ProtocolIE-ID ::= 299 +id-UL-UP-TNL-Information-to-Update-List ProtocolIE-ID ::= 300 +id-UL-UP-TNL-Information-to-Update-List-Item ProtocolIE-ID ::= 301 +id-UL-UP-TNL-Address-to-Update-List ProtocolIE-ID ::= 302 +id-UL-UP-TNL-Address-to-Update-List-Item ProtocolIE-ID ::= 303 +id-DL-UP-TNL-Address-to-Update-List ProtocolIE-ID ::= 304 +id-DL-UP-TNL-Address-to-Update-List-Item ProtocolIE-ID ::= 305 +id-NRV2XServicesAuthorized ProtocolIE-ID ::= 306 +id-LTEV2XServicesAuthorized ProtocolIE-ID ::= 307 +id-NRUESidelinkAggregateMaximumBitrate ProtocolIE-ID ::= 308 +id-LTEUESidelinkAggregateMaximumBitrate ProtocolIE-ID ::= 309 +id-SIB12-message ProtocolIE-ID ::= 310 +id-SIB13-message ProtocolIE-ID ::= 311 +id-SIB14-message ProtocolIE-ID ::= 312 +id-SLDRBs-FailedToBeModified-Item ProtocolIE-ID ::= 313 +id-SLDRBs-FailedToBeModified-List ProtocolIE-ID ::= 314 +id-SLDRBs-FailedToBeSetup-Item ProtocolIE-ID ::= 315 +id-SLDRBs-FailedToBeSetup-List ProtocolIE-ID ::= 316 +id-SLDRBs-Modified-Item ProtocolIE-ID ::= 317 +id-SLDRBs-Modified-List ProtocolIE-ID ::= 318 +id-SLDRBs-Required-ToBeModified-Item ProtocolIE-ID ::= 319 +id-SLDRBs-Required-ToBeModified-List ProtocolIE-ID ::= 320 +id-SLDRBs-Required-ToBeReleased-Item ProtocolIE-ID ::= 321 +id-SLDRBs-Required-ToBeReleased-List ProtocolIE-ID ::= 322 +id-SLDRBs-Setup-Item ProtocolIE-ID ::= 323 +id-SLDRBs-Setup-List ProtocolIE-ID ::= 324 +id-SLDRBs-ToBeModified-Item ProtocolIE-ID ::= 325 +id-SLDRBs-ToBeModified-List ProtocolIE-ID ::= 326 +id-SLDRBs-ToBeReleased-Item ProtocolIE-ID ::= 327 +id-SLDRBs-ToBeReleased-List ProtocolIE-ID ::= 328 +id-SLDRBs-ToBeSetup-Item ProtocolIE-ID ::= 329 +id-SLDRBs-ToBeSetup-List ProtocolIE-ID ::= 330 +id-SLDRBs-ToBeSetupMod-Item ProtocolIE-ID ::= 331 +id-SLDRBs-ToBeSetupMod-List ProtocolIE-ID ::= 332 +id-SLDRBs-SetupMod-List ProtocolIE-ID ::= 333 +id-SLDRBs-FailedToBeSetupMod-List ProtocolIE-ID ::= 334 +id-SLDRBs-SetupMod-Item ProtocolIE-ID ::= 335 +id-SLDRBs-FailedToBeSetupMod-Item ProtocolIE-ID ::= 336 +id-SLDRBs-ModifiedConf-List ProtocolIE-ID ::= 337 +id-SLDRBs-ModifiedConf-Item ProtocolIE-ID ::= 338 +id-UEAssistanceInformationEUTRA ProtocolIE-ID ::= 339 +id-PC5LinkAMBR ProtocolIE-ID ::= 340 +id-SL-PHY-MAC-RLC-Config ProtocolIE-ID ::= 341 +id-SL-ConfigDedicatedEUTRA ProtocolIE-ID ::= 342 +id-AlternativeQoSParaSetList ProtocolIE-ID ::= 343 +id-CurrentQoSParaSetIndex ProtocolIE-ID ::= 344 +id-gNBCUMeasurementID ProtocolIE-ID ::= 345 +id-gNBDUMeasurementID ProtocolIE-ID ::= 346 +id-RegistrationRequest ProtocolIE-ID ::= 347 +id-ReportCharacteristics ProtocolIE-ID ::= 348 +id-CellToReportList ProtocolIE-ID ::= 349 +id-CellMeasurementResultList ProtocolIE-ID ::= 350 +id-HardwareLoadIndicator ProtocolIE-ID ::= 351 +id-ReportingPeriodicity ProtocolIE-ID ::= 352 +id-TNLCapacityIndicator ProtocolIE-ID ::= 353 +id-CarrierList ProtocolIE-ID ::= 354 +id-ULCarrierList ProtocolIE-ID ::= 355 +id-FrequencyShift7p5khz ProtocolIE-ID ::= 356 +id-SSB-PositionsInBurst ProtocolIE-ID ::= 357 +id-NRPRACHConfig ProtocolIE-ID ::= 358 +id-RACHReportInformationList ProtocolIE-ID ::= 359 +id-RLFReportInformationList ProtocolIE-ID ::= 360 +id-TDD-UL-DLConfigCommonNR ProtocolIE-ID ::= 361 +id-CNPacketDelayBudgetDownlink ProtocolIE-ID ::= 362 +id-ExtendedPacketDelayBudget ProtocolIE-ID ::= 363 +id-TSCTrafficCharacteristics ProtocolIE-ID ::= 364 +id-ReportingRequestType ProtocolIE-ID ::= 365 +id-TimeReferenceInformation ProtocolIE-ID ::= 366 +id-CNPacketDelayBudgetUplink ProtocolIE-ID ::= 369 +id-AdditionalPDCPDuplicationTNL-List ProtocolIE-ID ::= 370 +id-RLCDuplicationInformation ProtocolIE-ID ::= 371 +id-AdditionalDuplicationIndication ProtocolIE-ID ::= 372 +id-ConditionalInterDUMobilityInformation ProtocolIE-ID ::= 373 +id-ConditionalIntraDUMobilityInformation ProtocolIE-ID ::= 374 +id-targetCellsToCancel ProtocolIE-ID ::= 375 +id-requestedTargetCellGlobalID ProtocolIE-ID ::= 376 +id-ManagementBasedMDTPLMNList ProtocolIE-ID ::= 377 +id-TraceCollectionEntityIPAddress ProtocolIE-ID ::= 378 +id-PrivacyIndicator ProtocolIE-ID ::= 379 +id-TraceCollectionEntityURI ProtocolIE-ID ::= 380 +id-mdtConfiguration ProtocolIE-ID ::= 381 +id-ServingNID ProtocolIE-ID ::= 382 +id-NPNBroadcastInformation ProtocolIE-ID ::= 383 +id-NPNSupportInfo ProtocolIE-ID ::= 384 +id-NID ProtocolIE-ID ::= 385 +id-AvailableSNPN-ID-List ProtocolIE-ID ::= 386 +id-SIB10-message ProtocolIE-ID ::= 387 +id-DLCarrierList ProtocolIE-ID ::= 389 + id-ExtendedTAISliceSupportList ProtocolIE-ID ::= 390 +id-RequestedSRSTransmissionCharacteristics ProtocolIE-ID ::= 391 +id-PosAssistance-Information ProtocolIE-ID ::= 392 +id-PosBroadcast ProtocolIE-ID ::= 393 +id-RoutingID ProtocolIE-ID ::= 394 +id-PosAssistanceInformationFailureList ProtocolIE-ID ::= 395 +id-PosMeasurementQuantities ProtocolIE-ID ::= 396 +id-PosMeasurementResultList ProtocolIE-ID ::= 397 +id-TRPInformationTypeListTRPReq ProtocolIE-ID ::= 398 +id-TRPInformationTypeItem ProtocolIE-ID ::= 399 +id-TRPInformationListTRPResp ProtocolIE-ID ::= 400 +id-TRPInformationItem ProtocolIE-ID ::= 401 +id-LMF-MeasurementID ProtocolIE-ID ::= 402 +id-SRSType ProtocolIE-ID ::= 403 +id-ActivationTime ProtocolIE-ID ::= 404 +id-AbortTransmission ProtocolIE-ID ::= 405 +id-PositioningBroadcastCells ProtocolIE-ID ::= 406 +id-SRSConfiguration ProtocolIE-ID ::= 407 +id-PosReportCharacteristics ProtocolIE-ID ::= 408 +id-PosMeasurementPeriodicity ProtocolIE-ID ::= 409 +id-TRPList ProtocolIE-ID ::= 410 +id-RAN-MeasurementID ProtocolIE-ID ::= 411 +id-LMF-UE-MeasurementID ProtocolIE-ID ::= 412 +id-RAN-UE-MeasurementID ProtocolIE-ID ::= 413 +id-E-CID-MeasurementQuantities ProtocolIE-ID ::= 414 +id-E-CID-MeasurementQuantities-Item ProtocolIE-ID ::= 415 +id-E-CID-MeasurementPeriodicity ProtocolIE-ID ::= 416 +id-E-CID-MeasurementResult ProtocolIE-ID ::= 417 +id-Cell-Portion-ID ProtocolIE-ID ::= 418 +id-SFNInitialisationTime ProtocolIE-ID ::= 419 +id-SystemFrameNumber ProtocolIE-ID ::= 420 +id-SlotNumber ProtocolIE-ID ::= 421 +id-TRP-MeasurementRequestList ProtocolIE-ID ::= 422 +id-MeasurementBeamInfoRequest ProtocolIE-ID ::= 423 +id-E-CID-ReportCharacteristics ProtocolIE-ID ::= 424 +id-ConfiguredTACIndication ProtocolIE-ID ::= 425 +id-Extended-GNB-DU-Name ProtocolIE-ID ::= 426 +id-Extended-GNB-CU-Name ProtocolIE-ID ::= 427 + + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Containers.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Containers.asn new file mode 100644 index 0000000000..72c6d6e551 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-Containers.asn @@ -0,0 +1,178 @@ +F1AP-Containers { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-Containers (5) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + Presence, + PrivateIE-ID, + ProtocolExtensionID, + ProtocolIE-ID + +FROM F1AP-CommonDataTypes + maxPrivateIEs, + maxProtocolExtensions, + maxProtocolIEs + +FROM F1AP-Constants; + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +F1AP-PROTOCOL-IES-PAIR ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &firstCriticality Criticality, + &FirstValue, + &secondCriticality Criticality, + &SecondValue, + &presence Presence +} +WITH SYNTAX { + ID &id + FIRST CRITICALITY &firstCriticality + FIRST TYPE &FirstValue + SECOND CRITICALITY &secondCriticality + SECOND TYPE &SecondValue + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol Extensions +-- +-- ************************************************************** + +F1AP-PROTOCOL-EXTENSION ::= CLASS { + &id ProtocolExtensionID UNIQUE, + &criticality Criticality, + &Extension, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + EXTENSION &Extension + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Private IEs +-- +-- ************************************************************** + +F1AP-PRIVATE-IES ::= CLASS { + &id PrivateIE-ID, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Container for Protocol IEs +-- +-- ************************************************************** + +ProtocolIE-Container {F1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-SingleContainer {F1AP-PROTOCOL-IES : IEsSetParam} ::= + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Field {F1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES.&id ({IEsSetParam}), + criticality F1AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol IE Pairs +-- +-- ************************************************************** + +ProtocolIE-ContainerPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-FieldPair {{IEsSetParam}} + +ProtocolIE-FieldPair {F1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), + firstCriticality F1AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), + firstValue F1AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), + secondCriticality F1AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), + secondValue F1AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol Extensions +-- +-- ************************************************************** + +ProtocolExtensionContainer {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= + SEQUENCE (SIZE (1..maxProtocolExtensions)) OF + ProtocolExtensionField {{ExtensionSetParam}} + +ProtocolExtensionField {F1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE { + id F1AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}), + criticality F1AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}), + extensionValue F1AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Private IEs +-- +-- ************************************************************** + +PrivateIE-Container {F1AP-PRIVATE-IES : IEsSetParam } ::= + SEQUENCE (SIZE (1.. maxPrivateIEs)) OF + PrivateIE-Field {{IEsSetParam}} + +PrivateIE-Field {F1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { + id F1AP-PRIVATE-IES.&id ({IEsSetParam}), + criticality F1AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}), + value F1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) +} + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-IEs.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-IEs.asn new file mode 100644 index 0000000000..3e02e1b27e --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-IEs.asn @@ -0,0 +1,5509 @@ +-- ************************************************************** +-- +-- Information Element Definitions +-- +-- ************************************************************** + +F1AP-IEs { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-IEs (2) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + id-gNB-CUSystemInformation, + id-HandoverPreparationInformation, + id-TAISliceSupportList, + id-RANAC, + id-BearerTypeChange, + id-Cell-Direction, + id-Cell-Type, + id-CellGroupConfig, + id-AvailablePLMNList, + id-PDUSessionID, + id-ULPDUSessionAggregateMaximumBitRate, + id-DC-Based-Duplication-Configured, + id-DC-Based-Duplication-Activation, + id-Duplication-Activation, + id-DLPDCPSNLength, + id-ULPDCPSNLength, + id-RLC-Status, + id-MeasurementTimingConfiguration, + id-DRB-Information, + id-QoSFlowMappingIndication, + id-ServingCellMO, + id-RLCMode, + id-ExtendedServedPLMNs-List, + id-ExtendedAvailablePLMN-List, + id-DRX-LongCycleStartOffset, + id-SelectedBandCombinationIndex, + id-SelectedFeatureSetEntryIndex, + id-Ph-InfoSCG, + id-latest-RRC-Version-Enhanced, + id-RequestedBandCombinationIndex, + id-RequestedFeatureSetEntryIndex, + id-DRX-Config, + id-UEAssistanceInformation, + id-PDCCH-BlindDetectionSCG, + id-Requested-PDCCH-BlindDetectionSCG, + id-BPLMN-ID-Info-List, + id-NotificationInformation, + id-TNLAssociationTransportLayerAddressgNBDU, + id-portNumber, + id-AdditionalSIBMessageList, + id-IgnorePRACHConfiguration, + id-CG-Config, + id-Ph-InfoMCG, + id-AggressorgNBSetID, + id-VictimgNBSetID, + id-MeasGapSharingConfig, + id-systemInformationAreaID, + id-areaScope, + id-IntendedTDD-DL-ULConfig, + id-QosMonitoringRequest, + id-BHInfo, + id-IAB-Info-IAB-DU, + id-IAB-Info-IAB-donor-CU, + id-IAB-Barred, + id-SIB12-message, + id-SIB13-message, + id-SIB14-message, + id-UEAssistanceInformationEUTRA, + id-SL-PHY-MAC-RLC-Config, + id-SL-ConfigDedicatedEUTRA, + id-AlternativeQoSParaSetList, + id-CurrentQoSParaSetIndex, + id-CarrierList, + id-ULCarrierList, + id-FrequencyShift7p5khz, + id-SSB-PositionsInBurst, + id-NRPRACHConfig, + id-TDD-UL-DLConfigCommonNR, + id-CNPacketDelayBudgetDownlink, + id-CNPacketDelayBudgetUplink, + id-ExtendedPacketDelayBudget, + id-TSCTrafficCharacteristics, + id-AdditionalPDCPDuplicationTNL-List, + id-RLCDuplicationInformation, + id-AdditionalDuplicationIndication, + id-mdtConfiguration, + id-TraceCollectionEntityURI, + id-NID, + id-NPNSupportInfo, + id-NPNBroadcastInformation, + id-AvailableSNPN-ID-List, + id-SIB10-message, + id-RequestedP-MaxFR2, + id-DLCarrierList, + id-ExtendedTAISliceSupportList, + id-E-CID-MeasurementQuantities-Item, + id-ConfiguredTACIndication, + maxNRARFCN, + maxnoofErrors, + maxnoofBPLMNs, + maxnoofBPLMNsNR, + maxnoofDLUPTNLInformation, + maxnoofNrCellBands, + maxnoofULUPTNLInformation, + maxnoofQoSFlows, + maxnoofSliceItems, + maxnoofSIBTypes, + maxnoofSITypes, + maxCellineNB, + maxnoofExtendedBPLMNs, + maxnoofAdditionalSIBs, + maxnoofUACPLMNs, + maxnoofUACperPLMN, + maxCellingNBDU, + maxnoofTLAs, + maxnoofGTPTLAs, + maxnoofslots, + maxnoofNonUPTrafficMappings, + maxnoofServingCells, + maxnoofServedCellsIAB, + maxnoofChildIABNodes, + maxnoofIABSTCInfo, + maxnoofSymbols, + maxnoofDUFSlots, + maxnoofHSNASlots, + maxnoofEgressLinks, + maxnoofMappingEntries, + maxnoofDSInfo, + maxnoofQoSParaSets, + maxnoofPC5QoSFlows, + maxnoofSSBAreas, + maxnoofBPLMNsNR, + maxnoofNRSCSs, + maxnoofPhysicalResourceBlocks, + maxnoofPhysicalResourceBlocks-1, + maxnoofPRACHconfigs, + maxnoofRACHReports, + maxnoofRLFReports, + maxnoofAdditionalPDCPDuplicationTNL, + maxnoofRLCDuplicationState, + maxnoofCHOcells, + maxnoofMDTPLMNs, + maxnoofCAGsupported, + maxnoofNIDsupported, + maxnoofNRSCSs, + maxnoofPhysicalResourceBlocks, + maxnoofExtSliceItems, + maxnoofPosMeas, + maxnoofTRPInfoTypes, + maxnoofSRSTriggerStates, + maxnoofSpatialRelations, + maxnoBcastCell, + maxnoofTRPs, + maxnoofAngleInfo, + maxnooflcs-gcs-translation, + maxnoofPath, + maxnoofMeasE-CID, + maxnoofSSBs, + maxnoSRS-ResourceSets, + maxnoSRS-ResourcePerSet, + maxnoSRS-Carriers, + maxnoSCSs, + maxnoSRS-Resources, + maxnoSRS-PosResources, + maxnoSRS-PosResourceSets, + maxnoSRS-PosResourcePerSet, + maxnoofPRS-ResourceSets, + maxnoofPRS-ResourcesPerSet, + maxNoOfMeasTRPs, + maxnoofPRSresourceSets, + maxnoofPRSresources + + + +FROM F1AP-Constants + + Criticality, + ProcedureCode, + ProtocolIE-ID, + TriggeringMessage + +FROM F1AP-CommonDataTypes + + ProtocolExtensionContainer{}, + F1AP-PROTOCOL-EXTENSION, + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + +-- A + +AbortTransmission ::= CHOICE { + sRSResourceSetID SRSResourceSetID, + releaseALL NULL, + choice-extension ProtocolIE-SingleContainer { { AbortTransmission-ExtIEs } } +} + +AbortTransmission-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +AccessPointPosition ::= SEQUENCE { + latitudeSign ENUMERATED {north, south}, + latitude INTEGER (0..8388607), + longitude INTEGER (-8388608..8388607), + directionOfAltitude ENUMERATED {height, depth}, + altitude INTEGER (0..32767), + uncertaintySemi-major INTEGER (0..127), + uncertaintySemi-minor INTEGER (0..127), + orientationOfMajorAxis INTEGER (0..179), + uncertaintyAltitude INTEGER (0..127), + confidence INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { AccessPointPosition-ExtIEs} } OPTIONAL +} + +AccessPointPosition-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Activated-Cells-to-be-Updated-List ::= SEQUENCE (SIZE(1..maxnoofServedCellsIAB)) OF Activated-Cells-to-be-Updated-List-Item + +Activated-Cells-to-be-Updated-List-Item ::= SEQUENCE{ + nRCGI NRCGI, + iAB-DU-Cell-Resource-Configuration-Mode-Info IAB-DU-Cell-Resource-Configuration-Mode-Info, + iE-Extensions ProtocolExtensionContainer { { Activated-Cells-to-be-Updated-List-Item-ExtIEs} } OPTIONAL +} + +Activated-Cells-to-be-Updated-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ActiveULBWP ::= SEQUENCE { + locationAndBandwidth INTEGER (0..37949,...), + subcarrierSpacing ENUMERATED {kHz15, kHz30, kHz60, kHz120,...}, + cyclicPrefix ENUMERATED {normal, extended}, + txDirectCurrentLocation INTEGER (0..3301,...), + shift7dot5kHz ENUMERATED {true, ...} OPTIONAL, + sRSConfig SRSConfig, + iE-Extensions ProtocolExtensionContainer { { ActiveULBWP-ExtIEs} } OPTIONAL +} + +ActiveULBWP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalDuplicationIndication ::= ENUMERATED { + three, + four, + ... +} + + +AdditionalPath-List::= SEQUENCE (SIZE(1..maxnoofPath)) OF AdditionalPath-Item + +AdditionalPath-Item ::=SEQUENCE { + relativePathDelay RelativePathDelay, + pathQuality TRPMeasurementQuality OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { AdditionalPath-Item-ExtIEs } } OPTIONAL +} + +AdditionalPath-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AdditionalPDCPDuplicationTNL-List ::= SEQUENCE (SIZE(1..maxnoofAdditionalPDCPDuplicationTNL)) OF AdditionalPDCPDuplicationTNL-Item + +AdditionalPDCPDuplicationTNL-Item ::=SEQUENCE { + additionalPDCPDuplicationUPTNLInformation UPTransportLayerInformation, + iE-Extensions ProtocolExtensionContainer { { AdditionalPDCPDuplicationTNL-ItemExtIEs } } OPTIONAL, + ... +} + +AdditionalPDCPDuplicationTNL-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalSIBMessageList ::= SEQUENCE (SIZE(1..maxnoofAdditionalSIBs)) OF AdditionalSIBMessageList-Item + +AdditionalSIBMessageList-Item ::= SEQUENCE { + additionalSIB OCTET STRING, + iE-Extensions ProtocolExtensionContainer { { AdditionalSIBMessageList-Item-ExtIEs} } OPTIONAL +} + +AdditionalSIBMessageList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalRRMPriorityIndex ::= BIT STRING (SIZE(32)) + +AggressorCellList ::= SEQUENCE (SIZE(1..maxCellingNBDU)) OF AggressorCellList-Item + +AggressorCellList-Item ::= SEQUENCE { + aggressorCell-ID NRCGI, + iE-Extensions ProtocolExtensionContainer { { AggressorCellList-Item-ExtIEs } } OPTIONAL +} + +AggressorCellList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AggressorgNBSetID ::= SEQUENCE { + aggressorgNBSetID GNBSetID, + iE-Extensions ProtocolExtensionContainer { { AggressorgNBSetID-ExtIEs } } OPTIONAL +} + +AggressorgNBSetID-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {AllocationAndRetentionPriority-ExtIEs} } OPTIONAL, + ... +} + +AllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AlternativeQoSParaSetList ::= SEQUENCE (SIZE(1..maxnoofQoSParaSets)) OF AlternativeQoSParaSetItem + +AlternativeQoSParaSetItem ::= SEQUENCE { + alternativeQoSParaSetIndex QoSParaSetIndex, + guaranteedFlowBitRateDL BitRate OPTIONAL, + guaranteedFlowBitRateUL BitRate OPTIONAL, + packetDelayBudget PacketDelayBudget OPTIONAL, + packetErrorRate PacketErrorRate OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {AlternativeQoSParaSetItem-ExtIEs} } OPTIONAL, + ... +} + +AlternativeQoSParaSetItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AngleMeasurementQuality ::= SEQUENCE { + azimuthQuality INTEGER(0..255), + zenithQuality INTEGER(0..255) OPTIONAL, + resolution ENUMERATED{deg0dot1,...}, + iE-Extensions ProtocolExtensionContainer { { AngleMeasurementQuality-ExtIEs } } OPTIONAL +} + +AngleMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +AperiodicSRSResourceTriggerList ::= SEQUENCE (SIZE(1..maxnoofSRSTriggerStates)) OF AperiodicSRSResourceTrigger + +AperiodicSRSResourceTrigger ::= INTEGER (0..3, ...) + +Associated-SCell-Item ::= SEQUENCE { + sCell-ID NRCGI, + iE-Extensions ProtocolExtensionContainer { { Associated-SCell-ItemExtIEs } } OPTIONAL +} + +Associated-SCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AvailablePLMNList ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF AvailablePLMNList-Item + +AvailablePLMNList-Item ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { AvailablePLMNList-Item-ExtIEs} } OPTIONAL +} + +AvailablePLMNList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AvailableSNPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF AvailableSNPN-ID-List-Item + +AvailableSNPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + availableNIDList BroadcastNIDList, + iE-Extensions ProtocolExtensionContainer { { AvailableSNPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +AvailableSNPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AveragingWindow ::= INTEGER (0..4095, ...) + +AreaScope ::= ENUMERATED {true, ...} + +-- B + +BandwidthSRS ::= CHOICE { + fR1 FR1-Bandwidth, + fR2 FR2-Bandwidth, + choice-extension ProtocolIE-SingleContainer {{ BandwidthSRS-ExtIEs }} +} + +BandwidthSRS-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +BAPAddress ::= BIT STRING (SIZE(10)) + +BAPCtrlPDUChannel ::= ENUMERATED {true, ...} + +BAPlayerBHRLCchannelMappingInfo ::= SEQUENCE { + bAPlayerBHRLCchannelMappingInfoToAdd BAPlayerBHRLCchannelMappingInfoList OPTIONAL, + bAPlayerBHRLCchannelMappingInfoToRemove MappingInformationtoRemove OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BAPlayerBHRLCchannelMappingInfo-ExtIEs} } OPTIONAL, + ... +} + +BAPlayerBHRLCchannelMappingInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BAPlayerBHRLCchannelMappingInfoList ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF BAPlayerBHRLCchannelMappingInfo-Item + +BAPlayerBHRLCchannelMappingInfo-Item ::= SEQUENCE { + mappingInformationIndex MappingInformationIndex, + priorHopBAPAddress BAPAddress OPTIONAL, + ingressbHRLCChannelID BHRLCChannelID OPTIONAL, + nextHopBAPAddress BAPAddress OPTIONAL, + egressbHRLCChannelID BHRLCChannelID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BAPlayerBHRLCchannelMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +BAPlayerBHRLCchannelMappingInfo-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BAPPathID ::= BIT STRING (SIZE(10)) + +BAPRoutingID ::= SEQUENCE { + bAPAddress BAPAddress, + bAPPathID BAPPathID, + iE-Extensions ProtocolExtensionContainer { { BAPRoutingIDExtIEs } } OPTIONAL +} + +BAPRoutingIDExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BitRate ::= INTEGER (0..4000000000000,...) + +BearerTypeChange ::= ENUMERATED {true, ...} + +BHRLCChannelID ::= BIT STRING (SIZE(16)) + +BHChannels-FailedToBeModified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeModified-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-FailedToBeSetup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeSetup-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-FailedToBeSetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { BHChannels-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Modified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Modified-ItemExtIEs } } OPTIONAL +} + +BHChannels-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Required-ToBeReleased-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Required-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +BHChannels-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-Setup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-Setup-ItemExtIEs } } OPTIONAL +} + +BHChannels-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-SetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-SetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeModified-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode OPTIONAL, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeModified-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeReleased-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeSetup-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeSetup-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHChannels-ToBeSetupMod-Item ::= SEQUENCE { + bHRLCChannelID BHRLCChannelID, + bHQoSInformation BHQoSInformation, + rLCmode RLCMode, + bAPCtrlPDUChannel BAPCtrlPDUChannel OPTIONAL, + trafficMappingInfo TrafficMappingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHChannels-ToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +BHChannels-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHInfo ::= SEQUENCE { + bAProutingID BAPRoutingID OPTIONAL, + egressBHRLCCHList EgressBHRLCCHList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BHInfo-ExtIEs} } OPTIONAL +} + +BHInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BHQoSInformation ::= CHOICE { + bHRLCCHQoS QoSFlowLevelQoSParameters, + eUTRANBHRLCCHQoS EUTRANQoS, + cPTrafficType CPTrafficType, + choice-extension ProtocolIE-SingleContainer { { BHQoSInformation-ExtIEs} } +} + +BHQoSInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +BH-Routing-Information-Added-List-Item ::= SEQUENCE { + bAPRoutingID BAPRoutingID, + nextHopBAPAddress BAPAddress, + iE-Extensions ProtocolExtensionContainer { { BH-Routing-Information-Added-List-ItemExtIEs} } OPTIONAL +} + +BH-Routing-Information-Added-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BH-Routing-Information-Removed-List-Item ::= SEQUENCE { + bAPRoutingID BAPRoutingID, + iE-Extensions ProtocolExtensionContainer { { BH-Routing-Information-Removed-List-ItemExtIEs} } OPTIONAL +} + +BH-Routing-Information-Removed-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BPLMN-ID-Info-List ::= SEQUENCE (SIZE(1..maxnoofBPLMNsNR)) OF BPLMN-ID-Info-Item + +BPLMN-ID-Info-Item ::= SEQUENCE { + pLMN-Identity-List AvailablePLMNList, + extended-PLMN-Identity-List ExtendedAvailablePLMN-List OPTIONAL, + fiveGS-TAC FiveGS-TAC OPTIONAL, + nr-cell-ID NRCellIdentity, + ranac RANAC OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { BPLMN-ID-Info-ItemExtIEs} } OPTIONAL, + ... +} + +BPLMN-ID-Info-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ConfiguredTACIndication CRITICALITY ignore EXTENSION ConfiguredTACIndication PRESENCE optional }| + { ID id-NPNBroadcastInformation CRITICALITY reject EXTENSION NPNBroadcastInformation PRESENCE optional}, + ... +} + +ServedPLMNs-List ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF ServedPLMNs-Item + +ServedPLMNs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { ServedPLMNs-ItemExtIEs} } OPTIONAL, + ... +} + +ServedPLMNs-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { +{ ID id-TAISliceSupportList CRITICALITY ignore EXTENSION SliceSupportList PRESENCE optional }| +{ ID id-NPNSupportInfo CRITICALITY reject EXTENSION NPNSupportInfo PRESENCE optional }| +{ ID id-ExtendedTAISliceSupportList CRITICALITY reject EXTENSION ExtendedSliceSupportList PRESENCE optional }, + ... +} + +BroadcastCAGList ::= SEQUENCE (SIZE(1..maxnoofCAGsupported)) OF CAGID + +BroadcastNIDList ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF NID + +BroadcastSNPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofNIDsupported)) OF BroadcastSNPN-ID-List-Item + +BroadcastSNPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + broadcastNIDList BroadcastNIDList, + iE-Extensions ProtocolExtensionContainer { { BroadcastSNPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +BroadcastSNPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +BroadcastPNI-NPN-ID-List ::= SEQUENCE (SIZE(1..maxnoofCAGsupported)) OF BroadcastPNI-NPN-ID-List-Item + +BroadcastPNI-NPN-ID-List-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + broadcastCAGList BroadcastCAGList, + iE-Extensions ProtocolExtensionContainer { { BroadcastPNI-NPN-ID-List-ItemExtIEs} } OPTIONAL, + ... +} + +BroadcastPNI-NPN-ID-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +BurstArrivalTime ::= OCTET STRING + +-- C +CAGID ::= BIT STRING (SIZE(32)) + +Cancel-all-Warning-Messages-Indicator ::= ENUMERATED {true, ...} + +Candidate-SpCell-Item ::= SEQUENCE { + candidate-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Candidate-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Candidate-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CapacityValue::= SEQUENCE { + capacityValue INTEGER (0..100), + sSBAreaCapacityValueList SSBAreaCapacityValueList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CapacityValue-ExtIEs} } OPTIONAL +} + +CapacityValue-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cause ::= CHOICE { + radioNetwork CauseRadioNetwork, + transport CauseTransport, + protocol CauseProtocol, + misc CauseMisc, + choice-extension ProtocolIE-SingleContainer { { Cause-ExtIEs} } +} + +Cause-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CauseMisc ::= ENUMERATED { + control-processing-overload, + not-enough-user-plane-processing-resources, + hardware-failure, + om-intervention, + unspecified, + ... +} + +CauseProtocol ::= ENUMERATED { + transfer-syntax-error, + abstract-syntax-error-reject, + abstract-syntax-error-ignore-and-notify, + message-not-compatible-with-receiver-state, + semantic-error, + abstract-syntax-error-falsely-constructed-message, + unspecified, + ... +} + +CauseRadioNetwork ::= ENUMERATED { + unspecified, + rl-failure-rlc, + unknown-or-already-allocated-gnb-cu-ue-f1ap-id, + unknown-or-already-allocated-gnb-du-ue-f1ap-id, + unknown-or-inconsistent-pair-of-ue-f1ap-id, + interaction-with-other-procedure, + not-supported-qci-Value, + action-desirable-for-radio-reasons, + no-radio-resources-available, + procedure-cancelled, + normal-release, + ..., + cell-not-available, + rl-failure-others, + ue-rejection, + resources-not-available-for-the-slice, + amf-initiated-abnormal-release, + release-due-to-pre-emption, + plmn-not-served-by-the-gNB-CU, + multiple-drb-id-instances, + unknown-drb-id, + multiple-bh-rlc-ch-id-instances, + unknown-bh-rlc-ch-id, + cho-cpc-resources-tobechanged, + nPN-not-supported, + nPN-access-denied, + gNB-CU-Cell-Capacity-Exceeded, + report-characteristics-empty, + existing-measurement-ID, + measurement-temporarily-not-available, + measurement-not-supported-for-the-object + +} + +CauseTransport ::= ENUMERATED { + unspecified, + transport-resource-unavailable, + ..., + unknown-TNL-address-for-IAB, + unknown-UP-TNL-information-for-IAB +} + +CellGroupConfig ::= OCTET STRING + +CellCapacityClassValue ::= INTEGER (1..100,...) + +Cell-Direction ::= ENUMERATED {dl-only, ul-only} + +CellMeasurementResultList ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF CellMeasurementResultItem + +CellMeasurementResultItem ::= SEQUENCE { + cellID NRCGI, + radioResourceStatus RadioResourceStatus OPTIONAL, + compositeAvailableCapacityGroup CompositeAvailableCapacityGroup OPTIONAL, + sliceAvailableCapacity SliceAvailableCapacity OPTIONAL, + numberofActiveUEs NumberofActiveUEs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CellMeasurementResultItem-ExtIEs} } OPTIONAL +} + +CellMeasurementResultItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cell-Portion-ID ::= INTEGER (0..4095,...) + +Cells-Failed-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { Cells-Failed-to-be-Activated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Failed-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-Status-Item ::= SEQUENCE { + nRCGI NRCGI, + service-status Service-Status, + iE-Extensions ProtocolExtensionContainer { { Cells-Status-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Status-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-To-Be-Broadcast-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-To-Be-Broadcast-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-To-Be-Broadcast-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-Broadcast-Completed-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Completed-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Completed-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Broadcast-To-Be-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { Broadcast-To-Be-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Broadcast-To-Be-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Cells-Broadcast-Cancelled-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { Cells-Broadcast-Cancelled-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-Broadcast-Cancelled-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Activated-List-Item ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Activated-List-ItemExtIEs} } OPTIONAL, + ... +} + +Cells-to-be-Activated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-gNB-CUSystemInformation CRITICALITY reject EXTENSION GNB-CUSystemInformation PRESENCE optional }| + { ID id-AvailablePLMNList CRITICALITY ignore EXTENSION AvailablePLMNList PRESENCE optional }| + { ID id-ExtendedAvailablePLMN-List CRITICALITY ignore EXTENSION ExtendedAvailablePLMN-List PRESENCE optional }| + { ID id-IAB-Info-IAB-donor-CU CRITICALITY ignore EXTENSION IAB-Info-IAB-donor-CU PRESENCE optional}| + { ID id-AvailableSNPN-ID-List CRITICALITY ignore EXTENSION AvailableSNPN-ID-List PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Deactivated-List-ItemExtIEs } } OPTIONAL, + ... +} + +Cells-to-be-Deactivated-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cells-to-be-Barred-Item::= SEQUENCE { + nRCGI NRCGI , + cellBarred CellBarred, + iE-Extensions ProtocolExtensionContainer { { Cells-to-be-Barred-Item-ExtIEs } } OPTIONAL +} + +Cells-to-be-Barred-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-IAB-Barred CRITICALITY ignore EXTENSION IAB-Barred PRESENCE optional }, + + ... +} + + +CellBarred ::= ENUMERATED {barred, not-barred, ...} + +CellSize ::= ENUMERATED {verysmall, small, medium, large, ...} + +CellToReportList ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF CellToReportItem + +CellToReportItem ::= SEQUENCE { + cellID NRCGI, + sSBToReportList SSBToReportList OPTIONAL, + sliceToReportList SliceToReportList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CellToReportItem-ExtIEs} } OPTIONAL +} + +CellToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellType ::= SEQUENCE { + cellSize CellSize, + iE-Extensions ProtocolExtensionContainer { {CellType-ExtIEs} } OPTIONAL, + ... +} + +CellType-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellULConfigured ::= ENUMERATED {none, ul, sul, ul-and-sul, ...} + +Child-Node-Cells-List ::= SEQUENCE (SIZE(1..maxnoofChildIABNodes)) OF Child-Node-Cells-List-Item + +Child-Node-Cells-List-Item ::= SEQUENCE{ + nRCGI NRCGI, + iAB-DU-Cell-Resource-Configuration-Mode-Info IAB-DU-Cell-Resource-Configuration-Mode-Info OPTIONAL, + iAB-STC-Info IAB-STC-Info OPTIONAL, + rACH-Config-Common RACH-Config-Common OPTIONAL, + rACH-Config-Common-IAB RACH-Config-Common-IAB OPTIONAL, + cSI-RS-Configuration OCTET STRING OPTIONAL, + sR-Configuration OCTET STRING OPTIONAL, + pDCCH-ConfigSIB1 OCTET STRING OPTIONAL, + sCS-Common OCTET STRING OPTIONAL, + multiplexingInfo MultiplexingInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{Child-Node-Cells-List-Item-ExtIEs}} OPTIONAL +} + +Child-Node-Cells-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Child-Nodes-List ::= SEQUENCE (SIZE(1..maxnoofChildIABNodes)) OF Child-Nodes-List-Item + +Child-Nodes-List-Item ::= SEQUENCE{ + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID, + child-Node-Cells-List Child-Node-Cells-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{Child-Nodes-List-Item-ExtIEs}} OPTIONAL +} + +Child-Nodes-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CHOtrigger-InterDU ::= ENUMERATED { + cho-initiation, + cho-replace, + ... +} + +CHOtrigger-IntraDU ::= ENUMERATED { + cho-initiation, + cho-replace, + cho-cancel, + ... +} + +CNUEPagingIdentity ::= CHOICE { + fiveG-S-TMSI BIT STRING (SIZE(48)), + choice-extension ProtocolIE-SingleContainer { { CNUEPagingIdentity-ExtIEs } } +} + +CNUEPagingIdentity-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CompositeAvailableCapacityGroup ::= SEQUENCE { + compositeAvailableCapacityDownlink CompositeAvailableCapacity, + compositeAvailableCapacityUplink CompositeAvailableCapacity, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacityGroup-ExtIEs} } OPTIONAL +} + +CompositeAvailableCapacityGroup-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CompositeAvailableCapacity ::= SEQUENCE { + cellCapacityClassValue CellCapacityClassValue OPTIONAL, + capacityValue CapacityValue, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacity-ExtIEs} } OPTIONAL +} + +CompositeAvailableCapacity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ConditionalInterDUMobilityInformation ::= SEQUENCE { + cho-trigger CHOtrigger-InterDU, + targetgNB-DUUEF1APID GNB-DU-UE-F1AP-ID OPTIONAL + -- This IE shall be present if the cho-trigger IE is present and set to "cho-replace" --, + iE-Extensions ProtocolExtensionContainer { { ConditionalInterDUMobilityInformation-ExtIEs} } OPTIONAL, + ... +} + +ConditionalInterDUMobilityInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::={ + ... +} + +ConditionalIntraDUMobilityInformation ::= SEQUENCE { + cho-trigger CHOtrigger-IntraDU, + targetCellsTocancel TargetCellList OPTIONAL, + -- This IE may be present if the cho-trigger IE is present and set to "cho-cancel" + iE-Extensions ProtocolExtensionContainer { { ConditionalIntraDUMobilityInformation-ExtIEs} } OPTIONAL, + ... +} + +ConditionalIntraDUMobilityInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::={ + ... +} + +ConfiguredTACIndication ::= ENUMERATED { + true, + ... +} + + +CoordinateID ::= INTEGER (0..511, ...) + +CP-TransportLayerAddress ::= CHOICE { + endpoint-IP-address TransportLayerAddress, + endpoint-IP-address-and-port Endpoint-IP-address-and-port, + choice-extension ProtocolIE-SingleContainer { { CP-TransportLayerAddress-ExtIEs } } +} + +CP-TransportLayerAddress-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CPTrafficType ::= INTEGER (1..3,...) + +CriticalityDiagnostics ::= SEQUENCE { + procedureCode ProcedureCode OPTIONAL, + triggeringMessage TriggeringMessage OPTIONAL, + procedureCriticality Criticality OPTIONAL, + transactionID TransactionID OPTIONAL, + iEsCriticalityDiagnostics CriticalityDiagnostics-IE-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics-IE-List ::= SEQUENCE (SIZE (1.. maxnoofErrors)) OF CriticalityDiagnostics-IE-Item + +CriticalityDiagnostics-IE-Item ::= SEQUENCE { + iECriticality Criticality, + iE-ID ProtocolIE-ID, + typeOfError TypeOfError, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-IE-Item-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-IE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +C-RNTI ::= INTEGER (0..65535, ...) + +CUDURadioInformationType ::= CHOICE { + rIM CUDURIMInformation, + choice-extension ProtocolIE-SingleContainer { { CUDURadioInformationType-ExtIEs} } +} + +CUDURadioInformationType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +CUDURIMInformation ::= SEQUENCE { + victimgNBSetID GNBSetID, + rIMRSDetectionStatus RIMRSDetectionStatus, + iE-Extensions ProtocolExtensionContainer { { CUDURIMInformation-ExtIEs} } OPTIONAL +} + +CUDURIMInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CUtoDURRCInformation ::= SEQUENCE { + cG-ConfigInfo CG-ConfigInfo OPTIONAL, + uE-CapabilityRAT-ContainerList UE-CapabilityRAT-ContainerList OPTIONAL, + measConfig MeasConfig OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CUtoDURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +CUtoDURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-HandoverPreparationInformation CRITICALITY ignore EXTENSION HandoverPreparationInformation PRESENCE optional }| + { ID id-CellGroupConfig CRITICALITY ignore EXTENSION CellGroupConfig PRESENCE optional }| + { ID id-MeasurementTimingConfiguration CRITICALITY ignore EXTENSION MeasurementTimingConfiguration PRESENCE optional }| + { ID id-UEAssistanceInformation CRITICALITY ignore EXTENSION UEAssistanceInformation PRESENCE optional }| + { ID id-CG-Config CRITICALITY ignore EXTENSION CG-Config PRESENCE optional }| + { ID id-UEAssistanceInformationEUTRA CRITICALITY ignore EXTENSION UEAssistanceInformationEUTRA PRESENCE optional }, + ... +} + +-- D + +DCBasedDuplicationConfigured::= ENUMERATED{true,..., false} + +Dedicated-SIDelivery-NeededUE-Item ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID, + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { DedicatedSIDeliveryNeededUE-Item-ExtIEs} } OPTIONAL, + ... +} + +DedicatedSIDeliveryNeededUE-Item-ExtIEs F1AP-PROTOCOL-EXTENSION::={ + ... +} + + +DL-PRS ::= SEQUENCE { + prsid INTEGER (0..255), + dl-PRSResourceSetID PRS-Resource-Set-ID, + dl-PRSResourceID PRS-Resource-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {DL-PRS-ExtIEs} } OPTIONAL +} + +DL-PRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-PRSMutingPattern ::= CHOICE { + two BIT STRING (SIZE(2)), + four BIT STRING (SIZE(4)), + six BIT STRING (SIZE(6)), + eight BIT STRING (SIZE(8)), + sixteen BIT STRING (SIZE(16)), + thirty-two BIT STRING (SIZE(32)), + choice-extension ProtocolIE-SingleContainer { { DL-PRSMutingPattern-ExtIEs } } +} + +DL-PRSMutingPattern-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DLPRSResourceCoordinates ::= SEQUENCE { + listofDL-PRSResourceSetARP SEQUENCE (SIZE(1.. maxnoofPRS-ResourceSets)) OF DLPRSResourceSetARP, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceCoordinates-ExtIEs } } OPTIONAL +} + +DLPRSResourceCoordinates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DLPRSResourceSetARP ::= SEQUENCE { + dl-PRSResourceSetID INTEGER (0..7), + dL-PRSResourceSetARPLocation DL-PRSResourceSetARPLocation, + listofDL-PRSResourceARP SEQUENCE (SIZE(1.. maxnoofPRS-ResourcesPerSet)) OF DLPRSResourceARP, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceSetARP-ExtIEs } } OPTIONAL +} + +DLPRSResourceSetARP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DL-PRSResourceSetARPLocation ::= CHOICE { + relativeGeodeticLocation RelativeGeodeticLocation, + relativeCartesianLocation RelativeCartesianLocation, + choice-Extension ProtocolIE-SingleContainer { { DL-PRSResourceSetARPLocation-ExtIEs } } +} + +DL-PRSResourceSetARPLocation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +DLPRSResourceARP ::= SEQUENCE { + dl-PRSResourceID INTEGER (0..63), + dL-PRSResourceARPLocation DL-PRSResourceARPLocation, + iE-Extensions ProtocolExtensionContainer { { DLPRSResourceARP-ExtIEs } } OPTIONAL +} + +DLPRSResourceARP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-PRSResourceARPLocation ::= CHOICE { + relativeGeodeticLocation RelativeGeodeticLocation, + relativeCartesianLocation RelativeCartesianLocation, + choice-Extension ProtocolIE-SingleContainer { { DL-PRSResourceARPLocation-ExtIEs } } +} + +DL-PRSResourceARPLocation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DL-UP-TNL-Address-to-Update-List-Item ::= SEQUENCE { + oldIPAdress TransportLayerAddress, + newIPAdress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { DL-UP-TNL-Address-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +DL-UP-TNL-Address-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DLUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDLUPTNLInformation)) OF DLUPTNLInformation-ToBeSetup-Item + +DLUPTNLInformation-ToBeSetup-Item ::= SEQUENCE { + dLUPTNLInformation UPTransportLayerInformation , + iE-Extensions ProtocolExtensionContainer { { DLUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DLUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity-Item ::= SEQUENCE { + dRBID DRBID, + dRB-Activity DRB-Activity OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRB-Activity-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Activity-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Activity ::= ENUMERATED {active, not-active} + +DRBID ::= INTEGER (1..32, ...) + +DRBs-FailedToBeModified-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-FailedToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +DRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { DRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRB-Information ::= SEQUENCE { + dRB-QoS QoSFlowLevelQoSParameters, + sNSSAI SNSSAI, + notificationControl NotificationControl OPTIONAL, + flows-Mapped-To-DRB-List Flows-Mapped-To-DRB-List, + iE-Extensions ProtocolExtensionContainer { { DRB-Information-ItemExtIEs } } OPTIONAL +} + +DRB-Information-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Modified-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List, + iE-Extensions ProtocolExtensionContainer { { DRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RLC-Status CRITICALITY ignore EXTENSION RLC-Status PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRBs-ModifiedConf-Item ::= SEQUENCE { + dRBID DRBID, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-ModifiedConf-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRB-Notify-Item ::= SEQUENCE { + dRBID DRBID, + notification-Cause Notification-Cause, + iE-Extensions ProtocolExtensionContainer { { DRB-Notify-ItemExtIEs } } OPTIONAL, + ... +} + +DRB-Notify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CurrentQoSParaSetIndex CRITICALITY ignore EXTENSION QoSParaSetNotifyIndex PRESENCE optional }, + ... +} + +DRBs-Required-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RLC-Status CRITICALITY ignore EXTENSION RLC-Status PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + +DRBs-Required-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-Setup-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, ... +} + +DRBs-SetupMod-Item ::= SEQUENCE { + dRBID DRBID, + lCID LCID OPTIONAL, + dLUPTNLInformation-ToBeSetup-List DLUPTNLInformation-ToBeSetup-List , + iE-Extensions ProtocolExtensionContainer { { DRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + + +DRBs-ToBeModified-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation OPTIONAL, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + uLConfiguration ULConfiguration OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeModified-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + {ID id-BearerTypeChange CRITICALITY ignore EXTENSION BearerTypeChange PRESENCE optional}| + { ID id-RLCMode CRITICALITY ignore EXTENSION RLCMode PRESENCE optional }| + { ID id-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, + ... +} + +DRBs-ToBeReleased-Item ::= SEQUENCE { + dRBID DRBID, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRBs-ToBeSetup-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List , + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE mandatory }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }, + ... +} + + +DRBs-ToBeSetupMod-Item ::= SEQUENCE { + dRBID DRBID, + qoSInformation QoSInformation, + uLUPTNLInformation-ToBeSetup-List ULUPTNLInformation-ToBeSetup-List, + rLCMode RLCMode, + uLConfiguration ULConfiguration OPTIONAL, + duplicationActivation DuplicationActivation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +DRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DC-Based-Duplication-Configured CRITICALITY reject EXTENSION DCBasedDuplicationConfigured PRESENCE optional }| + { ID id-DC-Based-Duplication-Activation CRITICALITY reject EXTENSION DuplicationActivation PRESENCE optional }| + { ID id-DLPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-ULPDCPSNLength CRITICALITY ignore EXTENSION PDCPSNLength PRESENCE optional }| + { ID id-AdditionalPDCPDuplicationTNL-List CRITICALITY ignore EXTENSION AdditionalPDCPDuplicationTNL-List PRESENCE optional }| + { ID id-RLCDuplicationInformation CRITICALITY ignore EXTENSION RLCDuplicationInformation PRESENCE optional}, + ... +} + +DRXCycle ::= SEQUENCE { + longDRXCycleLength LongDRXCycleLength, + shortDRXCycleLength ShortDRXCycleLength OPTIONAL, + shortDRXCycleTimer ShortDRXCycleTimer OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DRXCycle-ExtIEs} } OPTIONAL, + ... +} + +DRXCycle-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DRX-Config ::= OCTET STRING + +DRXConfigurationIndicator ::= ENUMERATED{ release, ...} + +DRX-LongCycleStartOffset ::= INTEGER (0..10239) + +DSInformationList ::= SEQUENCE (SIZE(0..maxnoofDSInfo)) OF DSCP + +DSCP ::= BIT STRING (SIZE (6)) + +DUtoCURRCContainer ::= OCTET STRING + +DUCURadioInformationType ::= CHOICE { + rIM DUCURIMInformation, + choice-extension ProtocolIE-SingleContainer { { DUCURadioInformationType-ExtIEs} } +} + +DUCURadioInformationType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +DUCURIMInformation ::= SEQUENCE { + victimgNBSetID GNBSetID, + rIMRSDetectionStatus RIMRSDetectionStatus, + aggressorCellList AggressorCellList, + iE-Extensions ProtocolExtensionContainer { { DUCURIMInformation-ExtIEs} } OPTIONAL +} + +DUCURIMInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DUF-Slot-Config-Item ::= CHOICE { + explicitFormat ExplicitFormat, + implicitFormat ImplicitFormat, + choice-extension ProtocolIE-SingleContainer { { DUF-Slot-Config-Item-ExtIEs} } +} + +DUF-Slot-Config-Item-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} +DUF-Slot-Config-List ::= SEQUENCE (SIZE(1..maxnoofDUFSlots)) OF DUF-Slot-Config-Item + +DUFSlotformatIndex ::= INTEGER(0..254) + +DUFTransmissionPeriodicity ::= ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10, ...} + +DU-RX-MT-RX ::= ENUMERATED {supported, not-supported} + +DU-TX-MT-TX ::= ENUMERATED {supported, not-supported} + +DU-RX-MT-TX ::= ENUMERATED {supported, not-supported} + +DU-TX-MT-RX ::= ENUMERATED {supported, not-supported} + +DUtoCURRCInformation ::= SEQUENCE { + cellGroupConfig CellGroupConfig, + measGapConfig MeasGapConfig OPTIONAL, + requestedP-MaxFR1 OCTET STRING OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DUtoCURRCInformation-ExtIEs} } OPTIONAL, + ... +} + +DUtoCURRCInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-DRX-LongCycleStartOffset CRITICALITY ignore EXTENSION DRX-LongCycleStartOffset PRESENCE optional }| + { ID id-SelectedBandCombinationIndex CRITICALITY ignore EXTENSION SelectedBandCombinationIndex PRESENCE optional }| + { ID id-SelectedFeatureSetEntryIndex CRITICALITY ignore EXTENSION SelectedFeatureSetEntryIndex PRESENCE optional }| + { ID id-Ph-InfoSCG CRITICALITY ignore EXTENSION Ph-InfoSCG PRESENCE optional }| + { ID id-RequestedBandCombinationIndex CRITICALITY ignore EXTENSION RequestedBandCombinationIndex PRESENCE optional }| + { ID id-RequestedFeatureSetEntryIndex CRITICALITY ignore EXTENSION RequestedFeatureSetEntryIndex PRESENCE optional }| + { ID id-DRX-Config CRITICALITY ignore EXTENSION DRX-Config PRESENCE optional }| + { ID id-PDCCH-BlindDetectionSCG CRITICALITY ignore EXTENSION PDCCH-BlindDetectionSCG PRESENCE optional }| + { ID id-Requested-PDCCH-BlindDetectionSCG CRITICALITY ignore EXTENSION Requested-PDCCH-BlindDetectionSCG PRESENCE optional }| + { ID id-Ph-InfoMCG CRITICALITY ignore EXTENSION Ph-InfoMCG PRESENCE optional }| + { ID id-MeasGapSharingConfig CRITICALITY ignore EXTENSION MeasGapSharingConfig PRESENCE optional }| + { ID id-SL-PHY-MAC-RLC-Config CRITICALITY ignore EXTENSION SL-PHY-MAC-RLC-Config PRESENCE optional }| + { ID id-SL-ConfigDedicatedEUTRA CRITICALITY ignore EXTENSION SL-ConfigDedicatedEUTRA PRESENCE optional }| + { ID id-RequestedP-MaxFR2 CRITICALITY ignore EXTENSION RequestedP-MaxFR2 PRESENCE optional }, + ... +} + +DuplicationActivation ::= ENUMERATED{active,inactive,... } + +DuplicationIndication ::= ENUMERATED {true, ... , false } + +DuplicationState ::= ENUMERATED { + active, + inactive, + ... +} + +Dynamic5QIDescriptor ::= SEQUENCE { + qoSPriorityLevel INTEGER (1..127), + packetDelayBudget PacketDelayBudget, + packetErrorRate PacketErrorRate, + fiveQI INTEGER (0..255, ...) OPTIONAL, + delayCritical ENUMERATED {delay-critical, non-delay-critical} OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + averagingWindow AveragingWindow OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Dynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +Dynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ExtendedPacketDelayBudget CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetDownlink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetUplink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }, + ... +} + +DynamicPQIDescriptor ::= SEQUENCE { + resourceType ENUMERATED {gbr, non-gbr, delay-critical-grb, ...} OPTIONAL, + qoSPriorityLevel INTEGER (1..8, ...), + packetDelayBudget PacketDelayBudget, + packetErrorRate PacketErrorRate, + averagingWindow AveragingWindow OPTIONAL, + -- C-ifGBRflow: This IE shall be present if the GBR QoS Flow Information IE is present in the QoS Flow Level QoS Parameters IE. + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { DynamicPQIDescriptor-ExtIEs } } OPTIONAL +} + +DynamicPQIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- E + +E-CID-MeasurementPeriodicity ::= ENUMERATED { + ms120, + ms240, + ms480, + ms640, + ms1024, + ms2048, + ms5120, + ms10240, + min1, + min6, + min12, + min30, + min60, + ... +} + +E-CID-MeasurementQuantities ::= SEQUENCE (SIZE (1.. maxnoofMeasE-CID)) OF ProtocolIE-SingleContainer { {E-CID-MeasurementQuantities-ItemIEs} } + +E-CID-MeasurementQuantities-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-E-CID-MeasurementQuantities-Item CRITICALITY reject TYPE E-CID-MeasurementQuantities-Item PRESENCE mandatory} +} + +E-CID-MeasurementQuantities-Item ::= SEQUENCE { + e-CIDmeasurementQuantitiesValue E-CID-MeasurementQuantitiesValue, + iE-Extensions ProtocolExtensionContainer { { E-CID-MeasurementQuantitiesValue-ExtIEs} } OPTIONAL +} + +E-CID-MeasurementQuantitiesValue-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasurementQuantitiesValue ::= ENUMERATED { + cell-Portion, + angleOfArrivalNR, + ... +} + +E-CID-MeasurementResult ::= SEQUENCE { + geographicalCoordinates GeographicalCoordinates OPTIONAL, + measuredResults-List E-CID-MeasuredResults-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { E-CID-MeasurementResult-ExtIEs} } OPTIONAL +} + +E-CID-MeasurementResult-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasuredResults-List ::= SEQUENCE (SIZE(1..maxnoofMeasE-CID)) OF E-CID-MeasuredResults-Item + +E-CID-MeasuredResults-Item ::= SEQUENCE { + e-CID-MeasuredResults-Value E-CID-MeasuredResults-Value, + iE-Extensions ProtocolExtensionContainer {{ E-CID-MeasuredResults-Item-ExtIEs }} OPTIONAL +} + +E-CID-MeasuredResults-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-CID-MeasuredResults-Value ::= CHOICE { + valueAngleofArrivalNR UL-AoA, + choice-extension ProtocolIE-SingleContainer { { E-CID-MeasuredResults-Value-ExtIEs} } +} + +E-CID-MeasuredResults-Value-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +E-CID-ReportCharacteristics ::= ENUMERATED { + onDemand, + periodic, + ... +} + +EgressBHRLCCHList ::= SEQUENCE (SIZE(1..maxnoofEgressLinks)) OF EgressBHRLCCHItem + +EgressBHRLCCHItem ::= SEQUENCE { + nextHopBAPAddress BAPAddress, + bHRLCChannelID BHRLCChannelID, + iE-Extensions ProtocolExtensionContainer {{EgressBHRLCCHItemExtIEs }} OPTIONAL +} + +EgressBHRLCCHItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Endpoint-IP-address-and-port ::=SEQUENCE { + endpointIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { Endpoint-IP-address-and-port-ExtIEs} } OPTIONAL +} + +Endpoint-IP-address-and-port-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-portNumber CRITICALITY reject EXTENSION PortNumber PRESENCE optional}, + ... +} + +ExtendedAvailablePLMN-List ::= SEQUENCE (SIZE(1..maxnoofExtendedBPLMNs)) OF ExtendedAvailablePLMN-Item + +ExtendedAvailablePLMN-Item ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { ExtendedAvailablePLMN-Item-ExtIEs} } OPTIONAL +} + +ExplicitFormat ::= SEQUENCE { + permutation Permutation, + noofDownlinkSymbols NoofDownlinkSymbols OPTIONAL, + noofUplinkSymbols NoofUplinkSymbols OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExplicitFormat-ExtIEs} } OPTIONAL +} + +ExplicitFormat-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExtendedAvailablePLMN-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExtendedServedPLMNs-List ::= SEQUENCE (SIZE(1.. maxnoofExtendedBPLMNs)) OF ExtendedServedPLMNs-Item + +ExtendedServedPLMNs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + tAISliceSupportList SliceSupportList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExtendedServedPLMNs-ItemExtIEs} } OPTIONAL, + ... +} + +ExtendedServedPLMNs-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-NPNSupportInfo CRITICALITY reject EXTENSION NPNSupportInfo PRESENCE optional }| +{ ID id-ExtendedTAISliceSupportList CRITICALITY reject EXTENSION ExtendedSliceSupportList PRESENCE optional }, + ... +} + +ExtendedSliceSupportList ::= SEQUENCE (SIZE(1.. maxnoofExtSliceItems)) OF SliceSupportItem + +EUTRACells-List ::= SEQUENCE (SIZE (1.. maxCellineNB)) OF EUTRACells-List-item + +EUTRACells-List-item ::= SEQUENCE { + eUTRA-Cell-ID EUTRA-Cell-ID, + served-EUTRA-Cells-Information Served-EUTRA-Cells-Information, + iE-Extensions ProtocolExtensionContainer { { EUTRACells-List-itemExtIEs } } OPTIONAL +} + +EUTRACells-List-itemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +EUTRA-Cell-ID ::= BIT STRING (SIZE(28)) + +EUTRA-Coex-FDD-Info ::= SEQUENCE { + uL-EARFCN ExtendedEARFCN OPTIONAL, + dL-EARFCN ExtendedEARFCN, + uL-Transmission-Bandwidth EUTRA-Transmission-Bandwidth OPTIONAL, + dL-Transmission-Bandwidth EUTRA-Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {EUTRA-Coex-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-Coex-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ULCarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }| + { ID id-DLCarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }, + ... +} + +EUTRA-Coex-Mode-Info ::= CHOICE { + fDD EUTRA-Coex-FDD-Info, + tDD EUTRA-Coex-TDD-Info, + ... +} + +EUTRA-Coex-TDD-Info ::= SEQUENCE { + eARFCN ExtendedEARFCN, + transmission-Bandwidth EUTRA-Transmission-Bandwidth, + subframeAssignment EUTRA-SubframeAssignment, + specialSubframe-Info EUTRA-SpecialSubframe-Info, + iE-Extensions ProtocolExtensionContainer { {EUTRA-Coex-TDD-Info-ExtIEs} } OPTIONAL, + ... +} +EUTRA-Coex-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +EUTRA-CyclicPrefixDL ::= ENUMERATED { + normal, + extended, + ... +} + +EUTRA-CyclicPrefixUL ::= ENUMERATED { + normal, + extended, + ... +} + +EUTRA-PRACH-Configuration ::= SEQUENCE { + rootSequenceIndex INTEGER (0..837), + zeroCorrelationIndex INTEGER (0..15), + highSpeedFlag BOOLEAN, + prach-FreqOffset INTEGER (0..94), + prach-ConfigIndex INTEGER (0..63) OPTIONAL, + -- C-ifTDD: This IE shall be present if the EUTRA-Mode-Info IE in the Resource Coordination E-UTRA Cell Information IE is set to the value "TDD" + iE-Extensions ProtocolExtensionContainer { {EUTRA-PRACH-Configuration-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-PRACH-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +EUTRA-SpecialSubframe-Info ::= SEQUENCE { + specialSubframePatterns EUTRA-SpecialSubframePatterns, + cyclicPrefixDL EUTRA-CyclicPrefixDL, + cyclicPrefixUL EUTRA-CyclicPrefixUL, + iE-Extensions ProtocolExtensionContainer { { EUTRA-SpecialSubframe-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-SpecialSubframe-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-SpecialSubframePatterns ::= ENUMERATED { + ssp0, + ssp1, + ssp2, + ssp3, + ssp4, + ssp5, + ssp6, + ssp7, + ssp8, + ssp9, + ssp10, + ... +} + +EUTRA-SubframeAssignment ::= ENUMERATED { + sa0, + sa1, + sa2, + sa3, + sa4, + sa5, + sa6, + ... +} + +EUTRA-Transmission-Bandwidth ::= ENUMERATED { + bw6, + bw15, + bw25, + bw50, + bw75, + bw100, + ... +} + +EUTRANQoS ::= SEQUENCE { + qCI QCI, + allocationAndRetentionPriority AllocationAndRetentionPriority, + gbrQosInformation GBR-QosInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { EUTRANQoS-ExtIEs} } OPTIONAL, + ... +} + +EUTRANQoS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExecuteDuplication ::= ENUMERATED{true,...} + +ExtendedEARFCN ::= INTEGER (0..262143) + +EUTRA-Mode-Info ::= CHOICE { + eUTRAFDD EUTRA-FDD-Info, + eUTRATDD EUTRA-TDD-Info, + choice-extension ProtocolIE-SingleContainer { { EUTRA-Mode-Info-ExtIEs} } +} + +EUTRA-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +EUTRA-NR-CellResourceCoordinationReq-Container ::= OCTET STRING + +EUTRA-NR-CellResourceCoordinationReqAck-Container ::= OCTET STRING + +EUTRA-FDD-Info ::= SEQUENCE { + uL-offsetToPointA OffsetToPointA, + dL-offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-TDD-Info ::= SEQUENCE { + offsetToPointA OffsetToPointA, + iE-Extensions ProtocolExtensionContainer { {EUTRA-TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +EUTRA-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EventType ::= ENUMERATED { + on-demand, + periodic, + stop, + ... +} + +ExtendedPacketDelayBudget ::= INTEGER (1..65535, ...) + +-- F + +FDD-Info ::= SEQUENCE { + uL-NRFreqInfo NRFreqInfo, + dL-NRFreqInfo NRFreqInfo, + uL-Transmission-Bandwidth Transmission-Bandwidth, + dL-Transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Flows-Mapped-To-DRB-List ::= SEQUENCE (SIZE(1.. maxnoofQoSFlows)) OF Flows-Mapped-To-DRB-Item + +Flows-Mapped-To-DRB-Item ::= SEQUENCE { + qoSFlowIdentifier QoSFlowIdentifier, + qoSFlowLevelQoSParameters QoSFlowLevelQoSParameters, + iE-Extensions ProtocolExtensionContainer { { Flows-Mapped-To-DRB-ItemExtIEs} } OPTIONAL +} + +Flows-Mapped-To-DRB-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-QoSFlowMappingIndication CRITICALITY ignore EXTENSION QoSFlowMappingIndication PRESENCE optional}| + {ID id-TSCTrafficCharacteristics CRITICALITY ignore EXTENSION TSCTrafficCharacteristics PRESENCE optional}, + ... +} + +FR1-Bandwidth ::= ENUMERATED {bw5, bw10, bw20, bw40, bw50, bw80, bw100, ...} + +FR2-Bandwidth ::= ENUMERATED {bw50, bw100, bw200, bw400, ...} + +FreqBandNrItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + supportedSULBandList SEQUENCE (SIZE(0..maxnoofNrCellBands)) OF SupportedSULFreqBandItem, + iE-Extensions ProtocolExtensionContainer { {FreqBandNrItem-ExtIEs} } OPTIONAL, + ... +} + +FreqBandNrItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +FreqDomainLength ::= CHOICE { + l839 L839Info, + l139 L139Info, + choice-extension ProtocolIE-SingleContainer { {FreqDomainLength-ExtIEs} } +} + +FreqDomainLength-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +FrequencyShift7p5khz ::= ENUMERATED {false, true, ...} + +FullConfiguration ::= ENUMERATED {full, ...} + +FlowsMappedToSLDRB-List ::= SEQUENCE (SIZE(1.. maxnoofPC5QoSFlows)) OF FlowsMappedToSLDRB-Item + +FlowsMappedToSLDRB-Item ::= SEQUENCE { + pc5QoSFlowIdentifier PC5QoSFlowIdentifier, + iE-Extensions ProtocolExtensionContainer { {FlowsMappedToSLDRB-Item-ExtIEs} } OPTIONAL, + ... +} + +FlowsMappedToSLDRB-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- G + + +GBR-QosInformation ::= SEQUENCE { + e-RAB-MaximumBitrateDL BitRate, + e-RAB-MaximumBitrateUL BitRate, + e-RAB-GuaranteedBitrateDL BitRate, + e-RAB-GuaranteedBitrateUL BitRate, + iE-Extensions ProtocolExtensionContainer { { GBR-QosInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GBR-QoSFlowInformation::= SEQUENCE { + maxFlowBitRateDownlink BitRate, + maxFlowBitRateUplink BitRate, + guaranteedFlowBitRateDownlink BitRate, + guaranteedFlowBitRateUplink BitRate, + maxPacketLossRateDownlink MaxPacketLossRate OPTIONAL, + maxPacketLossRateUplink MaxPacketLossRate OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GBR-QosFlowInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosFlowInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AlternativeQoSParaSetList CRITICALITY ignore EXTENSION AlternativeQoSParaSetList PRESENCE optional }, + ... +} + +CG-Config ::= OCTET STRING + +GeographicalCoordinates ::= SEQUENCE { + tRPPositionDefinitionType TRPPositionDefinitionType, + dLPRSResourceCoordinates DLPRSResourceCoordinates OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GeographicalCoordinates-ExtIEs } } OPTIONAL +} + +GeographicalCoordinates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNBCUMeasurementID ::= INTEGER (0.. 4095, ...) + +GNBDUMeasurementID ::= INTEGER (0.. 4095, ...) + +GNB-CUSystemInformation::= SEQUENCE { + sibtypetobeupdatedlist SEQUENCE (SIZE(1.. maxnoofSIBTypes)) OF SibtypetobeupdatedListItem, + iE-Extensions ProtocolExtensionContainer { { GNB-CUSystemInformation-ExtIEs} } OPTIONAL, + ... +} + +GNB-CUSystemInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-systemInformationAreaID CRITICALITY ignore EXTENSION SystemInformationAreaID PRESENCE optional}, + ... +} + +GNB-CU-TNL-Association-Setup-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + cause Cause, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-Failed-To-Setup-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +GNB-CU-TNL-Association-To-Add-Item ::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Add-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Add-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-TNL-Association-To-Remove-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Remove-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-TNLAssociationTransportLayerAddressgNBDU CRITICALITY reject EXTENSION CP-TransportLayerAddress PRESENCE optional}, + ... +} + + +GNB-CU-TNL-Association-To-Update-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationUsage TNLAssociationUsage OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-CU-TNL-Association-To-Update-Item-ExtIEs} } OPTIONAL +} + +GNB-CU-TNL-Association-To-Update-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-Cell-Resource-Configuration ::= SEQUENCE { + subcarrierSpacing SubcarrierSpacing, + dUFTransmissionPeriodicity DUFTransmissionPeriodicity OPTIONAL, + dUF-Slot-Config-List DUF-Slot-Config-List OPTIONAL, + hSNATransmissionPeriodicity HSNATransmissionPeriodicity, + hNSASlotConfigList HSNASlotConfigList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Cell-Resource-Configuration-ExtIEs } } OPTIONAL +} + +GNB-DU-Cell-Resource-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-UE-F1AP-ID ::= INTEGER (0..4294967295) + +GNB-DU-ID ::= INTEGER (0..68719476735) + +GNB-CU-Name ::= PrintableString(SIZE(1..150,...)) + +GNB-DU-Name ::= PrintableString(SIZE(1..150,...)) + +Extended-GNB-CU-Name ::= SEQUENCE { + gNB-CU-NameVisibleString GNB-CU-NameVisibleString OPTIONAL, + gNB-CU-NameUTF8String GNB-CU-NameUTF8String OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Extended-GNB-CU-Name-ExtIEs } } OPTIONAL, + ... +} + +Extended-GNB-CU-Name-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-CU-NameVisibleString ::= VisibleString(SIZE(1..150,...)) + +GNB-CU-NameUTF8String ::= UTF8String(SIZE(1..150,...)) + +Extended-GNB-DU-Name ::= SEQUENCE { + gNB-DU-NameVisibleString GNB-DU-NameVisibleString OPTIONAL, + gNB-DU-NameUTF8String GNB-DU-NameUTF8String OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Extended-GNB-DU-Name-ExtIEs } } OPTIONAL, + ... +} + +Extended-GNB-DU-Name-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-NameVisibleString ::= VisibleString(SIZE(1..150,...)) + +GNB-DU-NameUTF8String ::= UTF8String(SIZE(1..150,...)) + + +GNB-DU-Served-Cells-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-Served-Cells-ItemExtIEs} } OPTIONAL, + ... +} + +GNB-DU-Served-Cells-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-DU-System-Information ::= SEQUENCE { + mIB-message MIB-message, + sIB1-message SIB1-message, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-System-Information-ExtIEs } } OPTIONAL, + ... +} + +GNB-DU-System-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-SIB12-message CRITICALITY ignore EXTENSION SIB12-message PRESENCE optional}| + { ID id-SIB13-message CRITICALITY ignore EXTENSION SIB13-message PRESENCE optional}| + { ID id-SIB14-message CRITICALITY ignore EXTENSION SIB14-message PRESENCE optional}| + { ID id-SIB10-message CRITICALITY ignore EXTENSION SIB10-message PRESENCE optional}, + ... +} + +GNB-DUConfigurationQuery ::= ENUMERATED {true, ...} + +GNBDUOverloadInformation ::= ENUMERATED {overloaded, not-overloaded} + +GNB-DU-TNL-Association-To-Remove-Item::= SEQUENCE { + tNLAssociationTransportLayerAddress CP-TransportLayerAddress , + tNLAssociationTransportLayerAddressgNBCU CP-TransportLayerAddress OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-DU-TNL-Association-To-Remove-Item-ExtIEs} } OPTIONAL +} + +GNB-DU-TNL-Association-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GNB-RxTxTimeDiff ::= SEQUENCE { + rxTxTimeDiff GNBRxTxTimeDiffMeas, + additionalPath-List AdditionalPath-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { GNB-RxTxTimeDiff-ExtIEs} } OPTIONAL +} + +GNB-RxTxTimeDiff-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + + ... +} + +GNBRxTxTimeDiffMeas ::= CHOICE { + k0 INTEGER (0.. 1970049), + k1 INTEGER (0.. 985025), + k2 INTEGER (0.. 492513), + k3 INTEGER (0.. 246257), + k4 INTEGER (0.. 123129), + k5 INTEGER (0.. 61565), + choice-extension ProtocolIE-SingleContainer { { GNBRxTxTimeDiffMeas-ExtIEs } } +} + +GNBRxTxTimeDiffMeas-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +GNBSetID ::= BIT STRING (SIZE(22)) + +GTP-TEID ::= OCTET STRING (SIZE (4)) + +GTPTLAs ::= SEQUENCE (SIZE(1.. maxnoofGTPTLAs)) OF GTPTLA-Item + + +GTPTLA-Item ::= SEQUENCE { + gTPTransportLayerAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { GTPTLA-Item-ExtIEs } } OPTIONAL +} + +GTPTLA-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GTPTunnel ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { GTPTunnel-ExtIEs } } OPTIONAL, + ... +} + +GTPTunnel-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- H + +HandoverPreparationInformation ::= OCTET STRING + +HardwareLoadIndicator ::= SEQUENCE { + dLHardwareLoadIndicator INTEGER (0..100, ...), + uLHardwareLoadIndicator INTEGER (0..100, ...), + iE-Extensions ProtocolExtensionContainer { { HardwareLoadIndicator-ExtIEs } } OPTIONAL, + ... +} + +HardwareLoadIndicator-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +HSNASlotConfigList ::= SEQUENCE (SIZE(1..maxnoofHSNASlots)) OF HSNASlotConfigItem + +HSNASlotConfigItem ::= SEQUENCE { + hSNADownlink HSNADownlink OPTIONAL, + hSNAUplink HSNAUplink OPTIONAL, + hSNAFlexible HSNAFlexible OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { HSNASlotConfigItem-ExtIEs } } OPTIONAL +} + +HSNASlotConfigItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +HSNADownlink ::= ENUMERATED { hard, soft, notavailable } + +HSNAFlexible ::= ENUMERATED { hard, soft, notavailable } + +HSNAUplink ::= ENUMERATED { hard, soft, notavailable } + +HSNATransmissionPeriodicity ::= ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10, ms20, ms40, ms80, ms160, ...} + +-- I + +IAB-Barred ::= ENUMERATED {barred, not-barred, ...} + +IAB-Info-IAB-donor-CU ::= SEQUENCE{ + iAB-STC-Info IAB-STC-Info OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Info-IAB-donor-CU-ExtIEs } } OPTIONAL +} + +IAB-Info-IAB-donor-CU-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-Info-IAB-DU ::= SEQUENCE{ + multiplexingInfo MultiplexingInfo OPTIONAL, + iAB-STC-Info IAB-STC-Info OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Info-IAB-DU-ExtIEs } } OPTIONAL +} + +IAB-Info-IAB-DU-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-MT-Cell-List ::= SEQUENCE (SIZE(1..maxnoofServingCells)) OF IAB-MT-Cell-List-Item + +IAB-MT-Cell-List-Item ::= SEQUENCE { + nRCellIdentity NRCellIdentity, + dU-RX-MT-RX DU-RX-MT-RX, + dU-TX-MT-TX DU-TX-MT-TX, + dU-RX-MT-TX DU-RX-MT-TX, + dU-TX-MT-RX DU-TX-MT-RX, + iE-Extensions ProtocolExtensionContainer { { IAB-MT-Cell-List-Item-ExtIEs } } OPTIONAL +} + +IAB-MT-Cell-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-STC-Info ::= SEQUENCE{ + iAB-STC-Info-List IAB-STC-Info-List, + iE-Extensions ProtocolExtensionContainer { { IAB-STC-Info-ExtIEs } } OPTIONAL +} + +IAB-STC-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-STC-Info-List ::= SEQUENCE (SIZE(1..maxnoofIABSTCInfo)) OF IAB-STC-Info-Item + +IAB-STC-Info-Item::= SEQUENCE { + sSB-freqInfo SSB-freqInfo, + sSB-subcarrierSpacing SSB-subcarrierSpacing, + sSB-transmissionPeriodicity SSB-transmissionPeriodicity, + sSB-transmissionTimingOffset SSB-transmissionTimingOffset, + sSB-transmissionBitmap SSB-transmissionBitmap, + iE-Extensions ProtocolExtensionContainer { { IAB-STC-Info-Item-ExtIEs } } OPTIONAL +} + +IAB-STC-Info-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-Allocated-TNL-Address-Item ::= SEQUENCE { + iABTNLAddress IABTNLAddress, + iABTNLAddressUsage IABTNLAddressUsage OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IAB-Allocated-TNL-Address-Item-ExtIEs } } OPTIONAL +} + +IAB-Allocated-TNL-Address-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-Mode-Info ::= CHOICE { + fDD IAB-DU-Cell-Resource-Configuration-FDD-Info, + tDD IAB-DU-Cell-Resource-Configuration-TDD-Info, + choice-extension ProtocolIE-SingleContainer { { IAB-DU-Cell-Resource-Configuration-Mode-Info-ExtIEs} } +} + +IAB-DU-Cell-Resource-Configuration-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-FDD-Info ::= SEQUENCE { + gNB-DU-Cell-Resource-Configuration-FDD-UL GNB-DU-Cell-Resource-Configuration, + gNB-DU-Cell-Resource-Configuration-FDD-DL GNB-DU-Cell-Resource-Configuration, + iE-Extensions ProtocolExtensionContainer { {IAB-DU-Cell-Resource-Configuration-FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +IAB-DU-Cell-Resource-Configuration-FDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-DU-Cell-Resource-Configuration-TDD-Info ::= SEQUENCE { + gNB-DU-Cell-Resourc-Configuration-TDD GNB-DU-Cell-Resource-Configuration, + iE-Extensions ProtocolExtensionContainer { {IAB-DU-Cell-Resource-Configuration-TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +IAB-DU-Cell-Resource-Configuration-TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IABIPv6RequestType ::= CHOICE { + iPv6Address IABTNLAddressesRequested, + iPv6Prefix IABTNLAddressesRequested, + choice-extension ProtocolIE-SingleContainer { { IABIPv6RequestType-ExtIEs} } +} + +IABIPv6RequestType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IABTNLAddress ::= CHOICE { + iPv4Address BIT STRING (SIZE(32)), + iPv6Address BIT STRING (SIZE(128)), + iPv6Prefix BIT STRING (SIZE(64)), + choice-extension ProtocolIE-SingleContainer { { IABTNLAddress-ExtIEs} } +} + +IABTNLAddress-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +IABTNLAddressesRequested ::= SEQUENCE { + tNLAddressesOrPrefixesRequestedAllTraffic INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedF1-C INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedF1-U INTEGER (1..256) OPTIONAL, + tNLAddressesOrPrefixesRequestedNoNF1 INTEGER (1..256) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IABTNLAddressesRequested-ExtIEs } } OPTIONAL +} + +IABTNLAddressesRequested-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IAB-TNL-Addresses-To-Remove-Item ::= SEQUENCE { + iABTNLAddress IABTNLAddress, + iE-Extensions ProtocolExtensionContainer { { IAB-TNL-Addresses-To-Remove-Item-ExtIEs} } OPTIONAL +} + +IAB-TNL-Addresses-To-Remove-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IABTNLAddressUsage ::= ENUMERATED { + f1-c, + f1-u, + non-f1, + ... +} + + +IABv4AddressesRequested ::= SEQUENCE { + iABv4AddressesRequested IABTNLAddressesRequested, + iE-Extensions ProtocolExtensionContainer { { IABv4AddressesRequested-ExtIEs} } OPTIONAL +} + +IABv4AddressesRequested-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ImplicitFormat ::= SEQUENCE { + dUFSlotformatIndex DUFSlotformatIndex, + iE-Extensions ProtocolExtensionContainer { { ImplicitFormat-ExtIEs } } OPTIONAL +} + +ImplicitFormat-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IgnorePRACHConfiguration::= ENUMERATED { true,...} + +IgnoreResourceCoordinationContainer ::= ENUMERATED { yes,...} +InactivityMonitoringRequest ::= ENUMERATED { true,...} +InactivityMonitoringResponse ::= ENUMERATED { not-supported,...} +InterfacesToTrace ::= BIT STRING (SIZE(8)) + +IntendedTDD-DL-ULConfig ::= SEQUENCE { + nRSCS ENUMERATED { scs15, scs30, scs60, scs120,...}, + nRCP ENUMERATED { normal, extended,...}, + nRDLULTxPeriodicity ENUMERATED { ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms3, ms4, ms5, ms10, ms20, ms40, ms60, ms80, ms100, ms120, ms140, ms160, ...}, + slot-Configuration-List Slot-Configuration-List, + iE-Extensions ProtocolExtensionContainer { {IntendedTDD-DL-ULConfig-ExtIEs} } OPTIONAL +} + +IntendedTDD-DL-ULConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IPHeaderInformation ::= SEQUENCE { + destinationIABTNLAddress IABTNLAddress, + dsInformationList DSInformationList OPTIONAL, + iPv6FlowLabel BIT STRING (SIZE (20)) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IPHeaderInformation-ItemExtIEs} } OPTIONAL, + ... +} + +IPHeaderInformation-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IPtolayer2TrafficMappingInfo ::= SEQUENCE { + iPtolayer2TrafficMappingInfoToAdd IPtolayer2TrafficMappingInfoList OPTIONAL, + iPtolayer2TrafficMappingInfoToRemove MappingInformationtoRemove OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { IPtolayer2TrafficMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +IPtolayer2TrafficMappingInfoList ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF IPtolayer2TrafficMappingInfo-Item + +IPtolayer2TrafficMappingInfo-Item ::= SEQUENCE { + mappingInformationIndex MappingInformationIndex, + iPHeaderInformation IPHeaderInformation, + bHInfo BHInfo, iE-Extensions ProtocolExtensionContainer { { IPtolayer2TrafficMappingInfo-ItemExtIEs} } OPTIONAL, + ... +} + +IPtolayer2TrafficMappingInfo-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- J + +-- K + +-- L + +L139Info ::= SEQUENCE { + msg1SCS ENUMERATED {scs15, scs30, scs60, scs120, ...}, + rootSequenceIndex INTEGER (0..137) OPTIONAL, + iE-Extension ProtocolExtensionContainer { {L139Info-ExtIEs} } OPTIONAL, + ... +} + +L139Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +L839Info ::= SEQUENCE { + rootSequenceIndex INTEGER (0..837), + restrictedSetConfig ENUMERATED {unrestrictedSet, restrictedSetTypeA, + restrictedSetTypeB, ...}, + iE-Extension ProtocolExtensionContainer { {L839Info-ExtIEs} } OPTIONAL, + ... +} + +L839Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LCID ::= INTEGER (1..32, ...) + + +LCStoGCSTranslationList ::= SEQUENCE (SIZE (1.. maxnooflcs-gcs-translation)) OF LCStoGCSTranslation + +LCStoGCSTranslation ::= SEQUENCE { + alpha INTEGER (0..359), + alpha-fine INTEGER (0..9), + beta INTEGER (0..359), + beta-fine INTEGER (0..9), + gamma INTEGER (0..359), + gamma-fine INTEGER (0..9), + iE-Extensions ProtocolExtensionContainer { {LCStoGCSTranslation-ExtIEs} } OPTIONAL +} + +LCStoGCSTranslation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LMF-MeasurementID ::= INTEGER (1.. 65536, ...) + +LMF-UE-MeasurementID ::= INTEGER (1.. 256, ...) + +LocationUncertainty ::= SEQUENCE { + horizontalUncertainty INTEGER (0..255), + horizontalConfidence INTEGER (0..100), + verticalUncertainty INTEGER (0..255), + verticalConfidence INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { LocationUncertainty-ExtIEs} } OPTIONAL +} + +LocationUncertainty-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LongDRXCycleLength ::= ENUMERATED +{ms10, ms20, ms32, ms40, ms60, ms64, ms70, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ms1024, ms1280, ms2048, ms2560, ms5120, ms10240, ...} + +LowerLayerPresenceStatusChange ::= ENUMERATED { + suspend-lower-layers, + resume-lower-layers, + ... + +} + +LTEUESidelinkAggregateMaximumBitrate ::= SEQUENCE { + uELTESidelinkAggregateMaximumBitrate BitRate, + iE-Extensions ProtocolExtensionContainer { {LTEUESidelinkAggregateMaximumBitrate-ExtIEs} } OPTIONAL +} + +LTEUESidelinkAggregateMaximumBitrate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LTEV2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, + pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {LTEV2XServicesAuthorized-ExtIEs} } OPTIONAL +} + +LTEV2XServicesAuthorized-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- M + +MappingInformationIndex ::= BIT STRING (SIZE (26)) + +MappingInformationtoRemove ::= SEQUENCE (SIZE(1..maxnoofMappingEntries)) OF MappingInformationIndex + +MaskedIMEISV ::= BIT STRING (SIZE (64)) + +MaxDataBurstVolume ::= INTEGER (0..4095, ..., 4096.. 2000000) +MaxPacketLossRate ::= INTEGER (0..1000) + +MIB-message ::= OCTET STRING + +MeasConfig ::= OCTET STRING + +MeasGapConfig ::= OCTET STRING + +MeasGapSharingConfig ::= OCTET STRING + +MeasurementBeamInfoRequest ::= ENUMERATED {true, ...} + +MeasurementBeamInfo ::= SEQUENCE { + pRS-Resource-ID PRS-Resource-ID OPTIONAL, + pRS-Resource-Set-ID PRS-Resource-Set-ID OPTIONAL, + sSB-Index SSB-Index OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { MeasurementBeamInfo-ExtIEs} } OPTIONAL +} + +MeasurementBeamInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +MeasurementTimingConfiguration ::= OCTET STRING + +MessageIdentifier ::= BIT STRING (SIZE (16)) + +MultiplexingInfo ::= SEQUENCE{ + iAB-MT-Cell-List IAB-MT-Cell-List, + iE-Extensions ProtocolExtensionContainer { {MultiplexingInfo-ExtIEs} } OPTIONAL +} + +MultiplexingInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M2Configuration ::= ENUMERATED {true, ...} + + +M5Configuration ::= SEQUENCE { + m5period M5period, + m5-links-to-log M5-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M5Configuration-ExtIEs} } OPTIONAL, + ... +} + +M5Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M5period ::= ENUMERATED { ms1024, ms2048, ms5120, ms10240, min1, ... } + +M5-Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + + +M6Configuration ::= SEQUENCE { + m6report-Interval M6report-Interval, + m6-links-to-log M6-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M6Configuration-ExtIEs} } OPTIONAL, + ... +} + +M6Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M6report-Interval ::= ENUMERATED { ms120, ms240, ms640, ms1024, ms2048, ms5120, ms10240, ms20480, ms40960, min1, min6, min12, min30, ... } + + + +M6-Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + + +M7Configuration ::= SEQUENCE { + m7period M7period, + m7-links-to-log M7-Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M7Configuration-ExtIEs} } OPTIONAL, + ... +} + +M7Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M7period ::= INTEGER(1..60, ...) + +M7-Links-to-log ::= ENUMERATED {downlink, ...} + +MDT-Activation ::= ENUMERATED { + immediate-MDT-only, + immediate-MDT-and-Trace, + ... +} + +MDTConfiguration ::= SEQUENCE { + mdt-Activation MDT-Activation, + measurementsToActivate MeasurementsToActivate, + m2Configuration M2Configuration OPTIONAL, + -- C-ifM2: This IE shall be present if the Measurements to Activate IE has the second bit set to "1". + m5Configuration M5Configuration OPTIONAL, + -- C-ifM5: This IE shall be present if the Measurements to Activate IE has the fifth bit set to "1". + m6Configuration M6Configuration OPTIONAL, + -- C-ifM6: This IE shall be present if the Measurements to Activate IE has the seventh bit set to "1". + m7Configuration M7Configuration OPTIONAL, + -- C-ifM7: This IE shall be present if the Measurements to Activate IE has the eighth bit set to "1". + iE-Extensions ProtocolExtensionContainer { { MDTConfiguration-ExtIEs} } OPTIONAL, + ... +} +MDTConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +MDTPLMNList ::= SEQUENCE (SIZE(1..maxnoofMDTPLMNs)) OF PLMN-Identity + + +MeasuredResultsValue ::= CHOICE { + uL-AngleOfArrival UL-AoA, + uL-SRS-RSRP UL-SRS-RSRP, + uL-RTOA UL-RTOA-Measurement, + gNB-RxTxTimeDiff GNB-RxTxTimeDiff, + choice-extension ProtocolIE-SingleContainer { { MeasuredResultsValue-ExtIEs } } +} + +MeasuredResultsValue-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +MeasurementsToActivate ::= BIT STRING (SIZE (8)) + +-- N + +NeedforGap::= ENUMERATED {true, ...} + +Neighbour-Cell-Information-Item ::= SEQUENCE { + nRCGI NRCGI, + intendedTDD-DL-ULConfig IntendedTDD-DL-ULConfig OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Neighbour-Cell-Information-ItemExtIEs } } OPTIONAL +} + +Neighbour-Cell-Information-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NGRANAllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {NGRANAllocationAndRetentionPriority-ExtIEs} } OPTIONAL +} + +NGRANAllocationAndRetentionPriority-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +NGRANHighAccuracyAccessPointPosition ::= SEQUENCE { + latitude INTEGER (-2147483648.. 2147483647), + longitude INTEGER (-2147483648.. 2147483647), + altitude INTEGER (-64000..1280000), + uncertaintySemi-major INTEGER (0..255), + uncertaintySemi-minor INTEGER (0..255), + orientationOfMajorAxis INTEGER (0..179), + horizontalConfidence INTEGER (0..100), + uncertaintyAltitude INTEGER (0..255), + verticalConfidence INTEGER (0..100), + + iE-Extensions ProtocolExtensionContainer { { NGRANHighAccuracyAccessPointPosition-ExtIEs} } OPTIONAL +} + +NGRANHighAccuracyAccessPointPosition-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NID ::= BIT STRING (SIZE(44)) + +NR-CGI-List-For-Restart-Item ::= SEQUENCE { + nRCGI NRCGI, + iE-Extensions ProtocolExtensionContainer { { NR-CGI-List-For-Restart-ItemExtIEs } } OPTIONAL, + ... +} + +NR-CGI-List-For-Restart-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-PRSBeamInformation ::= SEQUENCE { + nR-PRSBeamInformationList NR-PRSBeamInformationList, + lCStoGCSTranslationList LCStoGCSTranslationList, + iE-Extensions ProtocolExtensionContainer { { NR-PRSBeamInformation-ExtIEs } } OPTIONAL +} + +NR-PRSBeamInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-PRSBeamInformationList ::= SEQUENCE (SIZE(1.. maxnoofPRS-ResourceSets)) OF NR-PRSBeamInformationItem + +NR-PRSBeamInformationItem ::= SEQUENCE { + pRSResourceSetID INTEGER (0..7), + pRSAngleList PRSAngleList, + iE-Extensions ProtocolExtensionContainer { { NR-PRSBeamInformationItem-ExtIEs } } OPTIONAL +} + +NR-PRSBeamInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NonDynamic5QIDescriptor ::= SEQUENCE { + fiveQI INTEGER (0..255, ...), + qoSPriorityLevel INTEGER (1..127) OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NonDynamic5QIDescriptor-ExtIEs } } OPTIONAL +} + +NonDynamic5QIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CNPacketDelayBudgetDownlink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }| + { ID id-CNPacketDelayBudgetUplink CRITICALITY ignore EXTENSION ExtendedPacketDelayBudget PRESENCE optional }, + ... +} + +NonDynamicPQIDescriptor ::= SEQUENCE { + fiveQI INTEGER (0..255, ...), + qoSPriorityLevel INTEGER (1..8, ...) OPTIONAL, + averagingWindow AveragingWindow OPTIONAL, + maxDataBurstVolume MaxDataBurstVolume OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NonDynamicPQIDescriptor-ExtIEs } } OPTIONAL +} + +NonDynamicPQIDescriptor-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NonUPTrafficType ::= ENUMERATED {ue-associated, non-ue-associated, non-f1, bap-control-pdu,...} + +NoofDownlinkSymbols ::= INTEGER (0..14) + +NoofUplinkSymbols ::= INTEGER (0..14) + +Notification-Cause ::= ENUMERATED {fulfilled, not-fulfilled, ...} + +NotificationControl ::= ENUMERATED {active, not-active, ...} + +NotificationInformation ::= SEQUENCE { + message-Identifier MessageIdentifier, + serialNumber SerialNumber, + iE-Extensions ProtocolExtensionContainer { { NotificationInformationExtIEs} } OPTIONAL, + ... +} + +NotificationInformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NPNBroadcastInformation ::= CHOICE { + sNPN-Broadcast-Information NPN-Broadcast-Information-SNPN, + pNI-NPN-Broadcast-Information NPN-Broadcast-Information-PNI-NPN, + choice-extension ProtocolIE-SingleContainer { {NPNBroadcastInformation-ExtIEs} } +} + +NPNBroadcastInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +NPN-Broadcast-Information-SNPN ::= SEQUENCE { + broadcastSNPNID-List BroadcastSNPN-ID-List, + iE-Extension ProtocolExtensionContainer { {NPN-Broadcast-Information-SNPN-ExtIEs} } OPTIONAL, + ... +} + +NPN-Broadcast-Information-SNPN-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} +NPN-Broadcast-Information-PNI-NPN ::= SEQUENCE { + broadcastPNI-NPN-ID-Information BroadcastPNI-NPN-ID-List, + iE-Extension ProtocolExtensionContainer { {NPN-Broadcast-Information-PNI-NPN-ExtIEs} } OPTIONAL, + ... +} + +NPN-Broadcast-Information-PNI-NPN-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +NPNSupportInfo ::= CHOICE { + sNPN-Information NID, + choice-extension ProtocolIE-SingleContainer { { NPNSupportInfo-ExtIEs } } +} + +NPNSupportInfo-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +NRCarrierList ::= SEQUENCE (SIZE(1..maxnoofNRSCSs)) OF NRCarrierItem + +NRCarrierItem ::= SEQUENCE { + carrierSCS NRSCS, + offsetToCarrier INTEGER (0..2199, ...), + carrierBandwidth INTEGER (0..maxnoofPhysicalResourceBlocks, ...), + iE-Extension ProtocolExtensionContainer { {NRCarrierItem-ExtIEs} } OPTIONAL, + ... +} + +NRCarrierItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRFreqInfo ::= SEQUENCE { + nRARFCN INTEGER (0..maxNRARFCN), + sul-Information SUL-Information OPTIONAL, + freqBandListNr SEQUENCE (SIZE(1..maxnoofNrCellBands)) OF FreqBandNrItem, + iE-Extensions ProtocolExtensionContainer { { NRFreqInfoExtIEs} } OPTIONAL, + ... +} + +NRFreqInfoExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-FrequencyShift7p5khz CRITICALITY ignore EXTENSION FrequencyShift7p5khz PRESENCE optional }, + ... +} + +NRCGI ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + nRCellIdentity NRCellIdentity, + iE-Extensions ProtocolExtensionContainer { {NRCGI-ExtIEs} } OPTIONAL, + ... +} + +NRCGI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NR-Mode-Info ::= CHOICE { + fDD FDD-Info, + tDD TDD-Info, + choice-extension ProtocolIE-SingleContainer { { NR-Mode-Info-ExtIEs} } +} + +NR-Mode-Info-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + + +NRPRACHConfig ::= SEQUENCE { + ulPRACHConfigList NRPRACHConfigList OPTIONAL, + sulPRACHConfigList NRPRACHConfigList OPTIONAL, + iE-Extension ProtocolExtensionContainer { {NRPRACHConfig-ExtIEs} } OPTIONAL, + ... +} + +NRPRACHConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRCellIdentity ::= BIT STRING (SIZE(36)) + +NRNRB ::= ENUMERATED { nrb11, nrb18, nrb24, nrb25, nrb31, nrb32, nrb38, nrb51, nrb52, nrb65, nrb66, nrb78, nrb79, nrb93, nrb106, nrb107, nrb121, nrb132, nrb133, nrb135, nrb160, nrb162, nrb189, nrb216, nrb217, nrb245, nrb264, nrb270, nrb273, ...} + +NRPCI ::= INTEGER(0..1007) + + +NRPRACHConfigList ::= SEQUENCE (SIZE(0..maxnoofPRACHconfigs)) OF NRPRACHConfigItem + +NRPRACHConfigItem ::= SEQUENCE { + nRSCS NRSCS, + prachFreqStartfromCarrier INTEGER (0..maxnoofPhysicalResourceBlocks-1, ...), + msg1FDM ENUMERATED {one, two, four, eight, ...}, + parchConfigIndex INTEGER (0..255, ...), + ssb-perRACH-Occasion ENUMERATED {oneEighth, oneFourth, oneHalf, one, + two, four, eight, sixteen, ...}, + freqDomainLength FreqDomainLength, + zeroCorrelZoneConfig INTEGER (0..15), + iE-Extension ProtocolExtensionContainer { { NRPRACHConfigItem-ExtIEs} } OPTIONAL, + ... +} + +NRPRACHConfigItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRSCS ::= ENUMERATED { scs15, scs30, scs60, scs120, ...} + +NRUERLFReportContainer ::= OCTET STRING + +NumberofActiveUEs ::= INTEGER(0..16777215, ...) + +NumberOfBroadcasts ::= INTEGER (0..65535) + +NumberofBroadcastRequest ::= INTEGER (0..65535) + +NumDLULSymbols ::= SEQUENCE { + numDLSymbols INTEGER (0..13, ...), + numULSymbols INTEGER (0..13, ...), + iE-Extensions ProtocolExtensionContainer { { NumDLULSymbols-ExtIEs} } OPTIONAL +} + +NumDLULSymbols-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRV2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, + pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {NRV2XServicesAuthorized-ExtIEs} } OPTIONAL +} + +NRV2XServicesAuthorized-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NRUESidelinkAggregateMaximumBitrate ::= SEQUENCE { + uENRSidelinkAggregateMaximumBitrate BitRate, + iE-Extensions ProtocolExtensionContainer { {NRUESidelinkAggregateMaximumBitrate-ExtIEs} } OPTIONAL +} + +NRUESidelinkAggregateMaximumBitrate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NZP-CSI-RS-ResourceID::= INTEGER (0..191, ...) + + +-- O + +OffsetToPointA ::= INTEGER (0..2199,...) + + +-- P + +PacketDelayBudget ::= INTEGER (0..1023, ...) + +PacketErrorRate ::= SEQUENCE { + pER-Scalar PER-Scalar, + pER-Exponent PER-Exponent, + iE-Extensions ProtocolExtensionContainer { {PacketErrorRate-ExtIEs} } OPTIONAL, + ... +} + +PacketErrorRate-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PER-Scalar ::= INTEGER (0..9, ...) +PER-Exponent ::= INTEGER (0..9, ...) + +PagingCell-Item ::= SEQUENCE { + nRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { PagingCell-ItemExtIEs } } OPTIONAL +} + +PagingCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PagingDRX ::= ENUMERATED { + v32, + v64, + v128, + v256, + ... +} + +PagingIdentity ::= CHOICE { + rANUEPagingIdentity RANUEPagingIdentity, + cNUEPagingIdentity CNUEPagingIdentity, + choice-extension ProtocolIE-SingleContainer { { PagingIdentity-ExtIEs } } +} + +PagingIdentity-ExtIEs F1AP-PROTOCOL-IES::= { + ... +} + +PagingOrigin ::= ENUMERATED { non-3gpp, ...} + +PagingPriority ::= ENUMERATED { priolevel1, priolevel2, priolevel3, priolevel4, priolevel5, priolevel6, priolevel7, priolevel8,...} + + +RelativePathDelay ::= CHOICE { + k0 INTEGER (0..16351,...), + k1 INTEGER (0..8176,...), + k2 INTEGER (0..4088,...), + k3 INTEGER (0..2044,...), + k4 INTEGER (0..1022,...), + k5 INTEGER (0..511,...), + choice-extension ProtocolIE-SingleContainer { { RelativePathDelay-ExtIEs } } +} + +RelativePathDelay-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PathlossReferenceInfo ::= SEQUENCE { + pathlossReferenceSignal PathlossReferenceSignal, + iE-Extensions ProtocolExtensionContainer { {PathlossReferenceInfo-ExtIEs} } OPTIONAL +} + +PathlossReferenceInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PathlossReferenceSignal ::= CHOICE { + sSB SSB, + dL-PRS DL-PRS, + choice-extension ProtocolIE-SingleContainer {{PathlossReferenceSignal-ExtIEs }} +} + +PathlossReferenceSignal-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PC5QoSFlowIdentifier ::= INTEGER (1..2048) + +PC5-QoS-Characteristics ::= CHOICE { + non-Dynamic-PQI NonDynamicPQIDescriptor, + dynamic-PQI DynamicPQIDescriptor, + choice-extension ProtocolIE-SingleContainer { { PC5-QoS-Characteristics-ExtIEs } } +} + +PC5-QoS-Characteristics-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +PC5QoSParameters ::= SEQUENCE { + pC5-QoS-Characteristics PC5-QoS-Characteristics, + pC5-QoS-Flow-Bit-Rates PC5FlowBitRates OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PC5QoSParameters-ExtIEs } } OPTIONAL, + ... +} + +PC5QoSParameters-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PC5FlowBitRates ::= SEQUENCE { + guaranteedFlowBitRate BitRate, + maximumFlowBitRate BitRate, + iE-Extensions ProtocolExtensionContainer { { PC5FlowBitRates-ExtIEs } } OPTIONAL, + ... +} + +PC5FlowBitRates-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PDCCH-BlindDetectionSCG ::= OCTET STRING + +PDCP-SN ::= INTEGER (0..4095) + +PDCPSNLength ::= ENUMERATED { twelve-bits,eighteen-bits,...} + +PDUSessionID ::= INTEGER (0..255) + +ReportingPeriodicityValue ::= INTEGER (0..512, ...) + +Periodicity ::= INTEGER (0..640000, ...) + +PeriodicitySRS ::= ENUMERATED { ms0p125, ms0p25, ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms4, ms5, ms8, ms10, ms16, ms20, ms32, ms40, ms64, ms80, ms160, ms320, ms640, ms1280, ms2560, ms5120, ms10240, ...} + +PeriodicityList ::= SEQUENCE (SIZE(1.. maxnoSRS-ResourcePerSet)) OF PeriodicityList-Item + +PeriodicityList-Item ::= SEQUENCE { + periodicitySRS PeriodicitySRS, + iE-Extensions ProtocolExtensionContainer { { PeriodicityList-ItemExtIEs} } OPTIONAL +} + +PeriodicityList-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Permutation ::= ENUMERATED {dfu, ufd, ...} + +Ph-InfoMCG ::= OCTET STRING + +Ph-InfoSCG ::= OCTET STRING + +PLMN-Identity ::= OCTET STRING (SIZE(3)) + +PortNumber ::= BIT STRING (SIZE (16)) + + +PosAssistance-Information ::= OCTET STRING + +PosAssistanceInformationFailureList ::= OCTET STRING + +PosBroadcast ::= ENUMERATED { + start, + stop, + ... +} + +PositioningBroadcastCells ::= SEQUENCE (SIZE (1..maxnoBcastCell)) OF NRCGI + +PosMeasurementPeriodicity ::= ENUMERATED +{ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, min1, min6, min12, min30, min60, ...} + + +PosMeasurementQuantities ::= SEQUENCE (SIZE(1.. maxnoofPosMeas)) OF PosMeasurementQuantities-Item + +PosMeasurementQuantities-Item ::= SEQUENCE { + posMeasurementType PosMeasurementType, + timingReportingGranularityFactor INTEGER (0..5) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementQuantities-ItemExtIEs} } OPTIONAL +} + +PosMeasurementQuantities-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementResult ::= SEQUENCE (SIZE (1.. maxnoofPosMeas)) OF PosMeasurementResultItem + +PosMeasurementResultItem ::= SEQUENCE { + measuredResultsValue MeasuredResultsValue, + timeStamp TimeStamp, + measurementQuality TRPMeasurementQuality OPTIONAL, + measurementBeamInfo MeasurementBeamInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementResultItemExtIEs } } OPTIONAL +} + +PosMeasurementResultItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementResultList ::= SEQUENCE (SIZE(1.. maxNoOfMeasTRPs)) OF PosMeasurementResultList-Item + +PosMeasurementResultList-Item ::= SEQUENCE { + posMeasurementResult PosMeasurementResult, + tRPID TRPID, + iE-Extensions ProtocolExtensionContainer { { PosMeasurementResultList-ItemExtIEs} } OPTIONAL +} + +PosMeasurementResultList-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosMeasurementType ::= ENUMERATED { + gnb-rx-tx, + ul-srs-rsrp, + ul-aoa, + ul-rtoa, + ... +} + +PosReportCharacteristics ::= ENUMERATED { + ondemand, + periodic, + ... +} + +PosResourceSetType ::= CHOICE { + periodic PosResourceSetTypePR, + semi-persistent PosResourceSetTypeSP, + aperiodic PosResourceSetTypeAP, + choice-extension ProtocolIE-SingleContainer {{ PosResourceSetType-ExtIEs }} +} + +PosResourceSetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +PosResourceSetTypePR ::= SEQUENCE { + posperiodicSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypePR-ExtIEs} } OPTIONAL +} + +PosResourceSetTypePR-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosResourceSetTypeSP ::= SEQUENCE { + possemi-persistentSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypeSP-ExtIEs} } OPTIONAL +} + +PosResourceSetTypeSP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosResourceSetTypeAP ::= SEQUENCE { + sRSResourceTrigger-List INTEGER(1..3), + iE-Extensions ProtocolExtensionContainer { { PosResourceSetTypeAP-ExtIEs} } OPTIONAL +} + +PosResourceSetTypeAP-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResourceID-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResourcePerSet)) OF SRSPosResourceID + +PosSRSResource-Item ::= SEQUENCE { + srs-PosResourceId SRSPosResourceID, + transmissionCombPos TransmissionCombPos, + startPosition INTEGER (0..13), + nrofSymbols ENUMERATED {n1, n2, n4, n8, n12}, + freqDomainShift INTEGER (0..268), + c-SRS INTEGER (0..63), + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + resourceTypePos ResourceTypePos, + sequenceId INTEGER (0.. 65535), + spatialRelationPos SpatialRelationPos OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PosSRSResource-Item-ExtIEs} } OPTIONAL +} + +PosSRSResource-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResource-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResources)) OF PosSRSResource-Item + +PosSRSResourceSet-Item ::= SEQUENCE { + possrsResourceSetID INTEGER(0..15), + possRSResourceID-List PosSRSResourceID-List, + posresourceSetType PosResourceSetType, + iE-Extensions ProtocolExtensionContainer { { PosSRSResourceSet-Item-ExtIEs} } OPTIONAL +} + +PosSRSResourceSet-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PosSRSResourceSet-List ::= SEQUENCE (SIZE (1..maxnoSRS-PosResourceSets)) OF PosSRSResourceSet-Item + +PrimaryPathIndication ::= ENUMERATED { + true, + false, + ... +} + +Pre-emptionCapability ::= ENUMERATED { + shall-not-trigger-pre-emption, + may-trigger-pre-emption +} + +Pre-emptionVulnerability ::= ENUMERATED { + not-pre-emptable, + pre-emptable +} + +PriorityLevel ::= INTEGER { spare (0), highest (1), lowest (14), no-priority (15) } (0..15) + +ProtectedEUTRAResourceIndication ::= OCTET STRING + +Protected-EUTRA-Resources-Item ::= SEQUENCE { + spectrumSharingGroupID SpectrumSharingGroupID, + eUTRACells-List EUTRACells-List, + iE-Extensions ProtocolExtensionContainer { { Protected-EUTRA-Resources-ItemExtIEs } } OPTIONAL +} + +Protected-EUTRA-Resources-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSConfiguration ::= SEQUENCE { + pRSResourceSet-List PRSResourceSet-List, + iE-Extensions ProtocolExtensionContainer { { PRSConfiguration-ExtIEs } } OPTIONAL +} + +PRSConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSInformationPos ::= SEQUENCE { + pRS-IDPos INTEGER(0..255) OPTIONAL, + pRS-Resource-Set-IDPos INTEGER(0..7), + pRS-Resource-IDPos INTEGER(0..63), + iE-Extensions ProtocolExtensionContainer { { PRSInformationPos-ExtIEs} } OPTIONAL +} + +PRSInformationPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Potential-SpCell-Item ::= SEQUENCE { + potential-SpCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { Potential-SpCell-ItemExtIEs } } OPTIONAL, + ... +} + +Potential-SpCell-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +PRSAngleList ::= SEQUENCE (SIZE(1.. maxnoofPRS-ResourcesPerSet)) OF PRSAngleItem + +PRSAngleItem ::= SEQUENCE { + nR-PRS-Azimuth INTEGER (0..359), + nR-PRS-Azimuth-fine INTEGER (0..9), + nR-PRS-Elevation INTEGER (0..180), + nR-PRS-Elevation-fine INTEGER (0..9), + iE-Extensions ProtocolExtensionContainer { { PRSAngleItem-ItemExtIEs } } OPTIONAL +} + +PRSAngleItem-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMuting::= SEQUENCE { + pRSMutingOption1 PRSMutingOption1, + pRSMutingOption2 PRSMutingOption2, + iE-Extensions ProtocolExtensionContainer { { PRSMuting-ExtIEs} } OPTIONAL +} + +PRSMuting-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMutingOption1 ::= SEQUENCE { + mutingPattern DL-PRSMutingPattern, + mutingBitRepetitionFactor ENUMERATED{rf1,rf2,rf4,rf8,...}, + iE-Extensions ProtocolExtensionContainer { { PRSMutingOption1-ExtIEs} } OPTIONAL +} + +PRSMutingOption1-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSMutingOption2 ::= SEQUENCE { + mutingPattern DL-PRSMutingPattern, + iE-Extensions ProtocolExtensionContainer { { PRSMutingOption2-ExtIEs} } OPTIONAL +} + +PRSMutingOption2-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRS-Resource-ID ::= INTEGER (0..63) + +PRSResource-List::= SEQUENCE (SIZE (1..maxnoofPRSresources)) OF PRSResource-Item + +PRSResource-Item ::= SEQUENCE { + pRSResourceID INTEGER(0..63), + sequenceID INTEGER(0..4095,...), + rEOffset INTEGER(0..11), + resourceSlotOffset INTEGER(0..511,...), + resourceSymbolOffset INTEGER(0..12,...), + qCLInfo PRSResource-QCLInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-Item-ExtIEs} } OPTIONAL +} + +PRSResource-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSResource-QCLInfo ::= SEQUENCE { + qCLSourceSSBIndex INTEGER(0..63) OPTIONAL, + qCLSourcePRSInfo PRSResource-QCLSourcePRSInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-QCLInfo-ExtIEs} } OPTIONAL, + ... +} +PRSResource-QCLInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRSResource-QCLSourcePRSInfo ::= SEQUENCE { + qCLSourcePRSResourceSetID INTEGER(0..7), + qCLSourcePRSResourceID INTEGER(0..63) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PRSResource-QCLSourcePRSInfo-ExtIEs} } OPTIONAL +} + +PRSResource-QCLSourcePRSInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PRS-Resource-Set-ID ::= INTEGER(0..7) + +PRSResourceSet-List ::= SEQUENCE (SIZE (1.. maxnoofPRSresourceSets)) OF PRSResourceSet-Item +PRSResourceSet-Item ::= SEQUENCE { + pRSResourceSetID PRS-Resource-Set-ID, + subcarrierSpacing ENUMERATED{kHz15, kHz30, kHz60, kHz120, ...}, + pRSbandwidth INTEGER(1..63), + startPRB INTEGER(0..2176), + pointA INTEGER (0..3279165), + combSize ENUMERATED{n2, n4, n6, n12, ...}, + cPType ENUMERATED{normal, extended, ...}, + resourceSetPeriodicity ENUMERATED{n4,n5,n8,n10,n16,n20,n32,n40,n64,n80,n160,n320,n640,n1280,n2560,n5120,n10240,n20480,n40960, n81920,...}, + resourceSetSlotOffset INTEGER(0..81919,...), + resourceRepetitionFactor ENUMERATED{rf1,rf2,rf4,rf6,rf8,rf16,rf32,...}, + resourceTimeGap ENUMERATED{tg1,tg2,tg4,tg8,tg16,tg32,...}, + resourceNumberofSymbols ENUMERATED{n2,n4,n6,n12,...}, + pRSMuting PRSMuting OPTIONAL, + pRSResourceTransmitPower INTEGER(-60..50), + pRSResource-List PRSResource-List, + iE-Extensions ProtocolExtensionContainer { { PRSResourceSet-Item-ExtIEs} } OPTIONAL +} + +PRSResourceSet-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWS-Failed-NR-CGI-Item ::= SEQUENCE { + nRCGI NRCGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { { PWS-Failed-NR-CGI-ItemExtIEs } } OPTIONAL, + ... +} + +PWS-Failed-NR-CGI-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PWSSystemInformation ::= SEQUENCE { + sIBtype SIBType-PWS, + sIBmessage OCTET STRING, + iE-Extensions ProtocolExtensionContainer { { PWSSystemInformationExtIEs } } OPTIONAL, + ... +} + +PWSSystemInformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-NotificationInformation CRITICALITY ignore EXTENSION NotificationInformation PRESENCE optional}| + { ID id-AdditionalSIBMessageList CRITICALITY reject EXTENSION AdditionalSIBMessageList PRESENCE optional}, + ... +} + +PrivacyIndicator ::= ENUMERATED {immediate-MDT, logged-MDT, ...} + +-- Q + +QCI ::= INTEGER (0..255) + +QoS-Characteristics ::= CHOICE { + non-Dynamic-5QI NonDynamic5QIDescriptor, + dynamic-5QI Dynamic5QIDescriptor, + choice-extension ProtocolIE-SingleContainer { { QoS-Characteristics-ExtIEs } } +} + +QoS-Characteristics-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +QoSFlowIdentifier ::= INTEGER (0..63) + +QoSFlowLevelQoSParameters ::= SEQUENCE { + qoS-Characteristics QoS-Characteristics, + nGRANallocationRetentionPriority NGRANAllocationAndRetentionPriority, + gBR-QoS-Flow-Information GBR-QoSFlowInformation OPTIONAL, + reflective-QoS-Attribute ENUMERATED {subject-to, ...} OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { QoSFlowLevelQoSParameters-ExtIEs } } OPTIONAL +} + +QoSFlowLevelQoSParameters-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-PDUSessionID CRITICALITY ignore EXTENSION PDUSessionID PRESENCE optional}| + { ID id-ULPDUSessionAggregateMaximumBitRate CRITICALITY ignore EXTENSION BitRate PRESENCE optional}| + { ID id-QosMonitoringRequest CRITICALITY ignore EXTENSION QosMonitoringRequest PRESENCE optional}, + ... +} + +QoSFlowMappingIndication ::= ENUMERATED {ul,dl,...} + +QoSInformation ::= CHOICE { + eUTRANQoS EUTRANQoS, + choice-extension ProtocolIE-SingleContainer { { QoSInformation-ExtIEs} } +} + +QoSInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Information CRITICALITY ignore TYPE DRB-Information PRESENCE mandatory}, + ... +} + +QosMonitoringRequest ::= ENUMERATED {ul, dl, both, ...} + +QoSParaSetIndex ::= INTEGER (1..8, ...) + +QoSParaSetNotifyIndex ::= INTEGER (0..8, ...) + +-- R + +RACH-Config-Common ::= OCTET STRING + +RACH-Config-Common-IAB ::= OCTET STRING + +RACHReportContainer::= OCTET STRING + +RACHReportInformationList ::= SEQUENCE (SIZE(1.. maxnoofRACHReports)) OF RACHReportInformationItem + +RACHReportInformationItem ::= SEQUENCE { + rACHReportContainer RACHReportContainer, + uEAssitantIdentifier GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RACHReportInformationItem-ExtIEs} } OPTIONAL, + ... +} + +RACHReportInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + + +RadioResourceStatus ::= SEQUENCE { + sSBAreaRadioResourceStatusList SSBAreaRadioResourceStatusList, + iE-Extensions ProtocolExtensionContainer { { RadioResourceStatus-ExtIEs} } OPTIONAL +} + +RadioResourceStatus-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RANAC ::= INTEGER (0..255) + +RAN-MeasurementID ::= INTEGER (1.. 65536, ...) + +RAN-UE-MeasurementID ::= INTEGER (1.. 256, ...) + +RANUEID ::= OCTET STRING (SIZE (8)) + +RANUEPagingIdentity ::= SEQUENCE { + iRNTI BIT STRING (SIZE(40)), + iE-Extensions ProtocolExtensionContainer { { RANUEPagingIdentity-ExtIEs } } OPTIONAL} + +RANUEPagingIdentity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RAT-FrequencyPriorityInformation::= CHOICE { + eNDC SubscriberProfileIDforRFP, + nGRAN RAT-FrequencySelectionPriority, + choice-extension ProtocolIE-SingleContainer { { RAT-FrequencyPriorityInformation-ExtIEs} } +} + +RAT-FrequencyPriorityInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +RAT-FrequencySelectionPriority::= INTEGER (1.. 256, ...) + +Reestablishment-Indication ::= ENUMERATED { + reestablished, + ... +} + +ReferencePoint ::= CHOICE { + coordinateID CoordinateID, + referencePointCoordinate AccessPointPosition, + referencePointCoordinateHA NGRANHighAccuracyAccessPointPosition, + choice-Extension ProtocolIE-SingleContainer { { ReferencePoint-ExtIEs} } +} + +ReferencePoint-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ReferenceSFN ::= INTEGER (0..1023) + +ReferenceSignal ::= CHOICE { + nZP-CSI-RS NZP-CSI-RS-ResourceID, + sSB SSB, + sRS SRSResourceID, + positioningSRS SRSPosResourceID, + dL-PRS DL-PRS, + choice-extension ProtocolIE-SingleContainer {{ReferenceSignal-ExtIEs }} +} + +ReferenceSignal-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +RelativeCartesianLocation ::= SEQUENCE { + xYZunit ENUMERATED {mm, cm, dm, ...}, + xvalue INTEGER (-65536..65535), + yvalue INTEGER (-65536..65535), + zvalue INTEGER (-32768..32767), + locationUncertainty LocationUncertainty, + iE-Extensions ProtocolExtensionContainer { { RelativeCartesianLocation-ExtIEs} } OPTIONAL +} + +RelativeCartesianLocation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RelativeGeodeticLocation ::= SEQUENCE { + milli-Arc-SecondUnits ENUMERATED {zerodot03, zerodot3, three, ...}, + heightUnits ENUMERATED {mm, cm, m, ...}, + deltaLatitude INTEGER (-1024.. 1023), + deltaLongitude INTEGER (-1024.. 1023), + deltaHeight INTEGER (-1024.. 1023), + locationUncertainty LocationUncertainty, + iE-extensions ProtocolExtensionContainer {{RelativeGeodeticLocation-ExtIEs }} OPTIONAL +} + +RelativeGeodeticLocation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ReferenceTime ::= OCTET STRING + +RegistrationRequest ::= ENUMERATED{start, stop, add, ...} + +ReportCharacteristics ::= BIT STRING (SIZE(32)) + +ReportingPeriodicity ::= ENUMERATED{ms500, ms1000, ms2000, ms5000, ms10000, ...} + +RequestedBandCombinationIndex ::= OCTET STRING + +RequestedFeatureSetEntryIndex ::= OCTET STRING + +RequestedP-MaxFR2 ::= OCTET STRING + +Requested-PDCCH-BlindDetectionSCG ::= OCTET STRING + + +RequestedSRSTransmissionCharacteristics ::= SEQUENCE { + numberOfTransmissions INTEGER (0..500, ...) OPTIONAL, + resourceType ENUMERATED {periodic, semi-persistent, aperiodic,...}, + bandwidthSRS BandwidthSRS, + sRSResourceSetList SRSResourceSetList OPTIONAL, + sSBInformation SSBInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RequestedSRSTransmissionCharacteristics-ExtIEs} } OPTIONAL +} + +RequestedSRSTransmissionCharacteristics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RequestType ::= ENUMERATED {offer, execution, ...} + +ResourceCoordinationEUTRACellInfo ::= SEQUENCE { + eUTRA-Mode-Info EUTRA-Coex-Mode-Info, + eUTRA-PRACH-Configuration EUTRA-PRACH-Configuration, + iE-Extensions ProtocolExtensionContainer { { ResourceCoordinationEUTRACellInfo-ExtIEs } } OPTIONAL, + ... +} + +ResourceCoordinationEUTRACellInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-IgnorePRACHConfiguration CRITICALITY reject EXTENSION IgnorePRACHConfiguration PRESENCE optional }, + ... +} + +ResourceCoordinationTransferInformation ::= SEQUENCE { + meNB-Cell-ID EUTRA-Cell-ID, + resourceCoordinationEUTRACellInfo ResourceCoordinationEUTRACellInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ResourceCoordinationTransferInformation-ExtIEs } } OPTIONAL, + ... +} + +ResourceCoordinationTransferInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceCoordinationTransferContainer ::= OCTET STRING + +ResourceSetType ::= CHOICE { + periodic ResourceSetTypePeriodic, + semi-persistent ResourceSetTypeSemi-persistent, + aperiodic ResourceSetTypeAperiodic, + choice-extension ProtocolIE-SingleContainer {{ ResourceSetType-ExtIEs }} +} + +ResourceSetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceSetTypePeriodic ::= SEQUENCE { + periodicSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypePeriodic-ExtIEs} } OPTIONAL +} + +ResourceSetTypePeriodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceSetTypeSemi-persistent ::= SEQUENCE { + semi-persistentSet ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypeSemi-persistent-ExtIEs} } OPTIONAL +} + +ResourceSetTypeSemi-persistent-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceSetTypeAperiodic ::= SEQUENCE { + sRSResourceTrigger-List INTEGER(1..3), + slotoffset INTEGER(1..32), + iE-Extensions ProtocolExtensionContainer { { ResourceSetTypeAperiodic-ExtIEs} } OPTIONAL +} + +ResourceSetTypeAperiodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RepetitionPeriod ::= INTEGER (0..131071, ...) + +ReportingRequestType ::= SEQUENCE { + eventType EventType, + reportingPeriodicityValue ReportingPeriodicityValue OPTIONAL, + -- C-ifEventTypeisPeriodic: This IE shall be present if the Event Type IE is set to "periodic" in the Event Type IE. + iE-Extensions ProtocolExtensionContainer { {ReportingRequestType-ExtIEs} } OPTIONAL +} + +ReportingRequestType-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceType ::= CHOICE { + periodic ResourceTypePeriodic, + semi-persistent ResourceTypeSemi-persistent, + aperiodic ResourceTypeAperiodic, + choice-extension ProtocolIE-SingleContainer {{ ResourceType-ExtIEs }} +} + +ResourceType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceTypePeriodic ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, ...}, + offset INTEGER(0..2559, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypePeriodic-ExtIEs} } OPTIONAL +} + +ResourceTypePeriodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeSemi-persistent ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, ...}, + offset INTEGER(0..2559, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeSemi-persistent-ExtIEs} } OPTIONAL +} + +ResourceTypeSemi-persistent-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeAperiodic ::= SEQUENCE { + aperiodicResourceType ENUMERATED{true, ...}, + iE-Extensions ProtocolExtensionContainer { { ResourceTypeAperiodic-ExtIEs} } OPTIONAL +} + +ResourceTypeAperiodic-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypePos ::= CHOICE { + periodic ResourceTypePeriodicPos, + semi-persistent ResourceTypeSemi-persistentPos, + aperiodic ResourceTypeAperiodicPos, + choice-extension ProtocolIE-SingleContainer {{ ResourceTypePos-ExtIEs }} +} + +ResourceTypePos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +ResourceTypePeriodicPos ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, slot5120, slot10240, slot20480, slot40960, slot81920, ...}, + offset INTEGER(0..81919, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypePeriodicPos-ExtIEs} } OPTIONAL +} + +ResourceTypePeriodicPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeSemi-persistentPos ::= SEQUENCE { + periodicity ENUMERATED{slot1, slot2, slot4, slot5, slot8, slot10, slot16, slot20, slot32, slot40, slot64, slot80, slot160, slot320, slot640, slot1280, slot2560, slot5120, slot10240, slot20480, slot40960, slot81920, ...}, + offset INTEGER(0..81919, ...), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeSemi-persistentPos-ExtIEs} } OPTIONAL +} + +ResourceTypeSemi-persistentPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResourceTypeAperiodicPos ::= SEQUENCE { + slotOffset INTEGER (1..32), + iE-Extensions ProtocolExtensionContainer { { ResourceTypeAperiodicPos-ExtIEs} } OPTIONAL +} + +ResourceTypeAperiodicPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCDuplicationInformation ::= SEQUENCE { + rLCDuplicationStateList RLCDuplicationStateList, + primaryPathIndication PrimaryPathIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {RLCDuplicationInformation-ExtIEs} } OPTIONAL +} + +RLCDuplicationInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCDuplicationStateList ::= SEQUENCE (SIZE(1..maxnoofRLCDuplicationState)) OF RLCDuplicationState-Item + +RLCDuplicationState-Item ::=SEQUENCE { + duplicationState DuplicationState, + iE-Extensions ProtocolExtensionContainer { {RLCDuplicationState-Item-ExtIEs } } OPTIONAL, + ... +} + + +RLCDuplicationState-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCFailureIndication ::= SEQUENCE { + assocatedLCID LCID, + iE-Extensions ProtocolExtensionContainer { {RLCFailureIndication-ExtIEs} } OPTIONAL +} + +RLCFailureIndication-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLCMode ::= ENUMERATED { + rlc-am, + rlc-um-bidirectional, + rlc-um-unidirectional-ul, + rlc-um-unidirectional-dl, + ... +} + +RLC-Status ::= SEQUENCE { + reestablishment-Indication Reestablishment-Indication, + iE-Extensions ProtocolExtensionContainer { { RLC-Status-ExtIEs } } OPTIONAL, + ... +} + +RLC-Status-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RLFReportInformationList ::= SEQUENCE (SIZE(1.. maxnoofRLFReports)) OF RLFReportInformationItem + +RLFReportInformationItem ::= SEQUENCE { + nRUERLFReportContainer NRUERLFReportContainer, + uEAssitantIdentifier GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RLFReportInformationItem-ExtIEs} } OPTIONAL, + ... +} + +RLFReportInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RIMRSDetectionStatus ::= ENUMERATED {rs-detected, rs-disappeared, ...} + +RRCContainer ::= OCTET STRING + +RRCContainer-RRCSetupComplete ::= OCTET STRING + +RRCDeliveryStatus ::= SEQUENCE { + delivery-status PDCP-SN, + triggering-message PDCP-SN, + iE-Extensions ProtocolExtensionContainer { { RRCDeliveryStatus-ExtIEs } } OPTIONAL} + +RRCDeliveryStatus-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +RRCDeliveryStatusRequest ::= ENUMERATED {true, ...} + +RRCReconfigurationCompleteIndicator ::= ENUMERATED { + true, + ..., + failure +} + +RRC-Version ::= SEQUENCE { + latest-RRC-Version BIT STRING (SIZE(3)), + iE-Extensions ProtocolExtensionContainer { { RRC-Version-ExtIEs } } OPTIONAL} + +RRC-Version-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-latest-RRC-Version-Enhanced CRITICALITY ignore EXTENSION OCTET STRING (SIZE(3)) PRESENCE optional }, + ... +} + +RoutingID ::= OCTET STRING + +-- S + +SCell-FailedtoSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-FailedtoSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SCell-FailedtoSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-FailedtoSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeRemoved-Item ::= SEQUENCE { + sCell-ID NRCGI , + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeRemoved-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeRemoved-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCell-ToBeSetup-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ServingCellMO CRITICALITY ignore EXTENSION ServingCellMO PRESENCE optional }, + ... +} + +SCell-ToBeSetupMod-Item ::= SEQUENCE { + sCell-ID NRCGI , + sCellIndex SCellIndex, + sCellULConfigured CellULConfigured OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SCell-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SCell-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-ServingCellMO CRITICALITY ignore EXTENSION ServingCellMO PRESENCE optional }, + ... +} + +SCellIndex ::=INTEGER (1..31, ...) + +SCS-SpecificCarrier ::= SEQUENCE { + offsetToCarrier INTEGER (0..2199,...), + subcarrierSpacing ENUMERATED {kHz15, kHz30, kHz60, kHz120,...}, + carrierBandwidth INTEGER (0..275,...), + iE-Extensions ProtocolExtensionContainer { { SCS-SpecificCarrier-ExtIEs } } OPTIONAL +} + +SCS-SpecificCarrier-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Search-window-information ::= SEQUENCE { + expectedPropagationDelay INTEGER (-3841..3841,...), + delayUncertainty INTEGER (1..246,...), + iE-Extensions ProtocolExtensionContainer { { Search-window-information-ExtIEs } } OPTIONAL +} + +Search-window-information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SerialNumber ::= BIT STRING (SIZE (16)) + +SIBType-PWS ::=INTEGER (6..8, ...) + +SelectedBandCombinationIndex ::= OCTET STRING + +SelectedFeatureSetEntryIndex ::= OCTET STRING + +CG-ConfigInfo ::= OCTET STRING + +ServCellIndex ::= INTEGER (0..31, ...) + +ServingCellMO ::= INTEGER (1..64, ...) + +Served-Cell-Information ::= SEQUENCE { + nRCGI NRCGI, + nRPCI NRPCI, + fiveGS-TAC FiveGS-TAC OPTIONAL, + configured-EPS-TAC Configured-EPS-TAC OPTIONAL, + servedPLMNs ServedPLMNs-List, + nR-Mode-Info NR-Mode-Info, + measurementTimingConfiguration OCTET STRING, + iE-Extensions ProtocolExtensionContainer { {Served-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-RANAC CRITICALITY ignore EXTENSION RANAC PRESENCE optional }| + { ID id-ExtendedServedPLMNs-List CRITICALITY ignore EXTENSION ExtendedServedPLMNs-List PRESENCE optional }| + { ID id-Cell-Direction CRITICALITY ignore EXTENSION Cell-Direction PRESENCE optional }| + { ID id-BPLMN-ID-Info-List CRITICALITY ignore EXTENSION BPLMN-ID-Info-List PRESENCE optional }| + { ID id-Cell-Type CRITICALITY ignore EXTENSION CellType PRESENCE optional}| + { ID id-ConfiguredTACIndication CRITICALITY ignore EXTENSION ConfiguredTACIndication PRESENCE optional }| + { ID id-AggressorgNBSetID CRITICALITY ignore EXTENSION AggressorgNBSetID PRESENCE optional}| + { ID id-VictimgNBSetID CRITICALITY ignore EXTENSION VictimgNBSetID PRESENCE optional}| + { ID id-IAB-Info-IAB-DU CRITICALITY ignore EXTENSION IAB-Info-IAB-DU PRESENCE optional}| + { ID id-SSB-PositionsInBurst CRITICALITY ignore EXTENSION SSB-PositionsInBurst PRESENCE optional }| + { ID id-NRPRACHConfig CRITICALITY ignore EXTENSION NRPRACHConfig PRESENCE optional }, + ... +} + +Served-Cells-To-Add-Item ::= SEQUENCE { + served-Cell-Information Served-Cell-Information, + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Add-ItemExtIEs} } OPTIONAL, + ... +} + +Served-Cells-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Delete-Item ::= SEQUENCE { + oldNRCGI NRCGI , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Delete-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Delete-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-Cells-To-Modify-Item ::= SEQUENCE { + oldNRCGI NRCGI , + served-Cell-Information Served-Cell-Information , + gNB-DU-System-Information GNB-DU-System-Information OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { Served-Cells-To-Modify-ItemExtIEs } } OPTIONAL, + ... +} + +Served-Cells-To-Modify-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Served-EUTRA-Cells-Information::= SEQUENCE { + eUTRA-Mode-Info EUTRA-Mode-Info, + protectedEUTRAResourceIndication ProtectedEUTRAResourceIndication, + iE-Extensions ProtocolExtensionContainer { {Served-EUTRA-Cell-Information-ExtIEs} } OPTIONAL, + ... +} + +Served-EUTRA-Cell-Information-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Service-State ::= ENUMERATED { + in-service, + out-of-service, + ... +} + +Service-Status ::= SEQUENCE { + service-state Service-State, + switchingOffOngoing ENUMERATED {true, ...} OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Service-Status-ExtIEs } } OPTIONAL, + ... +} + +Service-Status-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SFNInitialisationTime ::= BIT STRING (SIZE (64)) + +ShortDRXCycleLength ::= ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, ...} + +ShortDRXCycleTimer ::= INTEGER (1..16) + +SIB1-message ::= OCTET STRING + +SIB10-message ::= OCTET STRING + +SIB12-message ::= OCTET STRING + +SIB13-message ::= OCTET STRING + +SIB14-message ::= OCTET STRING + +SItype ::= INTEGER (1..32, ...) + +SItype-List ::= SEQUENCE (SIZE(1.. maxnoofSITypes)) OF SItype-Item + +SItype-Item ::= SEQUENCE { + sItype SItype , + iE-Extensions ProtocolExtensionContainer { { SItype-ItemExtIEs } } OPTIONAL +} + +SItype-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SibtypetobeupdatedListItem ::= SEQUENCE { + sIBtype INTEGER (2..32,...), + sIBmessage OCTET STRING, + valueTag INTEGER (0..31,...), + iE-Extensions ProtocolExtensionContainer { { SibtypetobeupdatedListItem-ExtIEs } } OPTIONAL, + ... +} + +SibtypetobeupdatedListItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-areaScope CRITICALITY ignore EXTENSION AreaScope PRESENCE optional}, + ... +} + +SLDRBID ::= INTEGER (1..512, ...) + +SLDRBInformation ::= SEQUENCE { + sLDRB-QoS PC5QoSParameters, + flowsMappedToSLDRB-List FlowsMappedToSLDRB-List, + ... +} + +SLDRBs-FailedToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-FailedToBeSetup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID , + cause Cause OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SLDRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Modified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Modified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ModifiedConf-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ModifiedConf-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ModifiedConf-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Required-ToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Required-ToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Required-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-Setup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-Setup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-SetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-SetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeModified-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation OPTIONAL, + rLCMode RLCMode OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeModified-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeModified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeReleased-Item ::= SEQUENCE { + sLDRBID SLDRBID, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeReleased-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeSetup-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation, + rLCMode RLCMode, + + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeSetup-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SLDRBs-ToBeSetupMod-Item ::= SEQUENCE { + sLDRBID SLDRBID, + sLDRBInformation SLDRBInformation, + rLCMode RLCMode OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SLDRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL +} + +SLDRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SL-PHY-MAC-RLC-Config ::= OCTET STRING + +SL-ConfigDedicatedEUTRA ::= OCTET STRING + +SliceAvailableCapacity ::= SEQUENCE { + sliceAvailableCapacityList SliceAvailableCapacityList, + iE-Extensions ProtocolExtensionContainer { { SliceAvailableCapacity-ExtIEs} } OPTIONAL +} + +SliceAvailableCapacity-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceAvailableCapacityList ::= SEQUENCE (SIZE(1.. maxnoofBPLMNsNR)) OF SliceAvailableCapacityItem + +SliceAvailableCapacityItem ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + sNSSAIAvailableCapacity-List SNSSAIAvailableCapacity-List, + iE-Extensions ProtocolExtensionContainer { { SliceAvailableCapacityItem-ExtIEs} } OPTIONAL +} + +SliceAvailableCapacityItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SNSSAIAvailableCapacity-List ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SNSSAIAvailableCapacity-Item + +SNSSAIAvailableCapacity-Item ::= SEQUENCE { + sNSSAI SNSSAI, + sliceAvailableCapacityValueDownlink INTEGER (0..100) OPTIONAL, + sliceAvailableCapacityValueUplink INTEGER (0..100) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SNSSAIAvailableCapacity-Item-ExtIEs } } OPTIONAL +} + +SNSSAIAvailableCapacity-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceSupportList ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SliceSupportItem + +SliceSupportItem ::= SEQUENCE { + sNSSAI SNSSAI, + iE-Extensions ProtocolExtensionContainer { { SliceSupportItem-ExtIEs } } OPTIONAL +} + +SliceSupportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SliceToReportList ::= SEQUENCE (SIZE(1.. maxnoofBPLMNsNR)) OF SliceToReportItem + +SliceToReportItem ::= SEQUENCE { + pLMNIdentity PLMN-Identity, + sNSSAIlist SNSSAI-list, + iE-Extensions ProtocolExtensionContainer { { SliceToReportItem-ExtIEs} } OPTIONAL +} + +SliceToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SlotNumber ::= INTEGER (0..79) + +SNSSAI-list ::= SEQUENCE (SIZE(1.. maxnoofSliceItems)) OF SNSSAI-Item + +SNSSAI-Item ::= SEQUENCE { + sNSSAI SNSSAI, + iE-Extensions ProtocolExtensionContainer { { SNSSAI-Item-ExtIEs } } OPTIONAL +} + +SNSSAI-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Slot-Configuration-List ::= SEQUENCE (SIZE(1.. maxnoofslots)) OF Slot-Configuration-Item + +Slot-Configuration-Item ::= SEQUENCE { + slotIndex INTEGER (0..5119, ...), + symbolAllocInSlot SymbolAllocInSlot, + iE-Extensions ProtocolExtensionContainer { { Slot-Configuration-ItemExtIEs } } OPTIONAL +} + +Slot-Configuration-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SNSSAI ::= SEQUENCE { + sST OCTET STRING (SIZE(1)), + sD OCTET STRING (SIZE(3)) OPTIONAL , + iE-Extensions ProtocolExtensionContainer { { SNSSAI-ExtIEs } } OPTIONAL +} + +SNSSAI-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialDirectionInformation ::= SEQUENCE { + nR-PRSBeamInformation NR-PRSBeamInformation, + iE-Extensions ProtocolExtensionContainer { { SpatialDirectionInformation-ExtIEs } } OPTIONAL +} + +SpatialDirectionInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationInfo ::= SEQUENCE { + spatialRelationforResourceID SpatialRelationforResourceID, + iE-Extensions ProtocolExtensionContainer { {SpatialRelationInfo-ExtIEs} } OPTIONAL +} + +SpatialRelationInfo-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationforResourceID ::= SEQUENCE (SIZE(1..maxnoofSpatialRelations)) OF SpatialRelationforResourceIDItem + +SpatialRelationforResourceIDItem ::= SEQUENCE { + referenceSignal ReferenceSignal, + iE-Extensions ProtocolExtensionContainer { {SpatialRelationforResourceIDItem-ExtIEs} } OPTIONAL +} + +SpatialRelationforResourceIDItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpatialRelationPos ::= CHOICE { + sSBPos SSBPos, + pRSInformationPos PRSInformationPos, + choice-extension ProtocolIE-SingleContainer {{ SpatialInformationPos-ExtIEs }} +} + +SpatialInformationPos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SpectrumSharingGroupID ::= INTEGER (1..maxCellineNB) + +SRBID ::= INTEGER (0..3, ...) + +SRBs-FailedToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-FailedToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID , + cause Cause OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-FailedToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-FailedToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Modified-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Modified-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Modified-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Required-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Required-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Required-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-Setup-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-Setup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-Setup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-SetupMod-Item ::= SEQUENCE { + sRBID SRBID, + lCID LCID, + iE-Extensions ProtocolExtensionContainer { { SRBs-SetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-SetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeReleased-Item ::= SEQUENCE { + sRBID SRBID, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeReleased-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeReleased-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRBs-ToBeSetup-Item ::= SEQUENCE { + sRBID SRBID , + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalDuplicationIndication CRITICALITY ignore EXTENSION AdditionalDuplicationIndication PRESENCE optional }, + ... +} + +SRBs-ToBeSetupMod-Item ::= SEQUENCE { + sRBID SRBID, + duplicationIndication DuplicationIndication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRBs-ToBeSetupMod-ItemExtIEs } } OPTIONAL, + ... +} + +SRBs-ToBeSetupMod-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalDuplicationIndication CRITICALITY ignore EXTENSION AdditionalDuplicationIndication PRESENCE optional }, + ... +} + +SRSCarrier-List ::= SEQUENCE (SIZE(1.. maxnoSRS-Carriers)) OF SRSCarrier-List-Item + +SRSCarrier-List-Item ::= SEQUENCE { + pointA INTEGER (0..3279165,...), + uplinkChannelBW-PerSCS-List UplinkChannelBW-PerSCS-List, + activeULBWP ActiveULBWP, + pci NRPCI, + iE-Extensions ProtocolExtensionContainer { { SRSCarrier-List-Item-ExtIEs } } OPTIONAL +} + +SRSCarrier-List-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSConfig ::= SEQUENCE { + sRSResource-List SRSResource-List OPTIONAL, + posSRSResource-List PosSRSResource-List OPTIONAL, + sRSResourceSet-List SRSResourceSet-List OPTIONAL, + posSRSResourceSet-List PosSRSResourceSet-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRSConfig-ExtIEs } } OPTIONAL +} + +SRSConfig-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSConfiguration ::= SEQUENCE { + sRSCarrier-List SRSCarrier-List, + iE-Extensions ProtocolExtensionContainer { { SRSConfiguration-ExtIEs } } OPTIONAL +} + +SRSConfiguration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSPosResourceID ::= INTEGER (0..63, ...) + +SRSResource::= SEQUENCE { + sRSResourceID SRSResourceID, + nrofSRS-Ports ENUMERATED {port1, ports2, ports4}, + transmissionComb TransmissionComb, + startPosition INTEGER (0..13), + nrofSymbols ENUMERATED {n1, n2, n4}, + repetitionFactor ENUMERATED {n1, n2, n4}, + freqDomainPosition INTEGER (0..67), + freqDomainShift INTEGER (0..268), + c-SRS INTEGER (0..63), + b-SRS INTEGER (0..3), + b-hop INTEGER (0..3), + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + resourceType ResourceType, + slotOffset INTEGER (0..2559), + sequenceId INTEGER (0..1023), + iE-Extensions ProtocolExtensionContainer { { SRSResource-ExtIEs } } OPTIONAL +} + +SRSResource-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceID ::= INTEGER (0..63, ...) + +SRSResourceID-List::= SEQUENCE (SIZE (1..maxnoSRS-ResourcePerSet)) OF SRSResourceID + +SRSResource-List ::= SEQUENCE (SIZE (1..maxnoSRS-Resources)) OF SRSResource + +SRSResourceSet::= SEQUENCE { + sRSResourceSetID SRSResourceSetID, + sRSResourceID-List SRSResourceID-List, + resourceSetType ResourceSetType, + iE-Extensions ProtocolExtensionContainer { { SRSResourceSet-ExtIEs } } OPTIONAL +} + +SRSResourceSet-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceSetID ::= INTEGER (0..15, ...) + +SRSResourceSetList ::= SEQUENCE (SIZE(1.. maxnoSRS-ResourceSets)) OF SRSResourceSetItem + +SRSResourceSetItem ::= SEQUENCE { + numSRSresourcesperset INTEGER (1..16, ...) OPTIONAL, + periodicityList PeriodicityList OPTIONAL, + spatialRelationInfo SpatialRelationInfo OPTIONAL, + pathlossReferenceInfo PathlossReferenceInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SRSResourceSetItemExtIEs } } OPTIONAL +} + +SRSResourceSetItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSResourceSet-List ::= SEQUENCE (SIZE (1..maxnoSRS-ResourceSets)) OF SRSResourceSet + +SRSResourceTrigger ::= SEQUENCE { + aperiodicSRSResourceTriggerList AperiodicSRSResourceTriggerList, + iE-Extensions ProtocolExtensionContainer { {SRSResourceTrigger-ExtIEs} } OPTIONAL +} + +SRSResourceTrigger-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRSSpatialRelation ::= SEQUENCE { + spatialRelationforResourceID SpatialRelationforResourceID, + iE-Extensions ProtocolExtensionContainer { {SRSSpatialRelation-ExtIEs} } OPTIONAL +} + +SRSSpatialRelation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB ::= SEQUENCE { + pCI-NR NRPCI, + ssb-index SSB-Index OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {SSB-ExtIEs} } OPTIONAL +} + +SSB-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-freqInfo ::= INTEGER (0..maxNRARFCN) + +SSB-Index ::= INTEGER(0..63) + +SSBPos ::= SEQUENCE { + pCI-NR NRPCI OPTIONAL, + ssb-index SSB-Index, + iE-Extensions ProtocolExtensionContainer { {SSBPos-ExtIEs} } OPTIONAL +} + +SSBPos-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-subcarrierSpacing ::= ENUMERATED {kHz15, kHz30, kHz120, kHz240, spare3, spare2, spare1, ...} + +SSB-transmissionPeriodicity ::= ENUMERATED {sf10, sf20, sf40, sf80, sf160, sf320, sf640, ...} + +SSB-transmissionTimingOffset ::= INTEGER (0..127, ...) + +SSB-transmissionBitmap ::= CHOICE { + shortBitmap BIT STRING (SIZE (4)), + mediumBitmap BIT STRING (SIZE (8)), + longBitmap BIT STRING (SIZE (64)), + choice-extension ProtocolIE-SingleContainer { { SSB-transmisisonBitmap-ExtIEs} } +} + +SSB-transmisisonBitmap-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SSBAreaCapacityValueList ::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBAreaCapacityValueItem + +SSBAreaCapacityValueItem ::= SEQUENCE { + sSBIndex INTEGER(0..63), + sSBAreaCapacityValue INTEGER (0..100), + iE-Extensions ProtocolExtensionContainer { { SSBAreaCapacityValueItem-ExtIEs} } OPTIONAL +} + +SSBAreaCapacityValueItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBAreaRadioResourceStatusList::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBAreaRadioResourceStatusItem + +SSBAreaRadioResourceStatusItem::= SEQUENCE { + sSBIndex INTEGER(0..63), + sSBAreaDLGBRPRBusage INTEGER (0..100), + sSBAreaULGBRPRBusage INTEGER (0..100), + sSBAreaDLnon-GBRPRBusage INTEGER (0..100), + sSBAreaULnon-GBRPRBusage INTEGER (0..100), + sSBAreaDLTotalPRBusage INTEGER (0..100), + sSBAreaULTotalPRBusage INTEGER (0..100), + dLschedulingPDCCHCCEusage INTEGER (0..100) OPTIONAL, + uLschedulingPDCCHCCEusage INTEGER (0..100) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SSBAreaRadioResourceStatusItem-ExtIEs} } OPTIONAL +} + +SSBAreaRadioResourceStatusItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBInformation ::= SEQUENCE { + sSBInformationList SSBInformationList, + iE-Extensions ProtocolExtensionContainer { { SSBInformation-ExtIEs } } OPTIONAL +} + +SSBInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSBInformationList ::= SEQUENCE (SIZE(1.. maxnoofSSBs)) OF SSBInformationItem + +SSBInformationItem ::= SEQUENCE { + sSB-Configuration SSB-TF-Configuration, + pCI-NR NRPCI, + iE-Extensions ProtocolExtensionContainer { { SSBInformationItem-ExtIEs } } OPTIONAL +} + +SSBInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SSB-PositionsInBurst ::= CHOICE { + shortBitmap BIT STRING (SIZE (4)), + mediumBitmap BIT STRING (SIZE (8)), + longBitmap BIT STRING (SIZE (64)), + choice-extension ProtocolIE-SingleContainer { {SSB-PositionsInBurst-ExtIEs} } +} + +SSB-PositionsInBurst-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SSB-TF-Configuration ::= SEQUENCE { + sSB-frequency INTEGER (0..3279165), + sSB-subcarrier-spacing ENUMERATED {kHz15, kHz30, kHz60, kHz120, kHz240, ...}, + sSB-Transmit-power INTEGER (-60..50), + sSB-periodicity ENUMERATED {ms5, ms10, ms20, ms40, ms80, ms160, ...}, + sSB-half-frame-offset INTEGER(0..1), + sSB-SFN-offset INTEGER(0..15), + sSB-position-in-burst SSB-PositionsInBurst OPTIONAL, + sFNInitialisationTime SFNInitialisationTime OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SSB-TF-Configuration-ExtIEs} } OPTIONAL +} + +SSB-TF-Configuration-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +SSBToReportList ::= SEQUENCE (SIZE(1.. maxnoofSSBAreas)) OF SSBToReportItem + +SSBToReportItem ::= SEQUENCE { + sSBIndex INTEGER(0..63), + iE-Extensions ProtocolExtensionContainer { { SSBToReportItem-ExtIEs} } OPTIONAL +} + +SSBToReportItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SUL-Information ::= SEQUENCE { + sUL-NRARFCN INTEGER (0..maxNRARFCN), + sUL-transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { { SUL-InformationExtIEs} } OPTIONAL, + ... +} + +SUL-InformationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-CarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }| + { ID id-FrequencyShift7p5khz CRITICALITY ignore EXTENSION FrequencyShift7p5khz PRESENCE optional }, + ... +} + +SubcarrierSpacing ::= ENUMERATED { kHz15, kHz30, kHz60, kHz120, kHz240, spare3, spare2, spare1, ...} + +SubscriberProfileIDforRFP ::= INTEGER (1..256, ...) + +SULAccessIndication ::= ENUMERATED {true,...} + + +SupportedSULFreqBandItem ::= SEQUENCE { + freqBandIndicatorNr INTEGER (1..1024,...), + iE-Extensions ProtocolExtensionContainer { { SupportedSULFreqBandItem-ExtIEs} } OPTIONAL, + ... +} + +SupportedSULFreqBandItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SymbolAllocInSlot ::= CHOICE { + all-DL NULL, + all-UL NULL, + both-DL-and-UL NumDLULSymbols, + choice-extension ProtocolIE-SingleContainer { { SymbolAllocInSlot-ExtIEs } } +} + +SymbolAllocInSlot-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SystemFrameNumber ::= INTEGER (0..1023) + +SystemInformationAreaID ::=BIT STRING (SIZE (24)) + +-- T + +FiveGS-TAC ::= OCTET STRING (SIZE(3)) + +Configured-EPS-TAC ::= OCTET STRING (SIZE(2)) + +TargetCellList ::= SEQUENCE (SIZE(1..maxnoofCHOcells)) OF TargetCellList-Item + +TargetCellList-Item ::= SEQUENCE { + target-cell NRCGI, + iE-Extensions ProtocolExtensionContainer { { TargetCellList-Item-ExtIEs} } OPTIONAL +} + +TargetCellList-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TDD-Info ::= SEQUENCE { + nRFreqInfo NRFreqInfo, + transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {TDD-Info-ExtIEs} } OPTIONAL, + ... +} + +TDD-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-IntendedTDD-DL-ULConfig CRITICALITY ignore EXTENSION IntendedTDD-DL-ULConfig PRESENCE optional}| + {ID id-TDD-UL-DLConfigCommonNR CRITICALITY ignore EXTENSION TDD-UL-DLConfigCommonNR PRESENCE optional }| + {ID id-CarrierList CRITICALITY ignore EXTENSION NRCarrierList PRESENCE optional }, + ... +} + +TDD-UL-DLConfigCommonNR ::= OCTET STRING + +TimeReferenceInformation ::= SEQUENCE { + referenceTime ReferenceTime, + referenceSFN ReferenceSFN, + uncertainty Uncertainty, + timeInformationType TimeInformationType, + iE-Extensions ProtocolExtensionContainer { {TimeReferenceInformation-ExtIEs} } OPTIONAL +} + +TimeReferenceInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeInformationType ::= ENUMERATED {localClock} + +TimeStamp ::= SEQUENCE { + systemFrameNumber SystemFrameNumber, + slotIndex TimeStampSlotIndex, + measurementTime SFNInitialisationTime OPTIONAL, + iE-Extension ProtocolExtensionContainer { { TimeStamp-ExtIEs} } OPTIONAL +} + +TimeStamp-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TimeStampSlotIndex ::= CHOICE { + sCS-15 INTEGER(0..9), + sCS-30 INTEGER(0..19), + sCS-60 INTEGER(0..39), + sCS-120 INTEGER(0..79), + choice-extension ProtocolIE-SingleContainer { { TimeStampSlotIndex-ExtIEs} } +} + +TimeStampSlotIndex-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TimeToWait ::= ENUMERATED {v1s, v2s, v5s, v10s, v20s, v60s, ...} + +TimingMeasurementQuality ::= SEQUENCE { + measurementQuality INTEGER(0..31), + resolution ENUMERATED{m0dot1, m1, m10, m30, ...}, + iE-Extensions ProtocolExtensionContainer { { TimingMeasurementQuality-ExtIEs} } OPTIONAL +} + +TimingMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TNLAssociationUsage ::= ENUMERATED { + ue, + non-ue, + both, + ... +} + +TNLCapacityIndicator::= SEQUENCE { + dLTNLOfferedCapacity INTEGER (1.. 16777216,...), + dLTNLAvailableCapacity INTEGER (0.. 100,...), + uLTNLOfferedCapacity INTEGER (1.. 16777216,...), + uLTNLAvailableCapacity INTEGER (0.. 100,...), + iE-Extensions ProtocolExtensionContainer { { TNLCapacityIndicator-ExtIEs} } OPTIONAL +} + +TNLCapacityIndicator-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TraceActivation ::= SEQUENCE { + traceID TraceID, + interfacesToTrace InterfacesToTrace, + traceDepth TraceDepth, + traceCollectionEntityIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { {TraceActivation-ExtIEs} } OPTIONAL +} + +TraceActivation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + {ID id-mdtConfiguration CRITICALITY ignore EXTENSION MDTConfiguration PRESENCE optional}| + {ID id-TraceCollectionEntityURI CRITICALITY ignore EXTENSION URI-address PRESENCE optional }, + ... +} + +TraceDepth ::= ENUMERATED { + minimum, + medium, + maximum, + minimumWithoutVendorSpecificExtension, + mediumWithoutVendorSpecificExtension, + maximumWithoutVendorSpecificExtension, + ... +} + +TraceID ::= OCTET STRING (SIZE(8)) + +TrafficMappingInfo ::= CHOICE { + iPtolayer2TrafficMappingInfo IPtolayer2TrafficMappingInfo, + bAPlayerBHRLCchannelMappingInfo BAPlayerBHRLCchannelMappingInfo, + choice-extension ProtocolIE-SingleContainer { { TrafficMappingInfo-ExtIEs} } +} + +TrafficMappingInfo-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...)) + +TransactionID ::= INTEGER (0..255, ...) + +Transmission-Bandwidth ::= SEQUENCE { + nRSCS NRSCS, + nRNRB NRNRB, + iE-Extensions ProtocolExtensionContainer { { Transmission-Bandwidth-ExtIEs} } OPTIONAL, + ... +} + +Transmission-Bandwidth-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionComb ::= CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + cyclicShift-n4 INTEGER (0..11) + }, + choice-extension ProtocolIE-SingleContainer { { TransmissionComb-ExtIEs} } +} +TransmissionComb-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TransmissionCombPos ::= CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + cyclicShift-n4 INTEGER (0..11) + }, + n8 SEQUENCE { + combOffset-n8 INTEGER (0..7), + cyclicShift-n8 INTEGER (0..5) + }, + + choice-extension ProtocolIE-SingleContainer { { TransmissionCombPos-ExtIEs} } +} +TransmissionCombPos-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +Transport-UP-Layer-Address-Info-To-Add-List ::= SEQUENCE (SIZE(1.. maxnoofTLAs)) OF Transport-UP-Layer-Address-Info-To-Add-Item + +Transport-UP-Layer-Address-Info-To-Add-Item ::= SEQUENCE { + iP-SecTransportLayerAddress TransportLayerAddress, + gTPTransportLayerAddressToAdd GTPTLAs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-UP-Layer-Address-Info-To-Add-ItemExtIEs } } OPTIONAL +} + +Transport-UP-Layer-Address-Info-To-Add-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Transport-UP-Layer-Address-Info-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTLAs)) OF Transport-UP-Layer-Address-Info-To-Remove-Item + +Transport-UP-Layer-Address-Info-To-Remove-Item ::= SEQUENCE { + iP-SecTransportLayerAddress TransportLayerAddress, + gTPTransportLayerAddressToRemove GTPTLAs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-UP-Layer-Address-Info-To-Remove-ItemExtIEs } } OPTIONAL +} + +Transport-UP-Layer-Address-Info-To-Remove-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TransmissionActionIndicator ::= ENUMERATED {stop, ..., restart } + +TRPID ::= INTEGER (0.. maxnoofTRPs, ...) + +TRPInformation ::= SEQUENCE { + tRPID TRPID, + tRPInformationTypeResponseList TRPInformationTypeResponseList, + iE-Extensions ProtocolExtensionContainer { { TRPInformation-ExtIEs } } OPTIONAL +} + +TRPInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPInformationItem ::= SEQUENCE { + tRPInformation TRPInformation, + iE-Extensions ProtocolExtensionContainer { { TRPInformationItem-ExtIEs } } OPTIONAL +} + +TRPInformationItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPInformationTypeItem ::= ENUMERATED { + nrPCI, + nG-RAN-CGI, + arfcn, + pRSConfig, + sSBConfig, + sFNInitTime, + spatialDirectInfo, + geoCoord, +...} + + +TRPInformationTypeResponseList ::= SEQUENCE (SIZE(1.. maxnoofTRPInfoTypes)) OF TRPInformationTypeResponseItem + +TRPInformationTypeResponseItem ::= CHOICE { + pCI-NR NRPCI, + nG-RAN-CGI NRCGI, + nRARFCN INTEGER (0..maxNRARFCN), + pRSConfiguration PRSConfiguration, + sSBinformation SSBInformation, + sFNInitialisationTime SFNInitialisationTime, + spatialDirectionInformation SpatialDirectionInformation, + geographicalCoordinates GeographicalCoordinates, + choice-extension ProtocolIE-SingleContainer { { TRPInformationTypeResponseItem-ExtIEs} } +} + +TRPInformationTypeResponseItem-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +TRPList ::= SEQUENCE (SIZE(1.. maxnoofTRPs)) OF TRPListItem + +TRPListItem ::= SEQUENCE { + tRPID TRPID, + iE-Extensions ProtocolExtensionContainer { { TRPListItem-ExtIEs } } OPTIONAL +} + +TRPListItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPMeasurementQuality ::= SEQUENCE { + tRPmeasurementQuality-Item TRPMeasurementQuality-Item, + iE-Extensions ProtocolExtensionContainer { {TRPMeasurementQuality-ExtIEs} } OPTIONAL +} + +TRPMeasurementQuality-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPMeasurementQuality-Item ::= CHOICE { + timingMeasurementQuality TimingMeasurementQuality, + angleMeasurementQuality AngleMeasurementQuality, + choice-extension ProtocolIE-SingleContainer { { TRPMeasurementQuality-Item-ExtIEs } } +} + +TRPMeasurementQuality-Item-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRP-MeasurementRequestList ::= SEQUENCE (SIZE (1..maxNoOfMeasTRPs)) OF TRP-MeasurementRequestItem + +TRP-MeasurementRequestItem ::= SEQUENCE { + tRPID TRPID, + search-window-information Search-window-information OPTIONAL, + iE-extensions ProtocolExtensionContainer { { TRP-MeasurementRequestItem-ExtIEs } } OPTIONAL +} + +TRP-MeasurementRequestItem-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPPositionDefinitionType ::= CHOICE { + direct TRPPositionDirect, + referenced TRPPositionReferenced, + choice-extension ProtocolIE-SingleContainer { { TRPPositionDefinitionType-ExtIEs } } +} + +TRPPositionDefinitionType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRPPositionDirect ::= SEQUENCE { + accuracy TRPPositionDirectAccuracy, + iE-extensions ProtocolExtensionContainer { { TRPPositionDirect-ExtIEs } } OPTIONAL +} + +TRPPositionDirect-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPPositionDirectAccuracy ::= CHOICE { + tRPPosition AccessPointPosition, + tRPHAposition NGRANHighAccuracyAccessPointPosition, + choice-extension ProtocolIE-SingleContainer { { TRPPositionDirectAccuracy-ExtIEs } } +} + +TRPPositionDirectAccuracy-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TRPPositionReferenced ::= SEQUENCE { + referencePoint ReferencePoint, + referencePointType TRPReferencePointType, + iE-extensions ProtocolExtensionContainer { { TRPPositionReferenced-ExtIEs } } OPTIONAL +} + +TRPPositionReferenced-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TRPReferencePointType ::= CHOICE { + tRPPositionRelativeGeodetic RelativeGeodeticLocation, + tRPPositionRelativeCartesian RelativeCartesianLocation, + choice-extension ProtocolIE-SingleContainer { { TRPReferencePointType-ExtIEs } } +} + +TRPReferencePointType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +TypeOfError ::= ENUMERATED { + not-understood, + missing, + ... +} + +Transport-Layer-Address-Info ::= SEQUENCE { + transport-UP-Layer-Address-Info-To-Add-List Transport-UP-Layer-Address-Info-To-Add-List OPTIONAL, + transport-UP-Layer-Address-Info-To-Remove-List Transport-UP-Layer-Address-Info-To-Remove-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Transport-Layer-Address-Info-ExtIEs } } OPTIONAL +} + +Transport-Layer-Address-Info-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TSCAssistanceInformation ::= SEQUENCE { + periodicity Periodicity, + burstArrivalTime BurstArrivalTime OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {TSCAssistanceInformation-ExtIEs} } OPTIONAL, + ... +} + +TSCAssistanceInformation-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TSCTrafficCharacteristics ::= SEQUENCE { + tSCAssistanceInformationDL TSCAssistanceInformation OPTIONAL, + tSCAssistanceInformationUL TSCAssistanceInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {TSCTrafficCharacteristics-ExtIEs} } OPTIONAL, + ... +} + +TSCTrafficCharacteristics-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- U +UAC-Assistance-Info ::= SEQUENCE { + uACPLMN-List UACPLMN-List, + iE-Extensions ProtocolExtensionContainer { { UAC-Assistance-InfoExtIEs} } OPTIONAL +} + +UAC-Assistance-InfoExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UACPLMN-List ::= SEQUENCE (SIZE(1..maxnoofUACPLMNs)) OF UACPLMN-Item + +UACPLMN-Item::= SEQUENCE { + pLMNIdentity PLMN-Identity, + uACType-List UACType-List, iE-Extensions ProtocolExtensionContainer { { UACPLMN-Item-ExtIEs} } OPTIONAL +} + +UACPLMN-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-NID CRITICALITY ignore EXTENSION NID PRESENCE optional }, + ... +} + +UACType-List ::= SEQUENCE (SIZE(1..maxnoofUACperPLMN)) OF UACType-Item + +UACType-Item::= SEQUENCE { + uACReductionIndication UACReductionIndication, + uACCategoryType UACCategoryType, + iE-Extensions ProtocolExtensionContainer { { UACType-Item-ExtIEs } } OPTIONAL +} + +UACType-Item-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UACCategoryType ::= CHOICE { + uACstandardized UACAction, + uACOperatorDefined UACOperatorDefined, + choice-extension ProtocolIE-SingleContainer { { UACCategoryType-ExtIEs } } +} + +UACCategoryType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UACOperatorDefined ::= SEQUENCE { + accessCategory INTEGER (32..63,...), + accessIdentity BIT STRING (SIZE(7)), + iE-Extensions ProtocolExtensionContainer { { UACOperatorDefined-ExtIEs} } OPTIONAL +} + +UACOperatorDefined-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +UACAction ::= ENUMERATED { + reject-non-emergency-mo-dt, + reject-rrc-cr-signalling, + permit-emergency-sessions-and-mobile-terminated-services-only, + permit-high-priority-sessions-and-mobile-terminated-services-only, + ... +} + +UACReductionIndication ::= INTEGER (0..100) + + +UE-associatedLogicalF1-ConnectionItem ::= SEQUENCE { + gNB-CU-UE-F1AP-ID GNB-CU-UE-F1AP-ID OPTIONAL, + gNB-DU-UE-F1AP-ID GNB-DU-UE-F1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UE-associatedLogicalF1-ConnectionItemExtIEs} } OPTIONAL, + ... +} + +UEAssistanceInformation ::= OCTET STRING + +UEAssistanceInformationEUTRA ::= OCTET STRING + +UE-associatedLogicalF1-ConnectionItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-CapabilityRAT-ContainerList::= OCTET STRING + +UEContextNotRetrievable ::= ENUMERATED {true, ...} + +UEIdentityIndexValue ::= CHOICE { + indexLength10 BIT STRING (SIZE (10)), + choice-extension ProtocolIE-SingleContainer { {UEIdentityIndexValueChoice-ExtIEs} } +} + +UEIdentityIndexValueChoice-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UL-AoA ::= SEQUENCE { + azimuthAoA INTEGER (0..3599), + zenithAoA INTEGER (0..1799) OPTIONAL, + angleCoordinateSystem ENUMERATED {lCS, gCS} OPTIONAL, + iE-extensions ProtocolExtensionContainer { { UL-AoA-ExtIEs } } +} + +UL-AoA-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-BH-Non-UP-Traffic-Mapping ::= SEQUENCE { + uL-BH-Non-UP-Traffic-Mapping-List UL-BH-Non-UP-Traffic-Mapping-List, + iE-Extensions ProtocolExtensionContainer { { UL-BH-Non-UP-Traffic-Mapping-ExtIEs } } OPTIONAL +} + +UL-BH-Non-UP-Traffic-Mapping-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-BH-Non-UP-Traffic-Mapping-List ::= SEQUENCE (SIZE(1..maxnoofNonUPTrafficMappings)) OF UL-BH-Non-UP-Traffic-Mapping-Item + +UL-BH-Non-UP-Traffic-Mapping-Item ::= SEQUENCE { + nonUPTrafficType NonUPTrafficType, + bHInfo BHInfo, + iE-Extensions ProtocolExtensionContainer { { UL-BH-Non-UP-Traffic-Mapping-ItemExtIEs } } OPTIONAL +} + +UL-BH-Non-UP-Traffic-Mapping-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULConfiguration ::= SEQUENCE { + uLUEConfiguration ULUEConfiguration, + iE-Extensions ProtocolExtensionContainer { { ULConfigurationExtIEs } } OPTIONAL, + ... +} +ULConfigurationExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-RTOA-Measurement ::= SEQUENCE { + uL-RTOA-MeasurementItem UL-RTOA-MeasurementItem, + additionalPath-List AdditionalPath-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UL-RTOA-Measurement-ExtIEs } } OPTIONAL +} + +UL-RTOA-Measurement-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-RTOA-MeasurementItem ::= CHOICE { + k0 INTEGER (0..1970049), + k1 INTEGER (0..985025), + k2 INTEGER (0..492513), + k3 INTEGER (0..246257), + k4 INTEGER (0..123129), + k5 INTEGER (0..61565), + choice-extension ProtocolIE-SingleContainer { { UL-RTOA-MeasurementItem-ExtIEs } } +} + +UL-RTOA-MeasurementItem-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +UL-SRS-RSRP ::= INTEGER (0..127) + +ULUEConfiguration ::= ENUMERATED {no-data, shared, only, ...} + +UL-UP-TNL-Information-to-Update-List-Item ::= SEQUENCE { + uLUPTNLInformation UPTransportLayerInformation, + newULUPTNLInformation UPTransportLayerInformation OPTIONAL, + bHInfo BHInfo, + iE-Extensions ProtocolExtensionContainer { { UL-UP-TNL-Information-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +UL-UP-TNL-Information-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-UP-TNL-Address-to-Update-List-Item ::= SEQUENCE { + oldIPAdress TransportLayerAddress, + newIPAdress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { UL-UP-TNL-Address-to-Update-List-ItemExtIEs } } OPTIONAL, + ... +} + +UL-UP-TNL-Address-to-Update-List-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ULUPTNLInformation-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofULUPTNLInformation)) OF ULUPTNLInformation-ToBeSetup-Item + +ULUPTNLInformation-ToBeSetup-Item ::=SEQUENCE { + uLUPTNLInformation UPTransportLayerInformation, + iE-Extensions ProtocolExtensionContainer { { ULUPTNLInformation-ToBeSetup-ItemExtIEs } } OPTIONAL, + ... +} + +ULUPTNLInformation-ToBeSetup-ItemExtIEs F1AP-PROTOCOL-EXTENSION ::= { + { ID id-BHInfo CRITICALITY ignore EXTENSION BHInfo PRESENCE optional }, + ... +} + +Uncertainty ::= INTEGER (0..32767, ...) + +UplinkChannelBW-PerSCS-List ::= SEQUENCE (SIZE (1..maxnoSCSs)) OF SCS-SpecificCarrier + +UplinkTxDirectCurrentListInformation ::= OCTET STRING + +UPTransportLayerInformation ::= CHOICE { + gTPTunnel GTPTunnel, + choice-extension ProtocolIE-SingleContainer { { UPTransportLayerInformation-ExtIEs} } +} + +UPTransportLayerInformation-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +URI-address ::= VisibleString + +-- V + +VictimgNBSetID ::= SEQUENCE { + victimgNBSetID GNBSetID, + iE-Extensions ProtocolExtensionContainer { { VictimgNBSetID-ExtIEs } } OPTIONAL +} + +VictimgNBSetID-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +VehicleUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +PedestrianUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +-- W + +-- X + +-- Y + +-- Z + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Contents.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Contents.asn new file mode 100644 index 0000000000..ba6351eddd --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Contents.asn @@ -0,0 +1,3633 @@ +-- ************************************************************** +-- +-- PDU definitions for F1AP. +-- +-- ************************************************************** + +F1AP-PDU-Contents { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Contents (1) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Candidate-SpCell-Item, + Cause, + Cells-Failed-to-be-Activated-List-Item, + Cells-Status-Item, + Cells-to-be-Activated-List-Item, + Cells-to-be-Deactivated-List-Item, + CellULConfigured, + CriticalityDiagnostics, + C-RNTI, + CUtoDURRCInformation, + DRB-Activity-Item, + DRBID, + DRBs-FailedToBeModified-Item, + DRBs-FailedToBeSetup-Item, + DRBs-FailedToBeSetupMod-Item, + DRB-Notify-Item, + DRBs-ModifiedConf-Item, + DRBs-Modified-Item, + DRBs-Required-ToBeModified-Item, + DRBs-Required-ToBeReleased-Item, + DRBs-Setup-Item, + DRBs-SetupMod-Item, + DRBs-ToBeModified-Item, + DRBs-ToBeReleased-Item, + DRBs-ToBeSetup-Item, + DRBs-ToBeSetupMod-Item, + DRXCycle, + DRXConfigurationIndicator, + DUtoCURRCInformation, + EUTRANQoS, + ExecuteDuplication, + FullConfiguration, + GNB-CU-UE-F1AP-ID, + GNB-DU-UE-F1AP-ID, + GNB-DU-ID, + GNB-DU-Served-Cells-Item, + GNB-DU-System-Information, + GNB-CU-Name, + GNB-DU-Name, + InactivityMonitoringRequest, + InactivityMonitoringResponse, + LowerLayerPresenceStatusChange, + NotificationControl, + NRCGI, + NRPCI, + UEContextNotRetrievable, + Potential-SpCell-Item, + RAT-FrequencyPriorityInformation, + RequestedSRSTransmissionCharacteristics, + ResourceCoordinationTransferContainer, + RRCContainer, + RRCContainer-RRCSetupComplete, + RRCReconfigurationCompleteIndicator, + SCellIndex, + SCell-ToBeRemoved-Item, + SCell-ToBeSetup-Item, + SCell-ToBeSetupMod-Item, + SCell-FailedtoSetup-Item, + SCell-FailedtoSetupMod-Item, + ServCellIndex, + Served-Cell-Information, + Served-Cells-To-Add-Item, + Served-Cells-To-Delete-Item, + Served-Cells-To-Modify-Item, + ServingCellMO, + SRBID, + SRBs-FailedToBeSetup-Item, + SRBs-FailedToBeSetupMod-Item, + SRBs-Required-ToBeReleased-Item, + SRBs-ToBeReleased-Item, + SRBs-ToBeSetup-Item, + SRBs-ToBeSetupMod-Item, + SRBs-Modified-Item, + SRBs-Setup-Item, + SRBs-SetupMod-Item, + TimeToWait, + TransactionID, + TransmissionActionIndicator, + UE-associatedLogicalF1-ConnectionItem, + DUtoCURRCContainer, + PagingCell-Item, + SItype-List, + UEIdentityIndexValue, + GNB-CU-TNL-Association-Setup-Item, + GNB-CU-TNL-Association-Failed-To-Setup-Item, + GNB-CU-TNL-Association-To-Add-Item, + GNB-CU-TNL-Association-To-Remove-Item, + GNB-CU-TNL-Association-To-Update-Item, + MaskedIMEISV, + PagingDRX, + PagingPriority, + PagingIdentity, + Cells-to-be-Barred-Item, + PWSSystemInformation, + Broadcast-To-Be-Cancelled-Item, + Cells-Broadcast-Cancelled-Item, + NR-CGI-List-For-Restart-Item, + PWS-Failed-NR-CGI-Item, + RepetitionPeriod, + NumberofBroadcastRequest, + Cells-To-Be-Broadcast-Item, + Cells-Broadcast-Completed-Item, + Cancel-all-Warning-Messages-Indicator, + EUTRA-NR-CellResourceCoordinationReq-Container, + EUTRA-NR-CellResourceCoordinationReqAck-Container, + RequestType, + PLMN-Identity, + RLCFailureIndication, + UplinkTxDirectCurrentListInformation, + SULAccessIndication, + Protected-EUTRA-Resources-Item, + GNB-DUConfigurationQuery, + BitRate, + RRC-Version, + GNBDUOverloadInformation, + RRCDeliveryStatusRequest, + NeedforGap, + RRCDeliveryStatus, + ResourceCoordinationTransferInformation, + Dedicated-SIDelivery-NeededUE-Item, + Associated-SCell-Item, + IgnoreResourceCoordinationContainer, + PagingOrigin, + UAC-Assistance-Info, + RANUEID, + GNB-DU-TNL-Association-To-Remove-Item, + NotificationInformation, + TraceActivation, + TraceID, + Neighbour-Cell-Information-Item, + SymbolAllocInSlot, + NumDLULSymbols, + AdditionalRRMPriorityIndex, + DUCURadioInformationType, + CUDURadioInformationType, + Transport-Layer-Address-Info, + BHChannels-ToBeSetup-Item, + BHChannels-Setup-Item, + BHChannels-FailedToBeSetup-Item, + BHChannels-ToBeModified-Item, + BHChannels-ToBeReleased-Item, + BHChannels-ToBeSetupMod-Item, + BHChannels-FailedToBeModified-Item, + BHChannels-FailedToBeSetupMod-Item, + BHChannels-Modified-Item, + BHChannels-SetupMod-Item, + BHChannels-Required-ToBeReleased-Item, + BAPAddress, + BAPPathID, + BAPRoutingID, + BH-Routing-Information-Added-List-Item, + BH-Routing-Information-Removed-List-Item, + Child-Nodes-List, + Child-Nodes-List-Item, + Child-Node-Cells-List, + Child-Node-Cells-List-Item, + Activated-Cells-to-be-Updated-List, + Activated-Cells-to-be-Updated-List-Item, + UL-BH-Non-UP-Traffic-Mapping, + IABTNLAddressesRequested, + IABIPv6RequestType, + IAB-TNL-Addresses-To-Remove-Item, + IABTNLAddress, + IAB-Allocated-TNL-Address-Item, + IABv4AddressesRequested, + TrafficMappingInfo, + UL-UP-TNL-Information-to-Update-List-Item, + UL-UP-TNL-Address-to-Update-List-Item, + DL-UP-TNL-Address-to-Update-List-Item, + NRV2XServicesAuthorized, + LTEV2XServicesAuthorized, + NRUESidelinkAggregateMaximumBitrate, + LTEUESidelinkAggregateMaximumBitrate, + SLDRBs-SetupMod-Item, + SLDRBs-ModifiedConf-Item, + SLDRBID, + SLDRBs-FailedToBeModified-Item, + SLDRBs-FailedToBeSetup-Item, + SLDRBs-FailedToBeSetupMod-Item, + SLDRBs-Modified-Item, + SLDRBs-Required-ToBeModified-Item, + SLDRBs-Required-ToBeReleased-Item, + SLDRBs-Setup-Item, + SLDRBs-ToBeModified-Item, + SLDRBs-ToBeReleased-Item, + SLDRBs-ToBeSetup-Item, + SLDRBs-ToBeSetupMod-Item, + GNBCUMeasurementID, + GNBDUMeasurementID, + RegistrationRequest, + ReportCharacteristics, + CellToReportList, + HardwareLoadIndicator, + CellMeasurementResultList, + ReportingPeriodicity, + TNLCapacityIndicator, + RACHReportInformationList, + RLFReportInformationList, + ReportingRequestType, + TimeReferenceInformation, + ConditionalInterDUMobilityInformation, + ConditionalIntraDUMobilityInformation, + TargetCellList, + MDTPLMNList, + PrivacyIndicator, + TransportLayerAddress, + URI-address, + NID, + PosAssistance-Information, + PosBroadcast, + PositioningBroadcastCells, + RoutingID, + PosAssistanceInformationFailureList, + PosMeasurementQuantities, + PosMeasurementResultList, + PosMeasurementPeriodicity, + PosReportCharacteristics, + TRPInformationTypeItem, + TRPInformationItem, + LMF-MeasurementID, + RAN-MeasurementID, + SRSResourceSetID, + SRSSpatialRelation, + SRSResourceTrigger, + SRSConfiguration, + TRPList, + E-CID-MeasurementQuantities, + E-CID-MeasurementPeriodicity, + E-CID-MeasurementResult, + Cell-Portion-ID, + LMF-UE-MeasurementID, + RAN-UE-MeasurementID, + SFNInitialisationTime, + SystemFrameNumber, + SlotNumber, + AbortTransmission, + TRP-MeasurementRequestList, + MeasurementBeamInfoRequest, + E-CID-ReportCharacteristics, + Extended-GNB-CU-Name, + Extended-GNB-DU-Name + + + +FROM F1AP-IEs + + PrivateIE-Container{}, + ProtocolExtensionContainer{}, + ProtocolIE-Container{}, + ProtocolIE-ContainerPair{}, + ProtocolIE-SingleContainer{}, + F1AP-PRIVATE-IES, + F1AP-PROTOCOL-EXTENSION, + F1AP-PROTOCOL-IES, + F1AP-PROTOCOL-IES-PAIR + +FROM F1AP-Containers + + id-Candidate-SpCell-Item, + id-Candidate-SpCell-List, + id-Cause, + id-Cancel-all-Warning-Messages-Indicator, + id-Cells-Failed-to-be-Activated-List, + id-Cells-Failed-to-be-Activated-List-Item, + id-Cells-Status-Item, + id-Cells-Status-List, + id-Cells-to-be-Activated-List, + id-Cells-to-be-Activated-List-Item, + id-Cells-to-be-Deactivated-List, + id-Cells-to-be-Deactivated-List-Item, + id-ConfirmedUEID, + id-CriticalityDiagnostics, + id-C-RNTI, + id-CUtoDURRCInformation, + id-DRB-Activity-Item, + id-DRB-Activity-List, + id-DRBs-FailedToBeModified-Item, + id-DRBs-FailedToBeModified-List, + id-DRBs-FailedToBeSetup-Item, + id-DRBs-FailedToBeSetup-List, + id-DRBs-FailedToBeSetupMod-Item, + id-DRBs-FailedToBeSetupMod-List, + id-DRBs-ModifiedConf-Item, + id-DRBs-ModifiedConf-List, + id-DRBs-Modified-Item, + id-DRBs-Modified-List, + id-DRB-Notify-Item, + id-DRB-Notify-List, + id-DRBs-Required-ToBeModified-Item, + id-DRBs-Required-ToBeModified-List, + id-DRBs-Required-ToBeReleased-Item, + id-DRBs-Required-ToBeReleased-List, + id-DRBs-Setup-Item, + id-DRBs-Setup-List, + id-DRBs-SetupMod-Item, + id-DRBs-SetupMod-List, + id-DRBs-ToBeModified-Item, + id-DRBs-ToBeModified-List, + id-DRBs-ToBeReleased-Item, + id-DRBs-ToBeReleased-List, + id-DRBs-ToBeSetup-Item, + id-DRBs-ToBeSetup-List, + id-DRBs-ToBeSetupMod-Item, + id-DRBs-ToBeSetupMod-List, + id-DRXCycle, + id-DUtoCURRCInformation, + id-ExecuteDuplication, + id-FullConfiguration, + id-gNB-CU-UE-F1AP-ID, + id-gNB-DU-UE-F1AP-ID, + id-gNB-DU-ID, + id-GNB-DU-Served-Cells-Item, + id-gNB-DU-Served-Cells-List, + id-gNB-CU-Name, + id-gNB-DU-Name, + id-Extended-GNB-CU-Name, + id-Extended-GNB-DU-Name, + id-InactivityMonitoringRequest, + id-InactivityMonitoringResponse, + id-new-gNB-CU-UE-F1AP-ID, + id-new-gNB-DU-UE-F1AP-ID, + id-oldgNB-DU-UE-F1AP-ID, + id-PLMNAssistanceInfoForNetShar, + id-Potential-SpCell-Item, + id-Potential-SpCell-List, + id-RAT-FrequencyPriorityInformation, + id-RedirectedRRCmessage, + id-ResetType, + id-RequestedSRSTransmissionCharacteristics, + id-ResourceCoordinationTransferContainer, + id-RRCContainer, + id-RRCContainer-RRCSetupComplete, + id-RRCReconfigurationCompleteIndicator, + id-SCell-FailedtoSetup-List, + id-SCell-FailedtoSetup-Item, + id-SCell-FailedtoSetupMod-List, + id-SCell-FailedtoSetupMod-Item, + id-SCell-ToBeRemoved-Item, + id-SCell-ToBeRemoved-List, + id-SCell-ToBeSetup-Item, + id-SCell-ToBeSetup-List, + id-SCell-ToBeSetupMod-Item, + id-SCell-ToBeSetupMod-List, + id-SelectedPLMNID, + id-Served-Cells-To-Add-Item, + id-Served-Cells-To-Add-List, + id-Served-Cells-To-Delete-Item, + id-Served-Cells-To-Delete-List, + id-Served-Cells-To-Modify-Item, + id-Served-Cells-To-Modify-List, + id-ServCellIndex, + id-ServingCellMO, + id-SpCell-ID, + id-SpCellULConfigured, + id-SRBID, + id-SRBs-FailedToBeSetup-Item, + id-SRBs-FailedToBeSetup-List, + id-SRBs-FailedToBeSetupMod-Item, + id-SRBs-FailedToBeSetupMod-List, + id-SRBs-Required-ToBeReleased-Item, + id-SRBs-Required-ToBeReleased-List, + id-SRBs-ToBeReleased-Item, + id-SRBs-ToBeReleased-List, + id-SRBs-ToBeSetup-Item, + id-SRBs-ToBeSetup-List, + id-SRBs-ToBeSetupMod-Item, + id-SRBs-ToBeSetupMod-List, + id-SRBs-Modified-Item, + id-SRBs-Modified-List, + id-SRBs-Setup-Item, + id-SRBs-Setup-List, + id-SRBs-SetupMod-Item, + id-SRBs-SetupMod-List, + id-TimeToWait, + id-TransactionID, + id-TransmissionActionIndicator, + id-UEContextNotRetrievable, + id-UE-associatedLogicalF1-ConnectionItem, + id-UE-associatedLogicalF1-ConnectionListResAck, + id-DUtoCURRCContainer, + id-NRCGI, + id-PagingCell-Item, + id-PagingCell-List, + id-PagingDRX, + id-PagingPriority, + id-SItype-List, + id-UEIdentityIndexValue, + id-GNB-CU-TNL-Association-Setup-List, + id-GNB-CU-TNL-Association-Setup-Item, + id-GNB-CU-TNL-Association-Failed-To-Setup-List, + id-GNB-CU-TNL-Association-Failed-To-Setup-Item, + id-GNB-CU-TNL-Association-To-Add-Item, + id-GNB-CU-TNL-Association-To-Add-List, + id-GNB-CU-TNL-Association-To-Remove-Item, + id-GNB-CU-TNL-Association-To-Remove-List, + id-GNB-CU-TNL-Association-To-Update-Item, + id-GNB-CU-TNL-Association-To-Update-List, + id-MaskedIMEISV, + id-PagingIdentity, + id-Cells-to-be-Barred-List, + id-Cells-to-be-Barred-Item, + id-PWSSystemInformation, + id-RepetitionPeriod, + id-NumberofBroadcastRequest, + id-Cells-To-Be-Broadcast-List, + id-Cells-To-Be-Broadcast-Item, + id-Cells-Broadcast-Completed-List, + id-Cells-Broadcast-Completed-Item, + id-Broadcast-To-Be-Cancelled-List, + id-Broadcast-To-Be-Cancelled-Item, + id-Cells-Broadcast-Cancelled-List, + id-Cells-Broadcast-Cancelled-Item, + id-NR-CGI-List-For-Restart-List, + id-NR-CGI-List-For-Restart-Item, + id-PWS-Failed-NR-CGI-List, + id-PWS-Failed-NR-CGI-Item, + id-EUTRA-NR-CellResourceCoordinationReq-Container, + id-EUTRA-NR-CellResourceCoordinationReqAck-Container, + id-Protected-EUTRA-Resources-List, + id-RequestType, + id-ServingPLMN, + id-DRXConfigurationIndicator, + id-RLCFailureIndication, + id-UplinkTxDirectCurrentListInformation, + id-SULAccessIndication, + id-Protected-EUTRA-Resources-Item, + id-GNB-DUConfigurationQuery, + id-GNB-DU-UE-AMBR-UL, + id-GNB-CU-RRC-Version, + id-GNB-DU-RRC-Version, + id-GNBDUOverloadInformation, + id-NeedforGap, + id-RRCDeliveryStatusRequest, + id-RRCDeliveryStatus, + id-Dedicated-SIDelivery-NeededUE-List, + id-Dedicated-SIDelivery-NeededUE-Item, + id-ResourceCoordinationTransferInformation, + id-Associated-SCell-List, + id-Associated-SCell-Item, + id-IgnoreResourceCoordinationContainer, + id-UAC-Assistance-Info, + id-RANUEID, + id-PagingOrigin, + id-GNB-DU-TNL-Association-To-Remove-Item, + id-GNB-DU-TNL-Association-To-Remove-List, + id-NotificationInformation, + id-TraceActivation, + id-TraceID, + id-Neighbour-Cell-Information-List, + id-Neighbour-Cell-Information-Item, + id-SymbolAllocInSlot, + id-NumDLULSymbols, + id-AdditionalRRMPriorityIndex, + id-DUCURadioInformationType, + id-CUDURadioInformationType, + id-LowerLayerPresenceStatusChange, + id-Transport-Layer-Address-Info, + id-BHChannels-ToBeSetup-List, + id-BHChannels-ToBeSetup-Item, + id-BHChannels-Setup-List, + id-BHChannels-Setup-Item, + id-BHChannels-ToBeModified-Item, + id-BHChannels-ToBeModified-List, + id-BHChannels-ToBeReleased-Item, + id-BHChannels-ToBeReleased-List, + id-BHChannels-ToBeSetupMod-Item, + id-BHChannels-ToBeSetupMod-List, + id-BHChannels-FailedToBeSetup-Item, + id-BHChannels-FailedToBeSetup-List, + id-BHChannels-FailedToBeModified-Item, + id-BHChannels-FailedToBeModified-List, + id-BHChannels-FailedToBeSetupMod-Item, + id-BHChannels-FailedToBeSetupMod-List, + id-BHChannels-Modified-Item, + id-BHChannels-Modified-List, + id-BHChannels-SetupMod-Item, + id-BHChannels-SetupMod-List, + id-BHChannels-Required-ToBeReleased-Item, + id-BHChannels-Required-ToBeReleased-List, + id-BAPAddress, + id-ConfiguredBAPAddress, + id-BH-Routing-Information-Added-List, + id-BH-Routing-Information-Added-List-Item, + id-BH-Routing-Information-Removed-List, + id-BH-Routing-Information-Removed-List-Item, + id-UL-BH-Non-UP-Traffic-Mapping, + id-Child-Nodes-List, + id-Activated-Cells-to-be-Updated-List, + id-IABIPv6RequestType, + id-IAB-TNL-Addresses-To-Remove-List, + id-IAB-TNL-Addresses-To-Remove-Item, + id-IAB-Allocated-TNL-Address-List, + id-IAB-Allocated-TNL-Address-Item, + id-IABv4AddressesRequested, + id-TrafficMappingInformation, + id-UL-UP-TNL-Information-to-Update-List, + id-UL-UP-TNL-Information-to-Update-List-Item, + id-UL-UP-TNL-Address-to-Update-List, + id-UL-UP-TNL-Address-to-Update-List-Item, + id-DL-UP-TNL-Address-to-Update-List, + id-DL-UP-TNL-Address-to-Update-List-Item, + id-NRV2XServicesAuthorized, + id-LTEV2XServicesAuthorized, + id-NRUESidelinkAggregateMaximumBitrate, + id-LTEUESidelinkAggregateMaximumBitrate, + id-PC5LinkAMBR, + id-SLDRBs-FailedToBeModified-Item, + id-SLDRBs-FailedToBeModified-List, + id-SLDRBs-FailedToBeSetup-Item, + id-SLDRBs-FailedToBeSetup-List, + id-SLDRBs-Modified-Item, + id-SLDRBs-Modified-List, + id-SLDRBs-Required-ToBeModified-Item, + id-SLDRBs-Required-ToBeModified-List, + id-SLDRBs-Required-ToBeReleased-Item, + id-SLDRBs-Required-ToBeReleased-List, + id-SLDRBs-Setup-Item, + id-SLDRBs-Setup-List, + id-SLDRBs-ToBeModified-Item, + id-SLDRBs-ToBeModified-List, + id-SLDRBs-ToBeReleased-Item, + id-SLDRBs-ToBeReleased-List, + id-SLDRBs-ToBeSetup-Item, + id-SLDRBs-ToBeSetup-List, + id-SLDRBs-ToBeSetupMod-Item, + id-SLDRBs-ToBeSetupMod-List, + id-SLDRBs-SetupMod-List, + id-SLDRBs-FailedToBeSetupMod-List, + id-SLDRBs-SetupMod-Item, + id-SLDRBs-FailedToBeSetupMod-Item, + id-SLDRBs-ModifiedConf-List, + id-SLDRBs-ModifiedConf-Item, + id-gNBCUMeasurementID, + id-gNBDUMeasurementID, + id-RegistrationRequest, + id-ReportCharacteristics, + id-CellToReportList, + id-CellMeasurementResultList, + id-HardwareLoadIndicator, + id-ReportingPeriodicity, + id-TNLCapacityIndicator, + id-RACHReportInformationList, + id-RLFReportInformationList, + id-ReportingRequestType, + id-TimeReferenceInformation, + id-ConditionalInterDUMobilityInformation, + id-ConditionalIntraDUMobilityInformation, + id-targetCellsToCancel, + id-requestedTargetCellGlobalID, + id-TraceCollectionEntityIPAddress, + id-ManagementBasedMDTPLMNList, + id-PrivacyIndicator, + id-TraceCollectionEntityURI, + id-ServingNID, + id-PosAssistance-Information, + id-PosBroadcast, + id-PositioningBroadcastCells, + id-RoutingID, + id-PosAssistanceInformationFailureList, + id-PosMeasurementQuantities, + id-PosMeasurementResultList, + id-PosMeasurementPeriodicity, + id-PosReportCharacteristics, + id-TRPInformationTypeListTRPReq, + id-TRPInformationTypeItem, + id-TRPInformationListTRPResp, + id-TRPInformationItem, + id-LMF-MeasurementID, + id-RAN-MeasurementID, + id-SRSType, + id-ActivationTime, + id-AbortTransmission, + id-SRSConfiguration, + id-TRPList, + id-E-CID-MeasurementQuantities, + id-E-CID-MeasurementPeriodicity, + id-E-CID-MeasurementResult, + id-Cell-Portion-ID, + id-LMF-UE-MeasurementID, + id-RAN-UE-MeasurementID, + id-SFNInitialisationTime, + id-SystemFrameNumber, + id-SlotNumber, + id-TRP-MeasurementRequestList, + id-MeasurementBeamInfoRequest, + id-E-CID-ReportCharacteristics, + + maxCellingNBDU, + maxnoofCandidateSpCells, + maxnoofDRBs, + maxnoofErrors, + maxnoofIndividualF1ConnectionsToReset, + maxnoofPotentialSpCells, + maxnoofSCells, + maxnoofSRBs, + maxnoofPagingCells, + maxnoofTNLAssociations, + maxCellineNB, + maxnoofUEIDs, + maxnoofBHRLCChannels, + maxnoofRoutingEntries, + maxnoofChildIABNodes, + maxnoofServedCellsIAB, + maxnoofTLAsIAB, + maxnoofULUPTNLInformationforIAB, + maxnoofUPTNLAddresses, + maxnoofSLDRBs, + maxnoofTRPInfoTypes, + maxnoofTRPs + + + +FROM F1AP-Constants; + + +-- ************************************************************** +-- +-- RESET ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Reset +-- +-- ************************************************************** + +Reset ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetIEs} }, + ... +} + +ResetIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-ResetType CRITICALITY reject TYPE ResetType PRESENCE mandatory }, + ... +} + +ResetType ::= CHOICE { + f1-Interface ResetAll, + partOfF1-Interface UE-associatedLogicalF1-ConnectionListRes, + choice-extension ProtocolIE-SingleContainer { { ResetType-ExtIEs} } +} + +ResetType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + + +ResetAll ::= ENUMERATED { + reset-all, + ... +} + +UE-associatedLogicalF1-ConnectionListRes ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemRes } } + +UE-associatedLogicalF1-ConnectionItemRes F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY reject TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- Reset Acknowledge +-- +-- ************************************************************** + +ResetAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetAcknowledgeIEs} }, + ... +} + +ResetAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UE-associatedLogicalF1-ConnectionListResAck CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionListResAck PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +UE-associatedLogicalF1-ConnectionListResAck ::= SEQUENCE (SIZE(1.. maxnoofIndividualF1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalF1-ConnectionItemResAck } } + +UE-associatedLogicalF1-ConnectionItemResAck F1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalF1-ConnectionItem CRITICALITY ignore TYPE UE-associatedLogicalF1-ConnectionItem PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- ERROR INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Error Indication +-- +-- ************************************************************** + +ErrorIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ErrorIndicationIEs}}, + ... +} + +ErrorIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- F1 SETUP ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Setup Request +-- +-- ************************************************************** + +F1SetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupRequestIEs} }, + ... +} + +F1SetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE mandatory }| + { ID id-gNB-DU-Name CRITICALITY ignore TYPE GNB-DU-Name PRESENCE optional }| + { ID id-gNB-DU-Served-Cells-List CRITICALITY reject TYPE GNB-DU-Served-Cells-List PRESENCE optional }| + { ID id-GNB-DU-RRC-Version CRITICALITY reject TYPE RRC-Version PRESENCE mandatory }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-BAPAddress CRITICALITY ignore TYPE BAPAddress PRESENCE optional }| + { ID id-Extended-GNB-CU-Name CRITICALITY ignore TYPE Extended-GNB-CU-Name PRESENCE optional }, + ... +} + + +GNB-DU-Served-Cells-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { GNB-DU-Served-Cells-ItemIEs } } + +GNB-DU-Served-Cells-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-Served-Cells-Item CRITICALITY reject TYPE GNB-DU-Served-Cells-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- F1 Setup Response +-- +-- ************************************************************** + +F1SetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupResponseIEs} }, + ... +} + + +F1SetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNB-CU-Name CRITICALITY ignore TYPE GNB-CU-Name PRESENCE optional }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-GNB-CU-RRC-Version CRITICALITY reject TYPE RRC-Version PRESENCE mandatory }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }| + { ID id-BAPAddress CRITICALITY ignore TYPE BAPAddress PRESENCE optional }| + { ID id-Extended-GNB-DU-Name CRITICALITY ignore TYPE Extended-GNB-DU-Name PRESENCE optional }, + ... +} + + +Cells-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Activated-List-ItemIEs } } + +Cells-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-Cells-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-to-be-Activated-List-Item PRESENCE mandatory}, + ... +} + + + +-- ************************************************************** +-- +-- F1 Setup Failure +-- +-- ************************************************************** + +F1SetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {F1SetupFailureIEs} }, + ... +} + +F1SetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBDUConfigurationUpdate::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateIEs} }, + ... +} + +GNBDUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Served-Cells-To-Add-List CRITICALITY reject TYPE Served-Cells-To-Add-List PRESENCE optional }| + { ID id-Served-Cells-To-Modify-List CRITICALITY reject TYPE Served-Cells-To-Modify-List PRESENCE optional }| + { ID id-Served-Cells-To-Delete-List CRITICALITY reject TYPE Served-Cells-To-Delete-List PRESENCE optional }| + { ID id-Cells-Status-List CRITICALITY reject TYPE Cells-Status-List PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }| + { ID id-gNB-DU-ID CRITICALITY reject TYPE GNB-DU-ID PRESENCE optional }| + { ID id-GNB-DU-TNL-Association-To-Remove-List CRITICALITY reject TYPE GNB-DU-TNL-Association-To-Remove-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }, + ... +} + +Served-Cells-To-Add-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Add-ItemIEs } } +Served-Cells-To-Modify-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Modify-ItemIEs } } +Served-Cells-To-Delete-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Served-Cells-To-Delete-ItemIEs } } +Cells-Status-List ::= SEQUENCE (SIZE(0.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Status-ItemIEs } } + +Dedicated-SIDelivery-NeededUE-List::= SEQUENCE (SIZE(1.. maxnoofUEIDs)) OF ProtocolIE-SingleContainer { { Dedicated-SIDelivery-NeededUE-ItemIEs } } + +GNB-DU-TNL-Association-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-DU-TNL-Association-To-Remove-ItemIEs } } + + +Served-Cells-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Add-Item CRITICALITY reject TYPE Served-Cells-To-Add-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Modify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Modify-Item CRITICALITY reject TYPE Served-Cells-To-Modify-Item PRESENCE mandatory }, + ... +} + +Served-Cells-To-Delete-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Served-Cells-To-Delete-Item CRITICALITY reject TYPE Served-Cells-To-Delete-Item PRESENCE mandatory }, + ... +} + +Cells-Status-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Status-Item CRITICALITY reject TYPE Cells-Status-Item PRESENCE mandatory }, + ... +} + +Dedicated-SIDelivery-NeededUE-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Dedicated-SIDelivery-NeededUE-Item CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-Item PRESENCE mandatory }, + ... +} + +GNB-DU-TNL-Association-To-Remove-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-DU-TNL-Association-To-Remove-Item CRITICALITY reject TYPE GNB-DU-TNL-Association-To-Remove-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBDUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-DU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBDUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUConfigurationUpdateFailureIEs} }, + ... +} + +GNBDUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE +-- +-- ************************************************************** + +GNBCUConfigurationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateIEs} }, + ... +} + +GNBCUConfigurationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-to-be-Activated-List CRITICALITY reject TYPE Cells-to-be-Activated-List PRESENCE optional }| + { ID id-Cells-to-be-Deactivated-List CRITICALITY reject TYPE Cells-to-be-Deactivated-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Add-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Add-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Remove-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Remove-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-To-Update-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Update-List PRESENCE optional }| + { ID id-Cells-to-be-Barred-List CRITICALITY ignore TYPE Cells-to-be-Barred-List PRESENCE optional }| + { ID id-Protected-EUTRA-Resources-List CRITICALITY reject TYPE Protected-EUTRA-Resources-List PRESENCE optional }| + { ID id-Neighbour-Cell-Information-List CRITICALITY ignore TYPE Neighbour-Cell-Information-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }| + { ID id-UL-BH-Non-UP-Traffic-Mapping CRITICALITY reject TYPE UL-BH-Non-UP-Traffic-Mapping PRESENCE optional }, + ... +} + +Cells-to-be-Deactivated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Deactivated-List-ItemIEs } } +GNB-CU-TNL-Association-To-Add-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Add-ItemIEs } } +GNB-CU-TNL-Association-To-Remove-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Remove-ItemIEs } } +GNB-CU-TNL-Association-To-Update-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-To-Update-ItemIEs } } +Cells-to-be-Barred-List ::= SEQUENCE(SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-to-be-Barred-ItemIEs } } + + +Cells-to-be-Deactivated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Deactivated-List-Item CRITICALITY reject TYPE Cells-to-be-Deactivated-List-Item PRESENCE mandatory }, + ... +} + + +GNB-CU-TNL-Association-To-Add-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Add-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Add-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-To-Remove-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Remove-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Remove-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-To-Update-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-To-Update-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-To-Update-Item PRESENCE mandatory }, + ... +} + +Cells-to-be-Barred-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-to-be-Barred-Item CRITICALITY ignore TYPE Cells-to-be-Barred-Item PRESENCE mandatory }, + ... +} + +Protected-EUTRA-Resources-List ::= SEQUENCE (SIZE(1.. maxCellineNB)) OF ProtocolIE-SingleContainer { { Protected-EUTRA-Resources-ItemIEs } } +Protected-EUTRA-Resources-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Protected-EUTRA-Resources-Item CRITICALITY reject TYPE Protected-EUTRA-Resources-Item PRESENCE mandatory}, + ... +} + +Neighbour-Cell-Information-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Neighbour-Cell-Information-ItemIEs } } +Neighbour-Cell-Information-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Neighbour-Cell-Information-Item CRITICALITY ignore TYPE Neighbour-Cell-Information-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +GNBCUConfigurationUpdateAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Failed-to-be-Activated-List CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Setup-List PRESENCE optional }| + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-List CRITICALITY ignore TYPE GNB-CU-TNL-Association-Failed-To-Setup-List PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }| + { ID id-Transport-Layer-Address-Info CRITICALITY ignore TYPE Transport-Layer-Address-Info PRESENCE optional }, + ... +} + +Cells-Failed-to-be-Activated-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Failed-to-be-Activated-List-ItemIEs } } +GNB-CU-TNL-Association-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Setup-ItemIEs } } +GNB-CU-TNL-Association-Failed-To-Setup-List ::= SEQUENCE (SIZE(1.. maxnoofTNLAssociations)) OF ProtocolIE-SingleContainer { { GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs } } + +Cells-Failed-to-be-Activated-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Failed-to-be-Activated-List-Item CRITICALITY reject TYPE Cells-Failed-to-be-Activated-List-Item PRESENCE mandatory }, + ... +} + +GNB-CU-TNL-Association-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Setup-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-Setup-Item PRESENCE mandatory }, + ... +} + + +GNB-CU-TNL-Association-Failed-To-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-GNB-CU-TNL-Association-Failed-To-Setup-Item CRITICALITY ignore TYPE GNB-CU-TNL-Association-Failed-To-Setup-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- GNB-CU CONFIGURATION UPDATE FAILURE +-- +-- ************************************************************** + +GNBCUConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBCUConfigurationUpdateFailureIEs} }, + ... +} + +GNBCUConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION REQUEST +-- +-- ************************************************************** + +GNBDUResourceCoordinationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationRequest-IEs}}, + ... +} + +GNBDUResourceCoordinationRequest-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-RequestType CRITICALITY reject TYPE RequestType PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReq-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReq-Container PRESENCE mandatory}| + { ID id-IgnoreResourceCoordinationContainer CRITICALITY reject TYPE IgnoreResourceCoordinationContainer PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE COORDINATION RESPONSE +-- +-- ************************************************************** + +GNBDUResourceCoordinationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{GNBDUResourceCoordinationResponse-IEs}}, + ... +} + +GNBDUResourceCoordinationResponse-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-EUTRA-NR-CellResourceCoordinationReqAck-Container CRITICALITY reject TYPE EUTRA-NR-CellResourceCoordinationReqAck-Container PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE Context Setup ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT SETUP REQUEST +-- +-- ************************************************************** + +UEContextSetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupRequestIEs} }, + ... +} + +UEContextSetupRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SpCell-ID CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-ServCellIndex CRITICALITY reject TYPE ServCellIndex PRESENCE mandatory }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE mandatory}| + { ID id-Candidate-SpCell-List CRITICALITY ignore TYPE Candidate-SpCell-List PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-SCell-ToBeSetup-List CRITICALITY ignore TYPE SCell-ToBeSetup-List PRESENCE optional }| + { ID id-SRBs-ToBeSetup-List CRITICALITY reject TYPE SRBs-ToBeSetup-List PRESENCE optional }| + { ID id-DRBs-ToBeSetup-List CRITICALITY reject TYPE DRBs-ToBeSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-MaskedIMEISV CRITICALITY ignore TYPE MaskedIMEISV PRESENCE optional }| + { ID id-ServingPLMN CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional }| + { ID id-GNB-DU-UE-AMBR-UL CRITICALITY ignore TYPE BitRate PRESENCE conditional }| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-ServingCellMO CRITICALITY ignore TYPE ServingCellMO PRESENCE optional }| + { ID id-new-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-RANUEID CRITICALITY ignore TYPE RANUEID PRESENCE optional }| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }| + { ID id-BHChannels-ToBeSetup-List CRITICALITY reject TYPE BHChannels-ToBeSetup-List PRESENCE optional }| + { ID id-ConfiguredBAPAddress CRITICALITY reject TYPE BAPAddress PRESENCE optional }| + { ID id-NRV2XServicesAuthorized CRITICALITY ignore TYPE NRV2XServicesAuthorized PRESENCE optional }| + { ID id-LTEV2XServicesAuthorized CRITICALITY ignore TYPE LTEV2XServicesAuthorized PRESENCE optional }| + { ID id-NRUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE NRUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-LTEUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE LTEUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-PC5LinkAMBR CRITICALITY ignore TYPE BitRate PRESENCE optional}| + { ID id-SLDRBs-ToBeSetup-List CRITICALITY reject TYPE SLDRBs-ToBeSetup-List PRESENCE optional }| + { ID id-ConditionalInterDUMobilityInformation CRITICALITY reject TYPE ConditionalInterDUMobilityInformation PRESENCE optional}| + { ID id-ManagementBasedMDTPLMNList CRITICALITY ignore TYPE MDTPLMNList PRESENCE optional }| + { ID id-ServingNID CRITICALITY reject TYPE NID PRESENCE optional }, + ... +} + +Candidate-SpCell-List::= SEQUENCE (SIZE(1..maxnoofCandidateSpCells)) OF ProtocolIE-SingleContainer { { Candidate-SpCell-ItemIEs} } +SCell-ToBeSetup-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetup-ItemIEs} } +SRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetup-ItemIEs} } +DRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetup-ItemIEs} } +BHChannels-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeSetup-ItemIEs} } +SLDRBs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeSetup-ItemIEs} } + +Candidate-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Candidate-SpCell-Item CRITICALITY ignore TYPE Candidate-SpCell-Item PRESENCE mandatory }, + ... +} + + +SCell-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetup-Item CRITICALITY ignore TYPE SCell-ToBeSetup-Item PRESENCE mandatory }, + ... +} + +SRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetup-Item CRITICALITY reject TYPE SRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetup-Item CRITICALITY reject TYPE DRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeSetup-Item CRITICALITY reject TYPE BHChannels-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeSetup-Item CRITICALITY reject TYPE SLDRBs-ToBeSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP RESPONSE +-- +-- ************************************************************** + +UEContextSetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupResponseIEs} }, + ... +} + + +UEContextSetupResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY ignore TYPE C-RNTI PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-DRBs-Setup-List CRITICALITY ignore TYPE DRBs-Setup-List PRESENCE optional }| + { ID id-SRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetup-List CRITICALITY ignore TYPE DRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-SCell-FailedtoSetup-List CRITICALITY ignore TYPE SCell-FailedtoSetup-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-SRBs-Setup-List CRITICALITY ignore TYPE SRBs-Setup-List PRESENCE optional }| + { ID id-BHChannels-Setup-List CRITICALITY ignore TYPE BHChannels-Setup-List PRESENCE optional }| + { ID id-BHChannels-FailedToBeSetup-List CRITICALITY ignore TYPE BHChannels-FailedToBeSetup-List PRESENCE optional }| + { ID id-SLDRBs-Setup-List CRITICALITY ignore TYPE SLDRBs-Setup-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeSetup-List CRITICALITY ignore TYPE SLDRBs-FailedToBeSetup-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + +DRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Setup-ItemIEs} } + + +SRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetup-ItemIEs} } +DRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetup-ItemIEs} } +SCell-FailedtoSetup-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetup-ItemIEs} } +SRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Setup-ItemIEs} } +BHChannels-Setup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Setup-ItemIEs} } +BHChannels-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeSetup-ItemIEs} } + +DRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Setup-Item CRITICALITY ignore TYPE DRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Setup-Item CRITICALITY ignore TYPE SRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetup-Item CRITICALITY ignore TYPE SCell-FailedtoSetup-Item PRESENCE mandatory}, + ... +} + +BHChannels-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Setup-Item CRITICALITY ignore TYPE BHChannels-Setup-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeSetup-Item CRITICALITY ignore TYPE BHChannels-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Setup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Setup-ItemIEs} } + +SLDRBs-FailedToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeSetup-ItemIEs} } + +SLDRBs-Setup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Setup-Item CRITICALITY ignore TYPE SLDRBs-Setup-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeSetup-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeSetup-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeSetup-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SETUP FAILURE +-- +-- ************************************************************** + +UEContextSetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSetupFailureIEs} }, + ... +} + +UEContextSetupFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Potential-SpCell-List CRITICALITY ignore TYPE Potential-SpCell-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + +Potential-SpCell-List::= SEQUENCE (SIZE(0..maxnoofPotentialSpCells)) OF ProtocolIE-SingleContainer { { Potential-SpCell-ItemIEs} } + +Potential-SpCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Potential-SpCell-Item CRITICALITY ignore TYPE Potential-SpCell-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Context Release Request ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Release Request +-- +-- ************************************************************** + +UEContextReleaseRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEContextReleaseRequestIEs}}, + ... +} + +UEContextReleaseRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- UE Context Release (gNB-CU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMMAND +-- +-- ************************************************************** + +UEContextReleaseCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCommandIEs} }, + ... +} + +UEContextReleaseCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-SRBID CRITICALITY ignore TYPE SRBID PRESENCE conditional }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE COMPLETE +-- +-- ************************************************************** + +UEContextReleaseComplete ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextReleaseCompleteIEs} }, + ... +} + + +UEContextReleaseCompleteIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- UE Context Modification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUEST +-- +-- ************************************************************** + +UEContextModificationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequestIEs} }, + ... +} + +UEContextModificationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SpCell-ID CRITICALITY ignore TYPE NRCGI PRESENCE optional }| + { ID id-ServCellIndex CRITICALITY reject TYPE ServCellIndex PRESENCE optional }| + { ID id-SpCellULConfigured CRITICALITY ignore TYPE CellULConfigured PRESENCE optional }| + { ID id-DRXCycle CRITICALITY ignore TYPE DRXCycle PRESENCE optional }| + { ID id-CUtoDURRCInformation CRITICALITY reject TYPE CUtoDURRCInformation PRESENCE optional }| + { ID id-TransmissionActionIndicator CRITICALITY ignore TYPE TransmissionActionIndicator PRESENCE optional }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-RRCReconfigurationCompleteIndicator CRITICALITY ignore TYPE RRCReconfigurationCompleteIndicator PRESENCE optional }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE optional }| + { ID id-SCell-ToBeSetupMod-List CRITICALITY ignore TYPE SCell-ToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-ToBeRemoved-List CRITICALITY ignore TYPE SCell-ToBeRemoved-List PRESENCE optional }| + { ID id-SRBs-ToBeSetupMod-List CRITICALITY reject TYPE SRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeSetupMod-List CRITICALITY reject TYPE DRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-ToBeModified-List CRITICALITY reject TYPE DRBs-ToBeModified-List PRESENCE optional }| + { ID id-SRBs-ToBeReleased-List CRITICALITY reject TYPE SRBs-ToBeReleased-List PRESENCE optional }| + { ID id-DRBs-ToBeReleased-List CRITICALITY reject TYPE DRBs-ToBeReleased-List PRESENCE optional }| + { ID id-InactivityMonitoringRequest CRITICALITY reject TYPE InactivityMonitoringRequest PRESENCE optional }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-DRXConfigurationIndicator CRITICALITY ignore TYPE DRXConfigurationIndicator PRESENCE optional }| + { ID id-RLCFailureIndication CRITICALITY ignore TYPE RLCFailureIndication PRESENCE optional }| + { ID id-UplinkTxDirectCurrentListInformation CRITICALITY ignore TYPE UplinkTxDirectCurrentListInformation PRESENCE optional }| + { ID id-GNB-DUConfigurationQuery CRITICALITY reject TYPE GNB-DUConfigurationQuery PRESENCE optional }| + { ID id-GNB-DU-UE-AMBR-UL CRITICALITY ignore TYPE BitRate PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-ServingCellMO CRITICALITY ignore TYPE ServingCellMO PRESENCE optional }| + { ID id-NeedforGap CRITICALITY ignore TYPE NeedforGap PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }| + { ID id-LowerLayerPresenceStatusChange CRITICALITY ignore TYPE LowerLayerPresenceStatusChange PRESENCE optional }| + { ID id-BHChannels-ToBeSetupMod-List CRITICALITY reject TYPE BHChannels-ToBeSetupMod-List PRESENCE optional }| + { ID id-BHChannels-ToBeModified-List CRITICALITY reject TYPE BHChannels-ToBeModified-List PRESENCE optional }| + { ID id-BHChannels-ToBeReleased-List CRITICALITY reject TYPE BHChannels-ToBeReleased-List PRESENCE optional }| + { ID id-NRV2XServicesAuthorized CRITICALITY ignore TYPE NRV2XServicesAuthorized PRESENCE optional }| + { ID id-LTEV2XServicesAuthorized CRITICALITY ignore TYPE LTEV2XServicesAuthorized PRESENCE optional }| + { ID id-NRUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE NRUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-LTEUESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE LTEUESidelinkAggregateMaximumBitrate PRESENCE optional }| + { ID id-PC5LinkAMBR CRITICALITY ignore TYPE BitRate PRESENCE optional}| + { ID id-SLDRBs-ToBeSetupMod-List CRITICALITY reject TYPE SLDRBs-ToBeSetupMod-List PRESENCE optional }| + { ID id-SLDRBs-ToBeModified-List CRITICALITY reject TYPE SLDRBs-ToBeModified-List PRESENCE optional }| + { ID id-SLDRBs-ToBeReleased-List CRITICALITY reject TYPE SLDRBs-ToBeReleased-List PRESENCE optional }| + { ID id-ConditionalIntraDUMobilityInformation CRITICALITY reject TYPE ConditionalIntraDUMobilityInformation PRESENCE optional}, + ... +} + +SCell-ToBeSetupMod-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeSetupMod-ItemIEs} } +SCell-ToBeRemoved-List::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-ToBeRemoved-ItemIEs} } +SRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeSetupMod-ItemIEs} } +DRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeSetupMod-ItemIEs} } +BHChannels-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeSetupMod-ItemIEs} } + +DRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeModified-ItemIEs} } +BHChannels-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeModified-ItemIEs} } +SRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-ToBeReleased-ItemIEs} } +DRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ToBeReleased-ItemIEs} } +BHChannels-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-ToBeReleased-ItemIEs} } + +SCell-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeSetupMod-Item CRITICALITY ignore TYPE SCell-ToBeSetupMod-Item PRESENCE mandatory }, + ... +} + +SCell-ToBeRemoved-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-ToBeRemoved-Item CRITICALITY ignore TYPE SCell-ToBeRemoved-Item PRESENCE mandatory }, + ... +} + + +SRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeSetupMod-Item CRITICALITY reject TYPE DRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeModified-Item CRITICALITY reject TYPE DRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + + +SRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-ToBeReleased-Item CRITICALITY reject TYPE SRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +DRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ToBeReleased-Item CRITICALITY reject TYPE DRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeSetupMod-Item CRITICALITY reject TYPE BHChannels-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeModified-Item CRITICALITY reject TYPE BHChannels-ToBeModified-Item PRESENCE mandatory}, + ... +} + +BHChannels-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-ToBeReleased-Item CRITICALITY reject TYPE BHChannels-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeSetupMod-ItemIEs} } +SLDRBs-ToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeModified-ItemIEs} } +SLDRBs-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ToBeReleased-ItemIEs} } + +SLDRBs-ToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeSetupMod-Item CRITICALITY reject TYPE SLDRBs-ToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeModified-Item CRITICALITY reject TYPE SLDRBs-ToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ToBeReleased-Item CRITICALITY reject TYPE SLDRBs-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION RESPONSE +-- +-- ************************************************************** + +UEContextModificationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationResponseIEs} }, + ... +} + + +UEContextModificationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-SetupMod-List CRITICALITY ignore TYPE DRBs-SetupMod-List PRESENCE optional}| + { ID id-DRBs-Modified-List CRITICALITY ignore TYPE DRBs-Modified-List PRESENCE optional}| + { ID id-SRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SCell-FailedtoSetupMod-List CRITICALITY ignore TYPE SCell-FailedtoSetupMod-List PRESENCE optional }| + { ID id-DRBs-FailedToBeModified-List CRITICALITY ignore TYPE DRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-InactivityMonitoringResponse CRITICALITY reject TYPE InactivityMonitoringResponse PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-C-RNTI CRITICALITY ignore TYPE C-RNTI PRESENCE optional }| + { ID id-Associated-SCell-List CRITICALITY ignore TYPE Associated-SCell-List PRESENCE optional }| + { ID id-SRBs-SetupMod-List CRITICALITY ignore TYPE SRBs-SetupMod-List PRESENCE optional }| + { ID id-SRBs-Modified-List CRITICALITY ignore TYPE SRBs-Modified-List PRESENCE optional }| + { ID id-FullConfiguration CRITICALITY reject TYPE FullConfiguration PRESENCE optional }| + { ID id-BHChannels-SetupMod-List CRITICALITY ignore TYPE BHChannels-SetupMod-List PRESENCE optional}| + { ID id-BHChannels-Modified-List CRITICALITY ignore TYPE BHChannels-Modified-List PRESENCE optional}| + { ID id-BHChannels-FailedToBeSetupMod-List CRITICALITY ignore TYPE BHChannels-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-BHChannels-FailedToBeModified-List CRITICALITY ignore TYPE BHChannels-FailedToBeModified-List PRESENCE optional }| + { ID id-SLDRBs-SetupMod-List CRITICALITY ignore TYPE SLDRBs-SetupMod-List PRESENCE optional }| + { ID id-SLDRBs-Modified-List CRITICALITY ignore TYPE SLDRBs-Modified-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeSetupMod-List CRITICALITY ignore TYPE SLDRBs-FailedToBeSetupMod-List PRESENCE optional }| + { ID id-SLDRBs-FailedToBeModified-List CRITICALITY ignore TYPE SLDRBs-FailedToBeModified-List PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + + +DRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-SetupMod-ItemIEs} } +DRBs-Modified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Modified-ItemIEs } } +SRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-SetupMod-ItemIEs} } +SRBs-Modified-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Modified-ItemIEs } } +DRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeModified-ItemIEs} } +SRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-FailedToBeSetupMod-ItemIEs} } +DRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-FailedToBeSetupMod-ItemIEs} } +SCell-FailedtoSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSCells)) OF ProtocolIE-SingleContainer { { SCell-FailedtoSetupMod-ItemIEs} } +BHChannels-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-SetupMod-ItemIEs} } +BHChannels-Modified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Modified-ItemIEs } } +BHChannels-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeModified-ItemIEs} } +BHChannels-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-FailedToBeSetupMod-ItemIEs} } + +Associated-SCell-List ::= SEQUENCE (SIZE(1.. maxnoofSCells)) OF ProtocolIE-SingleContainer { { Associated-SCell-ItemIEs} } + +DRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-SetupMod-Item CRITICALITY ignore TYPE DRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Modified-Item CRITICALITY ignore TYPE DRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-SetupMod-Item CRITICALITY ignore TYPE SRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + + +SRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Modified-Item CRITICALITY ignore TYPE SRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE DRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + + +DRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-FailedToBeModified-Item CRITICALITY ignore TYPE DRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SCell-FailedtoSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SCell-FailedtoSetupMod-Item CRITICALITY ignore TYPE SCell-FailedtoSetupMod-Item PRESENCE mandatory}, + ... +} + +Associated-SCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Associated-SCell-Item CRITICALITY ignore TYPE Associated-SCell-Item PRESENCE mandatory}, + ... +} + +BHChannels-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-SetupMod-Item CRITICALITY ignore TYPE BHChannels-SetupMod-Item PRESENCE mandatory}, + ... +} + + +BHChannels-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Modified-Item CRITICALITY ignore TYPE BHChannels-Modified-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeSetupMod-Item CRITICALITY ignore TYPE BHChannels-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +BHChannels-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-FailedToBeModified-Item CRITICALITY ignore TYPE BHChannels-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-SetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-SetupMod-ItemIEs} } +SLDRBs-Modified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Modified-ItemIEs } } +SLDRBs-FailedToBeModified-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeModified-ItemIEs} } +SLDRBs-FailedToBeSetupMod-List ::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-FailedToBeSetupMod-ItemIEs} } + +SLDRBs-SetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-SetupMod-Item CRITICALITY ignore TYPE SLDRBs-SetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Modified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Modified-Item CRITICALITY ignore TYPE SLDRBs-Modified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeSetupMod-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeSetupMod-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeSetupMod-Item PRESENCE mandatory}, + ... +} + +SLDRBs-FailedToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-FailedToBeModified-Item CRITICALITY ignore TYPE SLDRBs-FailedToBeModified-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION FAILURE +-- +-- ************************************************************** + +UEContextModificationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationFailureIEs} }, + ... +} + +UEContextModificationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-requestedTargetCellGlobalID CRITICALITY reject TYPE NRCGI PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- UE Context Modification Required (gNB-DU initiated) ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REQUIRED +-- +-- ************************************************************** + +UEContextModificationRequired ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequiredIEs} }, + ... +} + +UEContextModificationRequiredIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DUtoCURRCInformation CRITICALITY reject TYPE DUtoCURRCInformation PRESENCE optional}| + { ID id-DRBs-Required-ToBeModified-List CRITICALITY reject TYPE DRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-DRBs-Required-ToBeReleased-List CRITICALITY reject TYPE DRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-BHChannels-Required-ToBeReleased-List CRITICALITY reject TYPE BHChannels-Required-ToBeReleased-List PRESENCE optional}| + { ID id-SLDRBs-Required-ToBeModified-List CRITICALITY reject TYPE SLDRBs-Required-ToBeModified-List PRESENCE optional}| + { ID id-SLDRBs-Required-ToBeReleased-List CRITICALITY reject TYPE SLDRBs-Required-ToBeReleased-List PRESENCE optional}| + { ID id-targetCellsToCancel CRITICALITY reject TYPE TargetCellList PRESENCE optional}, + ... +} + +DRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeModified-ItemIEs } } +DRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-Required-ToBeReleased-ItemIEs } } + +SRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSRBs)) OF ProtocolIE-SingleContainer { { SRBs-Required-ToBeReleased-ItemIEs } } + +BHChannels-Required-ToBeReleased-List ::= SEQUENCE (SIZE(1..maxnoofBHRLCChannels)) OF ProtocolIE-SingleContainer { { BHChannels-Required-ToBeReleased-ItemIEs } } + +DRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeModified-Item CRITICALITY reject TYPE DRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +DRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE DRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +BHChannels-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BHChannels-Required-ToBeReleased-Item CRITICALITY reject TYPE BHChannels-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Required-ToBeModified-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Required-ToBeModified-ItemIEs } } +SLDRBs-Required-ToBeReleased-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-Required-ToBeReleased-ItemIEs } } + +SLDRBs-Required-ToBeModified-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Required-ToBeModified-Item CRITICALITY reject TYPE SLDRBs-Required-ToBeModified-Item PRESENCE mandatory}, + ... +} + +SLDRBs-Required-ToBeReleased-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-Required-ToBeReleased-Item CRITICALITY reject TYPE SLDRBs-Required-ToBeReleased-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION CONFIRM +-- +-- ************************************************************** + +UEContextModificationConfirm::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationConfirmIEs} }, + ... +} + + +UEContextModificationConfirmIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-ResourceCoordinationTransferContainer CRITICALITY ignore TYPE ResourceCoordinationTransferContainer PRESENCE optional }| + { ID id-DRBs-ModifiedConf-List CRITICALITY ignore TYPE DRBs-ModifiedConf-List PRESENCE optional}| + { ID id-RRCContainer CRITICALITY ignore TYPE RRCContainer PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-ResourceCoordinationTransferInformation CRITICALITY ignore TYPE ResourceCoordinationTransferInformation PRESENCE optional }| + { ID id-SLDRBs-ModifiedConf-List CRITICALITY ignore TYPE SLDRBs-ModifiedConf-List PRESENCE optional}, + ... +} + +DRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRBs-ModifiedConf-ItemIEs } } + +DRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRBs-ModifiedConf-Item CRITICALITY ignore TYPE DRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + +SLDRBs-ModifiedConf-List::= SEQUENCE (SIZE(1..maxnoofSLDRBs)) OF ProtocolIE-SingleContainer { { SLDRBs-ModifiedConf-ItemIEs } } + +SLDRBs-ModifiedConf-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-SLDRBs-ModifiedConf-Item CRITICALITY ignore TYPE SLDRBs-ModifiedConf-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION REFUSE +-- +-- ************************************************************** + +UEContextModificationRefuse::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRefuseIEs} }, + ... +} + + +UEContextModificationRefuseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- WRITE-REPLACE WARNING ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Write-Replace Warning Request +-- +-- ************************************************************** + +WriteReplaceWarningRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningRequestIEs} }, + ... +} + +WriteReplaceWarningRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PWSSystemInformation CRITICALITY reject TYPE PWSSystemInformation PRESENCE mandatory }| + { ID id-RepetitionPeriod CRITICALITY reject TYPE RepetitionPeriod PRESENCE mandatory }| + { ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| + { ID id-Cells-To-Be-Broadcast-List CRITICALITY reject TYPE Cells-To-Be-Broadcast-List PRESENCE optional }, + ... +} + +Cells-To-Be-Broadcast-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-To-Be-Broadcast-List-ItemIEs } } + +Cells-To-Be-Broadcast-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-To-Be-Broadcast-Item CRITICALITY reject TYPE Cells-To-Be-Broadcast-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- Write-Replace Warning Response +-- +-- ************************************************************** + +WriteReplaceWarningResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningResponseIEs} }, + ... +} + +WriteReplaceWarningResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Broadcast-Completed-List CRITICALITY reject TYPE Cells-Broadcast-Completed-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-Dedicated-SIDelivery-NeededUE-List CRITICALITY ignore TYPE Dedicated-SIDelivery-NeededUE-List PRESENCE optional }, + ... +} + +Cells-Broadcast-Completed-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Completed-List-ItemIEs } } + +Cells-Broadcast-Completed-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Completed-Item CRITICALITY reject TYPE Cells-Broadcast-Completed-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- PWS CANCEL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Cancel Request +-- +-- ************************************************************** + +PWSCancelRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {PWSCancelRequestIEs} }, + ... +} + +PWSCancelRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| + { ID id-Broadcast-To-Be-Cancelled-List CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-List PRESENCE optional }| + { ID id-Cancel-all-Warning-Messages-Indicator CRITICALITY reject TYPE Cancel-all-Warning-Messages-Indicator PRESENCE optional }| + { ID id-NotificationInformation CRITICALITY reject TYPE NotificationInformation PRESENCE optional}, + ... +} + +Broadcast-To-Be-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Broadcast-To-Be-Cancelled-List-ItemIEs } } + +Broadcast-To-Be-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Broadcast-To-Be-Cancelled-Item CRITICALITY reject TYPE Broadcast-To-Be-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS Cancel Response +-- +-- ************************************************************** + +PWSCancelResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {PWSCancelResponseIEs} }, + ... +} + +PWSCancelResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cells-Broadcast-Cancelled-List CRITICALITY reject TYPE Cells-Broadcast-Cancelled-List PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +Cells-Broadcast-Cancelled-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { Cells-Broadcast-Cancelled-List-ItemIEs } } + +Cells-Broadcast-Cancelled-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-Cells-Broadcast-Cancelled-Item CRITICALITY reject TYPE Cells-Broadcast-Cancelled-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Inactivity Notification ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Inactivity Notification +-- +-- ************************************************************** + +UEInactivityNotification ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ UEInactivityNotificationIEs}}, + ... +} + +UEInactivityNotificationIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Activity-List CRITICALITY reject TYPE DRB-Activity-List PRESENCE mandatory } , + ... +} + +DRB-Activity-List::= SEQUENCE (SIZE(1..maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRB-Activity-ItemIEs } } + +DRB-Activity-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Activity-Item CRITICALITY reject TYPE DRB-Activity-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- Initial UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- INITIAL UL RRC Message Transfer +-- +-- ************************************************************** + +InitialULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ InitialULRRCMessageTransferIEs}}, + ... +} + +InitialULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-C-RNTI CRITICALITY reject TYPE C-RNTI PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-DUtoCURRCContainer CRITICALITY reject TYPE DUtoCURRCContainer PRESENCE optional }| + { ID id-SULAccessIndication CRITICALITY ignore TYPE SULAccessIndication PRESENCE optional }| + { ID id-TransactionID CRITICALITY ignore TYPE TransactionID PRESENCE mandatory }| + { ID id-RANUEID CRITICALITY ignore TYPE RANUEID PRESENCE optional }| + { ID id-RRCContainer-RRCSetupComplete CRITICALITY ignore TYPE RRCContainer-RRCSetupComplete PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- DL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DL RRC Message Transfer +-- +-- ************************************************************** + +DLRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DLRRCMessageTransferIEs}}, + ... +} + +DLRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-oldgNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-ExecuteDuplication CRITICALITY ignore TYPE ExecuteDuplication PRESENCE optional}| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-RAT-FrequencyPriorityInformation CRITICALITY reject TYPE RAT-FrequencyPriorityInformation PRESENCE optional }| + { ID id-RRCDeliveryStatusRequest CRITICALITY ignore TYPE RRCDeliveryStatusRequest PRESENCE optional }| + { ID id-UEContextNotRetrievable CRITICALITY reject TYPE UEContextNotRetrievable PRESENCE optional }| + { ID id-RedirectedRRCmessage CRITICALITY reject TYPE OCTET STRING PRESENCE optional }| + { ID id-PLMNAssistanceInfoForNetShar CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional }| + { ID id-new-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE optional }| + { ID id-AdditionalRRMPriorityIndex CRITICALITY ignore TYPE AdditionalRRMPriorityIndex PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- UL RRC Message Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UL RRC Message Transfer +-- +-- ************************************************************** + +ULRRCMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ULRRCMessageTransferIEs}}, + ... +} + +ULRRCMessageTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRBID CRITICALITY reject TYPE SRBID PRESENCE mandatory }| + { ID id-RRCContainer CRITICALITY reject TYPE RRCContainer PRESENCE mandatory }| + { ID id-SelectedPLMNID CRITICALITY reject TYPE PLMN-Identity PRESENCE optional }| + { ID id-new-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- PRIVATE MESSAGE +-- +-- ************************************************************** + +PrivateMessage ::= SEQUENCE { + privateIEs PrivateIE-Container {{PrivateMessage-IEs}}, + ... +} + +PrivateMessage-IEs F1AP-PRIVATE-IES ::= { + ... +} + + +-- ************************************************************** +-- +-- System Information ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- System information Delivery Command +-- +-- ************************************************************** + +SystemInformationDeliveryCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ SystemInformationDeliveryCommandIEs}}, + ... +} + +SystemInformationDeliveryCommandIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }| + { ID id-SItype-List CRITICALITY reject TYPE SItype-List PRESENCE mandatory }| + { ID id-ConfirmedUEID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- Paging PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Paging +-- +-- ************************************************************** + +Paging ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PagingIEs}}, + ... +} + +PagingIEs F1AP-PROTOCOL-IES ::= { + { ID id-UEIdentityIndexValue CRITICALITY reject TYPE UEIdentityIndexValue PRESENCE mandatory }| + { ID id-PagingIdentity CRITICALITY reject TYPE PagingIdentity PRESENCE mandatory }| + { ID id-PagingDRX CRITICALITY ignore TYPE PagingDRX PRESENCE optional }| + { ID id-PagingPriority CRITICALITY ignore TYPE PagingPriority PRESENCE optional }| + { ID id-PagingCell-List CRITICALITY ignore TYPE PagingCell-list PRESENCE mandatory }| + { ID id-PagingOrigin CRITICALITY ignore TYPE PagingOrigin PRESENCE optional }, + ... +} + +PagingCell-list::= SEQUENCE (SIZE(1.. maxnoofPagingCells)) OF ProtocolIE-SingleContainer { { PagingCell-ItemIEs } } + +PagingCell-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PagingCell-Item CRITICALITY ignore TYPE PagingCell-Item PRESENCE mandatory} , + ... +} + + + +-- ************************************************************** +-- +-- Notify +-- +-- ************************************************************** + +Notify ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ NotifyIEs}}, + ... +} + +NotifyIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-DRB-Notify-List CRITICALITY reject TYPE DRB-Notify-List PRESENCE mandatory }, + ... +} + +DRB-Notify-List::= SEQUENCE (SIZE(1.. maxnoofDRBs)) OF ProtocolIE-SingleContainer { { DRB-Notify-ItemIEs } } + +DRB-Notify-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DRB-Notify-Item CRITICALITY reject TYPE DRB-Notify-Item PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- NETWORK ACCESS RATE REDUCTION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Network Access Rate Reduction +-- +-- ************************************************************** + +NetworkAccessRateReduction ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ NetworkAccessRateReductionIEs }}, + ... +} + +NetworkAccessRateReductionIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UAC-Assistance-Info CRITICALITY reject TYPE UAC-Assistance-Info PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS RESTART INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Restart Indication +-- +-- ************************************************************** + +PWSRestartIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PWSRestartIndicationIEs} }, + ... +} + +PWSRestartIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-NR-CGI-List-For-Restart-List CRITICALITY reject TYPE NR-CGI-List-For-Restart-List PRESENCE mandatory }, + ... +} + +NR-CGI-List-For-Restart-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { NR-CGI-List-For-Restart-List-ItemIEs } } + +NR-CGI-List-For-Restart-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-NR-CGI-List-For-Restart-Item CRITICALITY reject TYPE NR-CGI-List-For-Restart-Item PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- PWS FAILURE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Failure Indication +-- +-- ************************************************************** + +PWSFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PWSFailureIndicationIEs} }, + ... +} + +PWSFailureIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PWS-Failed-NR-CGI-List CRITICALITY reject TYPE PWS-Failed-NR-CGI-List PRESENCE optional }, + ... +} + +PWS-Failed-NR-CGI-List ::= SEQUENCE (SIZE(1.. maxCellingNBDU)) OF ProtocolIE-SingleContainer { { PWS-Failed-NR-CGI-List-ItemIEs } } + +PWS-Failed-NR-CGI-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-PWS-Failed-NR-CGI-Item CRITICALITY reject TYPE PWS-Failed-NR-CGI-Item PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- gNB-DU STATUS INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- gNB-DU Status Indication +-- +-- ************************************************************** + +GNBDUStatusIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {GNBDUStatusIndicationIEs} }, + ... +} + +GNBDUStatusIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-GNBDUOverloadInformation CRITICALITY reject TYPE GNBDUOverloadInformation PRESENCE mandatory }, + ... +} + + + +-- ************************************************************** +-- +-- RRC Delivery Report ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- RRC Delivery Report +-- +-- ************************************************************** + +RRCDeliveryReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ RRCDeliveryReportIEs}}, + ... +} + +RRCDeliveryReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-RRCDeliveryStatus CRITICALITY ignore TYPE RRCDeliveryStatus PRESENCE mandatory }| + { ID id-SRBID CRITICALITY ignore TYPE SRBID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- F1 Removal ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- F1 Removal Request +-- +-- ************************************************************** + +F1RemovalRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalRequestIEs }}, + ... +} + +F1RemovalRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- F1 Removal Response +-- +-- ************************************************************** + +F1RemovalResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalResponseIEs }}, + ... +} + +F1RemovalResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + + ... +} + +-- ************************************************************** +-- +-- F1 Removal Failure +-- +-- ************************************************************** + +F1RemovalFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ F1RemovalFailureIEs }}, + ... +} + +F1RemovalFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + + ... +} + + +-- ************************************************************** +-- +-- TRACE ELEMENTARY PROCEDURES +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- TRACE START +-- +-- ************************************************************** + +TraceStart ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {TraceStartIEs} }, + ... +} + +TraceStartIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- DEACTIVATE TRACE +-- +-- ************************************************************** + +DeactivateTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {DeactivateTraceIEs} }, + ... +} + +DeactivateTraceIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-TraceID CRITICALITY ignore TYPE TraceID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- CELL TRAFFIC TRACE +-- +-- ************************************************************** + +CellTrafficTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {CellTrafficTraceIEs} }, + ... +} + +CellTrafficTraceIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + {ID id-TraceID CRITICALITY ignore TYPE TraceID PRESENCE mandatory }| + {ID id-TraceCollectionEntityIPAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE mandatory }| + {ID id-PrivacyIndicator CRITICALITY ignore TYPE PrivacyIndicator PRESENCE optional }| + + {ID id-TraceCollectionEntityURI CRITICALITY ignore TYPE URI-address PRESENCE optional }, + ... + +} + +-- ************************************************************** +-- +-- DU-CU Radio Information Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DU-CU Radio Information Transfer +-- +-- ************************************************************** + +DUCURadioInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ DUCURadioInformationTransferIEs}}, + ... +} + +DUCURadioInformationTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-DUCURadioInformationType CRITICALITY ignore TYPE DUCURadioInformationType PRESENCE mandatory }, + ... +} + + + +-- ************************************************************** +-- +-- CU-DU Radio Information Transfer ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- CU-DU Radio Information Transfer +-- +-- ************************************************************** + +CUDURadioInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ CUDURadioInformationTransferIEs}}, + ... +} + +CUDURadioInformationTransferIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CUDURadioInformationType CRITICALITY ignore TYPE CUDURadioInformationType PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- IAB PROCEDURES +-- +-- ************************************************************** +-- ************************************************************** +-- +-- BAP Mapping Configuration ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- BAP MAPPING CONFIGURATION +-- ************************************************************** + + +BAPMappingConfiguration ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {BAPMappingConfiguration-IEs} }, + ... + } + +BAPMappingConfiguration-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-BH-Routing-Information-Added-List CRITICALITY ignore TYPE BH-Routing-Information-Added-List PRESENCE optional}| + { ID id-BH-Routing-Information-Removed-List CRITICALITY ignore TYPE BH-Routing-Information-Removed-List PRESENCE optional}| + { ID id-TrafficMappingInformation CRITICALITY ignore TYPE TrafficMappingInfo PRESENCE optional}, + ... +} + +BH-Routing-Information-Added-List ::= SEQUENCE (SIZE(1.. maxnoofRoutingEntries)) OF ProtocolIE-SingleContainer { { BH-Routing-Information-Added-List-ItemIEs } } +BH-Routing-Information-Removed-List ::= SEQUENCE (SIZE(1.. maxnoofRoutingEntries)) OF ProtocolIE-SingleContainer { { BH-Routing-Information-Removed-List-ItemIEs } } + +BH-Routing-Information-Added-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BH-Routing-Information-Added-List-Item CRITICALITY ignore TYPE BH-Routing-Information-Added-List-Item PRESENCE optional}, + ... +} + +BH-Routing-Information-Removed-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-BH-Routing-Information-Removed-List-Item CRITICALITY ignore TYPE BH-Routing-Information-Removed-List-Item PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- BAP MAPPING CONFIGURATION ACKNOWLEDGE +-- ************************************************************** + +BAPMappingConfigurationAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {BAPMappingConfigurationAcknowledge-IEs} }, + ... +} + +BAPMappingConfigurationAcknowledge-IEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + + + +-- ************************************************************** +-- +-- GNB-DU Configuration ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- GNB-DU RESOURCE CONFIGURATION +-- ************************************************************** + + +GNBDUResourceConfiguration ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ GNBDUResourceConfigurationIEs}}, + ... +} + + +GNBDUResourceConfigurationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Activated-Cells-to-be-Updated-List CRITICALITY reject TYPE Activated-Cells-to-be-Updated-List PRESENCE optional}| + { ID id-Child-Nodes-List CRITICALITY reject TYPE Child-Nodes-List PRESENCE optional}, + ... +} + + + + +-- ************************************************************** +-- +-- GNB-DU RESOURCE CONFIGURATION ACKNOWLEDGE +-- ************************************************************** + + +GNBDUResourceConfigurationAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { GNBDUResourceConfigurationAcknowledgeIEs} }, + ... +} + + +GNBDUResourceConfigurationAcknowledgeIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- IAB TNL Address Allocation ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- IAB TNL ADDRESS REQUEST +-- ************************************************************** + + + +IABTNLAddressRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {IABTNLAddressRequestIEs} }, + ... +} + +IABTNLAddressRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-IABv4AddressesRequested CRITICALITY reject TYPE IABv4AddressesRequested PRESENCE optional }| + { ID id-IABIPv6RequestType CRITICALITY reject TYPE IABIPv6RequestType PRESENCE optional }| + { ID id-IAB-TNL-Addresses-To-Remove-List CRITICALITY reject TYPE IAB-TNL-Addresses-To-Remove-List PRESENCE optional }, + ... +} + + +IAB-TNL-Addresses-To-Remove-List ::= SEQUENCE (SIZE(1..maxnoofTLAsIAB)) OF ProtocolIE-SingleContainer { { IAB-TNL-Addresses-To-Remove-ItemIEs } } + +IAB-TNL-Addresses-To-Remove-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-IAB-TNL-Addresses-To-Remove-Item CRITICALITY reject TYPE IAB-TNL-Addresses-To-Remove-Item PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- IAB TNL ADDRESS RESPONSE +-- ************************************************************** + + +IABTNLAddressResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {IABTNLAddressResponseIEs} }, + ... +} + + +IABTNLAddressResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-IAB-Allocated-TNL-Address-List CRITICALITY reject TYPE IAB-Allocated-TNL-Address-List PRESENCE mandatory }, + ... +} + + +IAB-Allocated-TNL-Address-List ::= SEQUENCE (SIZE(1.. maxnoofTLAsIAB)) OF ProtocolIE-SingleContainer { { IAB-Allocated-TNL-Address-List-ItemIEs } } + + +IAB-Allocated-TNL-Address-List-ItemIEs F1AP-PROTOCOL-IES::= { + { ID id-IAB-Allocated-TNL-Address-Item CRITICALITY reject TYPE IAB-Allocated-TNL-Address-Item PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- IAB UP Configuration Update ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- IAB UP Configuration Update Request +-- +-- ************************************************************** + +IABUPConfigurationUpdateRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateRequestIEs} }, + ... +} + +IABUPConfigurationUpdateRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-UL-UP-TNL-Information-to-Update-List CRITICALITY ignore TYPE UL-UP-TNL-Information-to-Update-List PRESENCE optional }| + { ID id-UL-UP-TNL-Address-to-Update-List CRITICALITY ignore TYPE UL-UP-TNL-Address-to-Update-List PRESENCE optional }, + ... +} + +UL-UP-TNL-Information-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofULUPTNLInformationforIAB)) OF ProtocolIE-SingleContainer { { UL-UP-TNL-Information-to-Update-List-ItemIEs } } + +UL-UP-TNL-Information-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-UL-UP-TNL-Information-to-Update-List-Item CRITICALITY ignore TYPE UL-UP-TNL-Information-to-Update-List-Item PRESENCE optional}, + ... +} + +UL-UP-TNL-Address-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofUPTNLAddresses)) OF ProtocolIE-SingleContainer { { UL-UP-TNL-Address-to-Update-List-ItemIEs } } + +UL-UP-TNL-Address-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-UL-UP-TNL-Address-to-Update-List-Item CRITICALITY ignore TYPE UL-UP-TNL-Address-to-Update-List-Item PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- IAB UP Configuration Update Response +-- +-- ************************************************************** + +IABUPConfigurationUpdateResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateResponseIEs} }, + ... +} + +IABUPConfigurationUpdateResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| + { ID id-DL-UP-TNL-Address-to-Update-List CRITICALITY reject TYPE DL-UP-TNL-Address-to-Update-List PRESENCE optional }, + ... +} + +DL-UP-TNL-Address-to-Update-List ::= SEQUENCE (SIZE(1.. maxnoofUPTNLAddresses)) OF ProtocolIE-SingleContainer { { DL-UP-TNL-Address-to-Update-List-ItemIEs } } + +DL-UP-TNL-Address-to-Update-List-ItemIEs F1AP-PROTOCOL-IES ::= { + { ID id-DL-UP-TNL-Address-to-Update-List-Item CRITICALITY ignore TYPE DL-UP-TNL-Address-to-Update-List-Item PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- IAB UP Configuration Update Failure +-- +-- ************************************************************** + +IABUPConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { IABUPConfigurationUpdateFailureIEs} }, + ... +} + +IABUPConfigurationUpdateFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Resource Status Reporting Initiation ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Resource Status Request +-- +-- ************************************************************** + +ResourceStatusRequest::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResourceStatusRequestIEs} }, + ... +} + +ResourceStatusRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE conditional }| + { ID id-RegistrationRequest CRITICALITY ignore TYPE RegistrationRequest PRESENCE mandatory }| + { ID id-ReportCharacteristics CRITICALITY ignore TYPE ReportCharacteristics PRESENCE conditional }| + { ID id-CellToReportList CRITICALITY ignore TYPE CellToReportList PRESENCE optional }| + { ID id-ReportingPeriodicity CRITICALITY ignore TYPE ReportingPeriodicity PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Resource Status Response +-- +-- ************************************************************** + +ResourceStatusResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ResourceStatusResponseIEs} }, + ... +} + + +ResourceStatusResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Resource Status Failure +-- +-- ************************************************************** + +ResourceStatusFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ResourceStatusFailureIEs} }, + ... +} + +ResourceStatusFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Resource Status Reporting ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Resource Status Update +-- +-- ************************************************************** + +ResourceStatusUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ResourceStatusUpdateIEs}}, + ... +} + +ResourceStatusUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-gNBCUMeasurementID CRITICALITY reject TYPE GNBCUMeasurementID PRESENCE mandatory }| + { ID id-gNBDUMeasurementID CRITICALITY ignore TYPE GNBDUMeasurementID PRESENCE mandatory }| + { ID id-HardwareLoadIndicator CRITICALITY ignore TYPE HardwareLoadIndicator PRESENCE optional }| + { ID id-TNLCapacityIndicator CRITICALITY ignore TYPE TNLCapacityIndicator PRESENCE optional }| + { ID id-CellMeasurementResultList CRITICALITY ignore TYPE CellMeasurementResultList PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Access And Mobility Indication ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Access And Mobility Indication +-- +-- ************************************************************** + +AccessAndMobilityIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { AccessAndMobilityIndicationIEs} }, + ... +} + +AccessAndMobilityIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-RACHReportInformationList CRITICALITY ignore TYPE RACHReportInformationList PRESENCE optional }| + { ID id-RLFReportInformationList CRITICALITY ignore TYPE RLFReportInformationList PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- REFERENCE TIME INFORMATION REPORTING CONTROL +-- +-- ************************************************************** + +ReferenceTimeInformationReportingControl::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ReferenceTimeInformationReportingControlIEs} }, + ... +} + +ReferenceTimeInformationReportingControlIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-ReportingRequestType CRITICALITY reject TYPE ReportingRequestType PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- REFERENCE TIME INFORMATION REPORT +-- +-- ************************************************************** + +ReferenceTimeInformationReport::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ReferenceTimeInformationReportIEs} }, + ... +} + +ReferenceTimeInformationReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY ignore TYPE TransactionID PRESENCE mandatory }| + { ID id-TimeReferenceInformation CRITICALITY ignore TYPE TimeReferenceInformation PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- Access Success +-- +-- ************************************************************** + +AccessSuccess ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ AccessSuccessIEs}}, + ... +} + +AccessSuccessIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-NRCGI CRITICALITY reject TYPE NRCGI PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING ASSISTANCE INFORMATION CONTROL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Assistance Information Control +-- +-- ************************************************************** + +PositioningAssistanceInformationControl ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PositioningAssistanceInformationControlIEs}}, + ... +} + +PositioningAssistanceInformationControlIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PosAssistance-Information CRITICALITY reject TYPE PosAssistance-Information PRESENCE optional}| + { ID id-PosBroadcast CRITICALITY reject TYPE PosBroadcast PRESENCE optional}| + { ID id-PositioningBroadcastCells CRITICALITY reject TYPE PositioningBroadcastCells PRESENCE optional}| + { ID id-RoutingID CRITICALITY reject TYPE RoutingID PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- POSITIONING ASSISTANCE INFORMATION FEEDBACK ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Assistance Information Feedback +-- +-- ************************************************************** + +PositioningAssistanceInformationFeedback ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PositioningAssistanceInformationFeedbackIEs}}, + ... +} + +PositioningAssistanceInformationFeedbackIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-PosAssistanceInformationFailureList CRITICALITY reject TYPE PosAssistanceInformationFailureList PRESENCE optional}| + { ID id-PositioningBroadcastCells CRITICALITY reject TYPE PositioningBroadcastCells PRESENCE optional}| + { ID id-RoutingID CRITICALITY reject TYPE RoutingID PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- POSITONING MEASUREMENT EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Request +-- +-- ************************************************************** + +PositioningMeasurementRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementRequestIEs} }, + ... +} + +PositioningMeasurementRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory}| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory}| + { ID id-TRP-MeasurementRequestList CRITICALITY reject TYPE TRP-MeasurementRequestList PRESENCE mandatory}| + { ID id-PosReportCharacteristics CRITICALITY reject TYPE PosReportCharacteristics PRESENCE mandatory}| + { ID id-PosMeasurementPeriodicity CRITICALITY reject TYPE PosMeasurementPeriodicity PRESENCE conditional }| + -- The above IE shall be present if the PosReportCharacteristics IE is set to “periodic” -- + { ID id-PosMeasurementQuantities CRITICALITY reject TYPE PosMeasurementQuantities PRESENCE mandatory}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-MeasurementBeamInfoRequest CRITICALITY ignore TYPE MeasurementBeamInfoRequest PRESENCE optional }| + { ID id-SystemFrameNumber CRITICALITY ignore TYPE SystemFrameNumber PRESENCE optional}| + { ID id-SlotNumber CRITICALITY ignore TYPE SlotNumber PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Positioning Measurement Response +-- +-- ************************************************************** + +PositioningMeasurementResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementResponseIEs} }, + ... +} + + +PositioningMeasurementResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory}| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory}| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory}| + { ID id-PosMeasurementResultList CRITICALITY reject TYPE PosMeasurementResultList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Positioning Measurement Failure +-- +-- ************************************************************** + +PositioningMeasurementFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementFailureIEs} }, + ... +} + +PositioningMeasurementFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT REPORT ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Report +-- +-- ************************************************************** + +PositioningMeasurementReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementReportIEs} }, + ... +} + +PositioningMeasurementReportIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-PosMeasurementResultList CRITICALITY reject TYPE PosMeasurementResultList PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT ABORT ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Abort +-- +-- ************************************************************** + +PositioningMeasurementAbort ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementAbortIEs} }, + ... +} + +PositioningMeasurementAbortIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT FAILURE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Failure Indication +-- +-- ************************************************************** + +PositioningMeasurementFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementFailureIndicationIEs} }, + ... +} + +PositioningMeasurementFailureIndicationIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING MEASUREMENT UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Measurement Update +-- +-- ************************************************************** + +PositioningMeasurementUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningMeasurementUpdateIEs} }, + ... +} + +PositioningMeasurementUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-LMF-MeasurementID CRITICALITY reject TYPE LMF-MeasurementID PRESENCE mandatory }| + { ID id-RAN-MeasurementID CRITICALITY reject TYPE RAN-MeasurementID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- TRP INFORMATION EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- TRP Information Request +-- +-- ************************************************************** + +TRPInformationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationRequestIEs} }, + ... +} + +TRPInformationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-TRPList CRITICALITY ignore TYPE TRPList PRESENCE optional }| + { ID id-TRPInformationTypeListTRPReq CRITICALITY reject TYPE TRPInformationTypeListTRPReq PRESENCE mandatory }, + ... +} + +TRPInformationTypeListTRPReq ::= SEQUENCE (SIZE(1.. maxnoofTRPInfoTypes)) OF ProtocolIE-SingleContainer { { TRPInformationTypeItemTRPReq } } + +TRPInformationTypeItemTRPReq F1AP-PROTOCOL-IES ::= { + { ID id-TRPInformationTypeItem CRITICALITY reject TYPE TRPInformationTypeItem PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- TRP Information Response +-- +-- ************************************************************** + +TRPInformationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationResponseIEs} }, + ... +} + +TRPInformationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-TRPInformationListTRPResp CRITICALITY ignore TYPE TRPInformationListTRPResp PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +TRPInformationListTRPResp ::= SEQUENCE (SIZE(1.. maxnoofTRPs)) OF ProtocolIE-SingleContainer { { TRPInformationItemTRPResp } } + +TRPInformationItemTRPResp F1AP-PROTOCOL-IES ::= { + { ID id-TRPInformationItem CRITICALITY ignore TYPE TRPInformationItem PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- TRP Information Failure +-- +-- ************************************************************** + +TRPInformationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { TRPInformationFailureIEs} }, + ... +} + +TRPInformationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-TransactionID CRITICALITY reject TYPE TransactionID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING INFORMATION EXCHANGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Information Request +-- +-- ************************************************************** + +PositioningInformationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationRequestIEs} }, + ... +} + +PositioningInformationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-RequestedSRSTransmissionCharacteristics CRITICALITY ignore TYPE RequestedSRSTransmissionCharacteristics PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Positioning Information Response +-- +-- ************************************************************** + +PositioningInformationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationResponseIEs} }, + ... +} + + +PositioningInformationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- Positioning Information Failure +-- +-- ************************************************************** + +PositioningInformationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationFailureIEs} }, + ... +} + +PositioningInformationFailureIEs F1AP-PROTOCOL-IES ::= { + + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING ACTIVATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Activation Request +-- +-- ************************************************************** + +PositioningActivationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationRequestIEs} }, + ... +} + +PositioningActivationRequestIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSType CRITICALITY reject TYPE SRSType PRESENCE mandatory }| + { ID id-ActivationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional }, + ... +} + +SRSType ::= CHOICE { + semipersistentSRS SemipersistentSRS, + aperiodicSRS AperiodicSRS, + choice-extension ProtocolIE-SingleContainer { { SRSType-ExtIEs} } +} + +SRSType-ExtIEs F1AP-PROTOCOL-IES ::= { + ... +} + +SemipersistentSRS ::= SEQUENCE { + sRSResourceSetID SRSResourceSetID, + sRSSpatialRelation SRSSpatialRelation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {SemipersistentSRS-ExtIEs} } OPTIONAL, + ... +} + +SemipersistentSRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AperiodicSRS ::= SEQUENCE { + aperiodic ENUMERATED {true, ...}, + sRSResourceTrigger SRSResourceTrigger OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {AperiodicSRS-ExtIEs} } OPTIONAL, + ... +} + +AperiodicSRS-ExtIEs F1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- ************************************************************** +-- +-- Positioning Activation Response +-- +-- ************************************************************** + +PositioningActivationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationResponseIEs} }, + ... +} + + +PositioningActivationResponseIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SystemFrameNumber CRITICALITY ignore TYPE SystemFrameNumber PRESENCE optional }| + { ID id-SlotNumber CRITICALITY ignore TYPE SlotNumber PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + + + +-- ************************************************************** +-- +-- Positioning Activation Failure +-- +-- ************************************************************** + +PositioningActivationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningActivationFailureIEs} }, + ... +} + +PositioningActivationFailureIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- POSITIONING DEACTIVATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Deactivation +-- +-- ************************************************************** + +PositioningDeactivation ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningDeactivationIEs} }, + ... +} + +PositioningDeactivationIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-AbortTransmission CRITICALITY ignore TYPE AbortTransmission PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- POSITIONING INFORMATION UPDATE PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Positioning Information Update +-- +-- ************************************************************** + +PositioningInformationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PositioningInformationUpdateIEs} }, + ... +} + + +PositioningInformationUpdateIEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-SRSConfiguration CRITICALITY ignore TYPE SRSConfiguration PRESENCE optional}| + { ID id-SFNInitialisationTime CRITICALITY ignore TYPE SFNInitialisationTime PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Request +-- +-- ************************************************************** + +E-CIDMeasurementInitiationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationRequest-IEs}}, + ... +} + +E-CIDMeasurementInitiationRequest-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY reject TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY reject TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-ReportCharacteristics CRITICALITY reject TYPE E-CID-ReportCharacteristics PRESENCE mandatory }| + { ID id-E-CID-MeasurementPeriodicity CRITICALITY reject TYPE E-CID-MeasurementPeriodicity PRESENCE conditional }| +-- The above IE shall be present if the E-CID-ReportCharacteristics IE is set to “periodic” –- + { ID id-E-CID-MeasurementQuantities CRITICALITY reject TYPE E-CID-MeasurementQuantities PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Response +-- +-- ************************************************************** + +E-CIDMeasurementInitiationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationResponse-IEs}}, + ... +} + +E-CIDMeasurementInitiationResponse-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-MeasurementResult CRITICALITY ignore TYPE E-CID-MeasurementResult PRESENCE optional}| + { ID id-Cell-Portion-ID CRITICALITY ignore TYPE Cell-Portion-ID PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID Measurement Initiation Failure +-- +-- ************************************************************** + +E-CIDMeasurementInitiationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementInitiationFailure-IEs}}, + ... +} + + +E-CIDMeasurementInitiationFailure-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT FAILURE INDICATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Failure Indication +-- +-- ************************************************************** + +E-CIDMeasurementFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementFailureIndication-IEs}}, + ... +} + + +E-CIDMeasurementFailureIndication-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT REPORT PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Report +-- +-- ************************************************************** + +E-CIDMeasurementReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementReport-IEs}}, + ... +} + + +E-CIDMeasurementReport-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }| + { ID id-E-CID-MeasurementResult CRITICALITY ignore TYPE E-CID-MeasurementResult PRESENCE mandatory }| + { ID id-Cell-Portion-ID CRITICALITY ignore TYPE Cell-Portion-ID PRESENCE optional}, + + ... +} + +-- ************************************************************** +-- +-- E-CID MEASUREMENT TERMINATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-CID Measurement Termination Command +-- +-- ************************************************************** + + +E-CIDMeasurementTerminationCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{E-CIDMeasurementTerminationCommand-IEs}}, + ... +} + + +E-CIDMeasurementTerminationCommand-IEs F1AP-PROTOCOL-IES ::= { + { ID id-gNB-CU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-CU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-gNB-DU-UE-F1AP-ID CRITICALITY ignore TYPE GNB-DU-UE-F1AP-ID PRESENCE mandatory }| + { ID id-LMF-UE-MeasurementID CRITICALITY reject TYPE LMF-UE-MeasurementID PRESENCE mandatory }| + { ID id-RAN-UE-MeasurementID CRITICALITY reject TYPE RAN-UE-MeasurementID PRESENCE mandatory }, + ... +} + + + +END diff --git a/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Descriptions.asn b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Descriptions.asn new file mode 100644 index 0000000000..6ec795ab10 --- /dev/null +++ b/openair2/F1AP/MESSAGES/ASN1/R16.3.1/F1AP-PDU-Descriptions.asn @@ -0,0 +1,723 @@ +-- ************************************************************** +-- +-- Elementary Procedure definitions +-- +-- ************************************************************** + +F1AP-PDU-Descriptions { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +ngran-access (22) modules (3) f1ap (3) version1 (1) f1ap-PDU-Descriptions (0)} + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + ProcedureCode + +FROM F1AP-CommonDataTypes + Reset, + ResetAcknowledge, + F1SetupRequest, + F1SetupResponse, + F1SetupFailure, + GNBDUConfigurationUpdate, + GNBDUConfigurationUpdateAcknowledge, + GNBDUConfigurationUpdateFailure, + GNBCUConfigurationUpdate, + GNBCUConfigurationUpdateAcknowledge, + GNBCUConfigurationUpdateFailure, + UEContextSetupRequest, + UEContextSetupResponse, + UEContextSetupFailure, + UEContextReleaseCommand, + UEContextReleaseComplete, + UEContextModificationRequest, + UEContextModificationResponse, + UEContextModificationFailure, + UEContextModificationRequired, + UEContextModificationConfirm, + ErrorIndication, + UEContextReleaseRequest, + DLRRCMessageTransfer, + ULRRCMessageTransfer, + GNBDUResourceCoordinationRequest, + GNBDUResourceCoordinationResponse, + PrivateMessage, + UEInactivityNotification, + InitialULRRCMessageTransfer, + SystemInformationDeliveryCommand, + Paging, + Notify, + WriteReplaceWarningRequest, + WriteReplaceWarningResponse, + PWSCancelRequest, + PWSCancelResponse, + PWSRestartIndication, + PWSFailureIndication, + GNBDUStatusIndication, + RRCDeliveryReport, + UEContextModificationRefuse, + F1RemovalRequest, + F1RemovalResponse, + F1RemovalFailure, + NetworkAccessRateReduction, + TraceStart, + DeactivateTrace, + DUCURadioInformationTransfer, + CUDURadioInformationTransfer, + BAPMappingConfiguration, + BAPMappingConfigurationAcknowledge, + GNBDUResourceConfiguration, + GNBDUResourceConfigurationAcknowledge, + IABTNLAddressRequest, + IABTNLAddressResponse, + IABUPConfigurationUpdateRequest, + IABUPConfigurationUpdateResponse, + IABUPConfigurationUpdateFailure, + ResourceStatusRequest, + ResourceStatusResponse, + ResourceStatusFailure, + ResourceStatusUpdate, + AccessAndMobilityIndication, + ReferenceTimeInformationReportingControl, + ReferenceTimeInformationReport, + AccessSuccess, + CellTrafficTrace, + PositioningMeasurementRequest, + PositioningMeasurementResponse, + PositioningMeasurementFailure, + PositioningAssistanceInformationControl, + PositioningAssistanceInformationFeedback, + PositioningMeasurementReport, + PositioningMeasurementAbort, + PositioningMeasurementFailureIndication, + PositioningMeasurementUpdate, + TRPInformationRequest, + TRPInformationResponse, + TRPInformationFailure, + PositioningInformationRequest, + PositioningInformationResponse, + PositioningInformationFailure, + PositioningActivationRequest, + PositioningActivationResponse, + PositioningActivationFailure, + PositioningDeactivation, + PositioningInformationUpdate, + E-CIDMeasurementInitiationRequest, + E-CIDMeasurementInitiationResponse, + E-CIDMeasurementInitiationFailure, + E-CIDMeasurementFailureIndication, + E-CIDMeasurementReport, + E-CIDMeasurementTerminationCommand + + + +FROM F1AP-PDU-Contents + id-Reset, + id-F1Setup, + id-gNBDUConfigurationUpdate, + id-gNBCUConfigurationUpdate, + id-UEContextSetup, + id-UEContextRelease, + id-UEContextModification, + id-UEContextModificationRequired, + id-ErrorIndication, + id-UEContextReleaseRequest, + id-DLRRCMessageTransfer, + id-ULRRCMessageTransfer, + id-GNBDUResourceCoordination, + id-privateMessage, + id-UEInactivityNotification, + id-InitialULRRCMessageTransfer, + id-SystemInformationDeliveryCommand, + id-Paging, + id-Notify, + id-WriteReplaceWarning, + id-PWSCancel, + id-PWSRestartIndication, + id-PWSFailureIndication, + id-GNBDUStatusIndication, + id-RRCDeliveryReport, + id-F1Removal, + id-NetworkAccessRateReduction, + id-TraceStart, + id-DeactivateTrace, + id-DUCURadioInformationTransfer, + id-CUDURadioInformationTransfer, + id-BAPMappingConfiguration, + id-GNBDUResourceConfiguration, + id-IABTNLAddressAllocation, + id-IABUPConfigurationUpdate, + id-resourceStatusReportingInitiation, + id-resourceStatusReporting, + id-accessAndMobilityIndication, + id-ReferenceTimeInformationReportingControl, + id-ReferenceTimeInformationReport, + id-accessSuccess, + id-cellTrafficTrace, + id-PositioningMeasurementExchange, + id-PositioningAssistanceInformationControl, + id-PositioningAssistanceInformationFeedback, + id-PositioningMeasurementReport, + id-PositioningMeasurementAbort, + id-PositioningMeasurementFailureIndication, + id-PositioningMeasurementUpdate, + id-TRPInformationExchange, + id-PositioningInformationExchange, + id-PositioningActivation, + id-PositioningDeactivation, + id-PositioningInformationUpdate, + id-E-CIDMeasurementInitiation, + id-E-CIDMeasurementFailureIndication, + id-E-CIDMeasurementReport, + id-E-CIDMeasurementTermination + + +FROM F1AP-Constants + + ProtocolIE-SingleContainer{}, + F1AP-PROTOCOL-IES + +FROM F1AP-Containers; + + +-- ************************************************************** +-- +-- Interface Elementary Procedure Class +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURE ::= CLASS { + &InitiatingMessage , + &SuccessfulOutcome OPTIONAL, + &UnsuccessfulOutcome OPTIONAL, + &procedureCode ProcedureCode UNIQUE, + &criticality Criticality DEFAULT ignore +} +WITH SYNTAX { + INITIATING MESSAGE &InitiatingMessage + [SUCCESSFUL OUTCOME &SuccessfulOutcome] + [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] + PROCEDURE CODE &procedureCode + [CRITICALITY &criticality] +} + +-- ************************************************************** +-- +-- Interface PDU Definition +-- +-- ************************************************************** + +F1AP-PDU ::= CHOICE { + initiatingMessage InitiatingMessage, + successfulOutcome SuccessfulOutcome, + unsuccessfulOutcome UnsuccessfulOutcome, + choice-extension ProtocolIE-SingleContainer { { F1AP-PDU-ExtIEs} } +} + +F1AP-PDU-ExtIEs F1AP-PROTOCOL-IES ::= { -- this extension is not used + ... +} + +InitiatingMessage ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +SuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +UnsuccessfulOutcome ::= SEQUENCE { + procedureCode F1AP-ELEMENTARY-PROCEDURE.&procedureCode ({F1AP-ELEMENTARY-PROCEDURES}), + criticality F1AP-ELEMENTARY-PROCEDURE.&criticality ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value F1AP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome ({F1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +-- ************************************************************** +-- +-- Interface Elementary Procedure List +-- +-- ************************************************************** + +F1AP-ELEMENTARY-PROCEDURES F1AP-ELEMENTARY-PROCEDURE ::= { + F1AP-ELEMENTARY-PROCEDURES-CLASS-1 | + F1AP-ELEMENTARY-PROCEDURES-CLASS-2, + ... +} + + +F1AP-ELEMENTARY-PROCEDURES-CLASS-1 F1AP-ELEMENTARY-PROCEDURE ::= { + reset | + f1Setup | + gNBDUConfigurationUpdate | + gNBCUConfigurationUpdate | + uEContextSetup | + uEContextRelease | + uEContextModification | + uEContextModificationRequired | + writeReplaceWarning | + pWSCancel | + gNBDUResourceCoordination | + f1Removal | + bAPMappingConfiguration | + gNBDUResourceConfiguration | + iABTNLAddressAllocation | + iABUPConfigurationUpdate | + resourceStatusReportingInitiation | + positioningMeasurementExchange | + tRPInformationExchange | + positioningInformationExchange | + positioningActivation | + e-CIDMeasurementInitiation, + ... +} + +F1AP-ELEMENTARY-PROCEDURES-CLASS-2 F1AP-ELEMENTARY-PROCEDURE ::= { + errorIndication | + uEContextReleaseRequest | + dLRRCMessageTransfer | + uLRRCMessageTransfer | + uEInactivityNotification | + privateMessage | + initialULRRCMessageTransfer | + systemInformationDelivery | + paging | + notify | + pWSRestartIndication | + pWSFailureIndication | + gNBDUStatusIndication | + rRCDeliveryReport | + networkAccessRateReduction | + traceStart | + deactivateTrace | + dUCURadioInformationTransfer | + cUDURadioInformationTransfer | + resourceStatusReporting | + accessAndMobilityIndication | + referenceTimeInformationReportingControl| + referenceTimeInformationReport | + accessSuccess | + cellTrafficTrace | + positioningAssistanceInformationControl | + positioningAssistanceInformationFeedback | + positioningMeasurementReport | + positioningMeasurementAbort | + positioningMeasurementFailureIndication | + positioningMeasurementUpdate | + positioningDeactivation | + e-CIDMeasurementFailureIndication | + e-CIDMeasurementReport | + e-CIDMeasurementTermination | + positioningInformationUpdate, + ... +} +-- ************************************************************** +-- +-- Interface Elementary Procedures +-- +-- ************************************************************** + +reset F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Reset + SUCCESSFUL OUTCOME ResetAcknowledge + PROCEDURE CODE id-Reset + CRITICALITY reject +} + +f1Setup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1SetupRequest + SUCCESSFUL OUTCOME F1SetupResponse + UNSUCCESSFUL OUTCOME F1SetupFailure + PROCEDURE CODE id-F1Setup + CRITICALITY reject +} + +gNBDUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUConfigurationUpdate + SUCCESSFUL OUTCOME GNBDUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBDUConfigurationUpdateFailure + PROCEDURE CODE id-gNBDUConfigurationUpdate + CRITICALITY reject +} + +gNBCUConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBCUConfigurationUpdate + SUCCESSFUL OUTCOME GNBCUConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME GNBCUConfigurationUpdateFailure + PROCEDURE CODE id-gNBCUConfigurationUpdate + CRITICALITY reject +} + +uEContextSetup F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextSetupRequest + SUCCESSFUL OUTCOME UEContextSetupResponse + UNSUCCESSFUL OUTCOME UEContextSetupFailure + PROCEDURE CODE id-UEContextSetup + CRITICALITY reject +} + +uEContextRelease F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseCommand + SUCCESSFUL OUTCOME UEContextReleaseComplete + PROCEDURE CODE id-UEContextRelease + CRITICALITY reject +} + +uEContextModification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequest + SUCCESSFUL OUTCOME UEContextModificationResponse + UNSUCCESSFUL OUTCOME UEContextModificationFailure + PROCEDURE CODE id-UEContextModification + CRITICALITY reject +} + +uEContextModificationRequired F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequired + SUCCESSFUL OUTCOME UEContextModificationConfirm + UNSUCCESSFUL OUTCOME UEContextModificationRefuse + PROCEDURE CODE id-UEContextModificationRequired + CRITICALITY reject +} + +writeReplaceWarning F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE WriteReplaceWarningRequest + SUCCESSFUL OUTCOME WriteReplaceWarningResponse + PROCEDURE CODE id-WriteReplaceWarning + CRITICALITY reject +} + +pWSCancel F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSCancelRequest + SUCCESSFUL OUTCOME PWSCancelResponse + PROCEDURE CODE id-PWSCancel + CRITICALITY reject +} + +errorIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + PROCEDURE CODE id-ErrorIndication + CRITICALITY ignore +} + +uEContextReleaseRequest F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseRequest + PROCEDURE CODE id-UEContextReleaseRequest + CRITICALITY ignore +} + + +initialULRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InitialULRRCMessageTransfer + PROCEDURE CODE id-InitialULRRCMessageTransfer + CRITICALITY ignore +} + +dLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DLRRCMessageTransfer + PROCEDURE CODE id-DLRRCMessageTransfer + CRITICALITY ignore +} + +uLRRCMessageTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ULRRCMessageTransfer + PROCEDURE CODE id-ULRRCMessageTransfer + CRITICALITY ignore +} + + +uEInactivityNotification F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEInactivityNotification + PROCEDURE CODE id-UEInactivityNotification + CRITICALITY ignore +} + +gNBDUResourceCoordination F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUResourceCoordinationRequest + SUCCESSFUL OUTCOME GNBDUResourceCoordinationResponse + PROCEDURE CODE id-GNBDUResourceCoordination + CRITICALITY reject +} + +privateMessage F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + PROCEDURE CODE id-privateMessage + CRITICALITY ignore +} + +systemInformationDelivery F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SystemInformationDeliveryCommand + PROCEDURE CODE id-SystemInformationDeliveryCommand + CRITICALITY ignore +} + + +paging F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Paging + PROCEDURE CODE id-Paging + CRITICALITY ignore +} + +notify F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Notify + PROCEDURE CODE id-Notify + CRITICALITY ignore +} + +networkAccessRateReduction F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE NetworkAccessRateReduction + PROCEDURE CODE id-NetworkAccessRateReduction + CRITICALITY ignore +} + + +pWSRestartIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSRestartIndication + PROCEDURE CODE id-PWSRestartIndication + CRITICALITY ignore +} + +pWSFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSFailureIndication + PROCEDURE CODE id-PWSFailureIndication + CRITICALITY ignore +} + +gNBDUStatusIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUStatusIndication + PROCEDURE CODE id-GNBDUStatusIndication + CRITICALITY ignore +} + + +rRCDeliveryReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RRCDeliveryReport + PROCEDURE CODE id-RRCDeliveryReport + CRITICALITY ignore +} + +f1Removal F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE F1RemovalRequest + SUCCESSFUL OUTCOME F1RemovalResponse + UNSUCCESSFUL OUTCOME F1RemovalFailure + PROCEDURE CODE id-F1Removal + CRITICALITY reject +} + +traceStart F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TraceStart + PROCEDURE CODE id-TraceStart + CRITICALITY ignore +} + +deactivateTrace F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DeactivateTrace + PROCEDURE CODE id-DeactivateTrace + CRITICALITY ignore +} + +dUCURadioInformationTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DUCURadioInformationTransfer + PROCEDURE CODE id-DUCURadioInformationTransfer + CRITICALITY ignore +} + +cUDURadioInformationTransfer F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CUDURadioInformationTransfer + PROCEDURE CODE id-CUDURadioInformationTransfer + CRITICALITY ignore +} + +bAPMappingConfiguration F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE BAPMappingConfiguration + SUCCESSFUL OUTCOME BAPMappingConfigurationAcknowledge + PROCEDURE CODE id-BAPMappingConfiguration + CRITICALITY reject +} + +gNBDUResourceConfiguration F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE GNBDUResourceConfiguration + SUCCESSFUL OUTCOME GNBDUResourceConfigurationAcknowledge + PROCEDURE CODE id-GNBDUResourceConfiguration + CRITICALITY reject +} + +iABTNLAddressAllocation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE IABTNLAddressRequest + SUCCESSFUL OUTCOME IABTNLAddressResponse + PROCEDURE CODE id-IABTNLAddressAllocation + CRITICALITY reject +} + +iABUPConfigurationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE IABUPConfigurationUpdateRequest + SUCCESSFUL OUTCOME IABUPConfigurationUpdateResponse + UNSUCCESSFUL OUTCOME IABUPConfigurationUpdateFailure + PROCEDURE CODE id-IABUPConfigurationUpdate + CRITICALITY reject +} + +resourceStatusReportingInitiation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusRequest + SUCCESSFUL OUTCOME ResourceStatusResponse + UNSUCCESSFUL OUTCOME ResourceStatusFailure + PROCEDURE CODE id-resourceStatusReportingInitiation + CRITICALITY reject +} + +resourceStatusReporting F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusUpdate + PROCEDURE CODE id-resourceStatusReporting + CRITICALITY ignore +} + +accessAndMobilityIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AccessAndMobilityIndication + PROCEDURE CODE id-accessAndMobilityIndication + CRITICALITY ignore +} + +referenceTimeInformationReportingControl F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ReferenceTimeInformationReportingControl + PROCEDURE CODE id-ReferenceTimeInformationReportingControl + CRITICALITY ignore +} + +referenceTimeInformationReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ReferenceTimeInformationReport + PROCEDURE CODE id-ReferenceTimeInformationReport + CRITICALITY ignore +} + +accessSuccess F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE AccessSuccess + PROCEDURE CODE id-accessSuccess + CRITICALITY ignore +} + +cellTrafficTrace F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellTrafficTrace + PROCEDURE CODE id-cellTrafficTrace + CRITICALITY ignore +} + +positioningAssistanceInformationControl F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningAssistanceInformationControl + PROCEDURE CODE id-PositioningAssistanceInformationControl + CRITICALITY ignore +} + +positioningAssistanceInformationFeedback F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningAssistanceInformationFeedback + PROCEDURE CODE id-PositioningAssistanceInformationFeedback + CRITICALITY ignore +} + +positioningMeasurementExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementRequest + SUCCESSFUL OUTCOME PositioningMeasurementResponse + UNSUCCESSFUL OUTCOME PositioningMeasurementFailure + PROCEDURE CODE id-PositioningMeasurementExchange + CRITICALITY reject +} + +positioningMeasurementReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementReport + PROCEDURE CODE id-PositioningMeasurementReport + CRITICALITY ignore +} + +positioningMeasurementAbort F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementAbort + PROCEDURE CODE id-PositioningMeasurementAbort + CRITICALITY ignore +} + +positioningMeasurementFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementFailureIndication + PROCEDURE CODE id-PositioningMeasurementFailureIndication + CRITICALITY ignore +} + +positioningMeasurementUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningMeasurementUpdate + PROCEDURE CODE id-PositioningMeasurementUpdate + CRITICALITY ignore +} + + +tRPInformationExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TRPInformationRequest + SUCCESSFUL OUTCOME TRPInformationResponse + UNSUCCESSFUL OUTCOME TRPInformationFailure + PROCEDURE CODE id-TRPInformationExchange + CRITICALITY reject +} + +positioningInformationExchange F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningInformationRequest + SUCCESSFUL OUTCOME PositioningInformationResponse + UNSUCCESSFUL OUTCOME PositioningInformationFailure + PROCEDURE CODE id-PositioningInformationExchange + CRITICALITY reject +} + +positioningActivation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningActivationRequest + SUCCESSFUL OUTCOME PositioningActivationResponse + UNSUCCESSFUL OUTCOME PositioningActivationFailure + PROCEDURE CODE id-PositioningActivation + CRITICALITY reject +} + +positioningDeactivation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningDeactivation + PROCEDURE CODE id-PositioningDeactivation + CRITICALITY ignore +} + +e-CIDMeasurementInitiation F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementInitiationRequest + SUCCESSFUL OUTCOME E-CIDMeasurementInitiationResponse + UNSUCCESSFUL OUTCOME E-CIDMeasurementInitiationFailure + PROCEDURE CODE id-E-CIDMeasurementInitiation + CRITICALITY reject +} + +e-CIDMeasurementFailureIndication F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementFailureIndication + PROCEDURE CODE id-E-CIDMeasurementFailureIndication + CRITICALITY ignore +} + +e-CIDMeasurementReport F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementReport + PROCEDURE CODE id-E-CIDMeasurementReport + CRITICALITY ignore +} + +e-CIDMeasurementTermination F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-CIDMeasurementTerminationCommand + PROCEDURE CODE id-E-CIDMeasurementTermination + CRITICALITY ignore +} + +positioningInformationUpdate F1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PositioningInformationUpdate + PROCEDURE CODE id-PositioningInformationUpdate + CRITICALITY ignore +} + + +END diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index ee57a7ec83..7781a78412 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -46,7 +46,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #endif -#include "F1AP_Active-Cells-List.h" #include "F1AP_RAT-FrequencyPriorityInformation.h" #include "F1AP_DLUPTNLInformation-ToBeSetup-Item.h" #include "F1AP_PrivateMessage.h" @@ -55,6 +54,7 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_NRPCI.h" #include "F1AP_Transmission-Bandwidth.h" #include "F1AP_SIB1-message.h" +#include "F1AP_SibtypetobeupdatedListItem.h" #include "F1AP_GNBCUConfigurationUpdateAcknowledge.h" #include "F1AP_DRBs-Setup-Item.h" #include "F1AP_EUTRA-NR-CellResourceCoordinationReqAck-Container.h" @@ -75,7 +75,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_DRBs-Required-ToBeModified-Item.h" #include "F1AP_BitRate.h" #include "F1AP_SRBs-ToBeSetup-List.h" -#include "F1AP_ConcurrentWarningMessageIndicator.h" #include "F1AP_CriticalityDiagnostics-IE-Item.h" #include "F1AP_GNB-CU-TNL-Association-To-Update-List.h" #include "F1AP_DRB-Notify-List.h" @@ -85,6 +84,7 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_PWS-Failed-NR-CGI-List.h" #include "F1AP_InitialULRRCMessageTransfer.h" #include "F1AP_Served-Cell-Information.h" +#include "F1AP_ServedPLMNs-Item.h" #include "F1AP_Served-EUTRA-Cells-Information.h" #include "F1AP_Cells-Broadcast-Cancelled-Item.h" #include "F1AP_F1SetupRequest.h" @@ -128,13 +128,11 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_TransactionID.h" #include "F1AP_AllocationAndRetentionPriority.h" #include "F1AP_ShortDRXCycleLength.h" -#include "F1AP_BroadcastPLMNs-Item.h" #include "F1AP_DRB-Information.h" #include "F1AP_TimeToWait.h" #include "F1AP_NonDynamic5QIDescriptor.h" #include "F1AP_C-RNTI.h" #include "F1AP_MIB-message.h" -#include "F1AP_SIBtype-Item.h" #include "F1AP_Served-Cells-To-Modify-List.h" #include "F1AP_NRCGI.h" #include "F1AP_DuplicationActivation.h" @@ -187,6 +185,7 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_CellULConfigured.h" #include "F1AP_DRB-Activity.h" #include "F1AP_GNB-CU-TNL-Association-Failed-To-Setup-Item.h" +#include "F1AP_ProtocolIE-ID.h" #include "F1AP_PrivateIE-ID.h" #include "F1AP_WriteReplaceWarningResponse.h" #include "F1AP_CauseMisc.h" @@ -231,9 +230,7 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_SUL-Information.h" #include "F1AP_CriticalityDiagnostics-IE-List.h" #include "F1AP_EUTRA-FDD-Info.h" -#include "F1AP_BroadcastPLMNs-List.h" #include "F1AP_Served-Cells-To-Delete-Item.h" -#include "F1AP_ListofEUTRACellsinGNBDUCoordination.h" #include "F1AP_Candidate-SpCell-Item.h" #include "F1AP_Cells-To-Be-Broadcast-List.h" #include "F1AP_ULRRCMessageTransfer.h" @@ -255,7 +252,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_SRBs-ToBeReleased-List.h" #include "F1AP_MeasGapConfig.h" #include "F1AP_NR-Mode-Info.h" -#include "F1AP_Active-Cells-Item.h" #include "F1AP_Protected-EUTRA-Resources-List.h" #include "F1AP_SRBs-FailedToBeSetup-Item.h" #include "F1AP_ResetAll.h" @@ -287,7 +283,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_UEContextReleaseRequest.h" #include "F1AP_GNB-DU-Name.h" #include "F1AP_DRBs-ToBeModified-Item.h" -#include "F1AP_SIBtype-List.h" #include "F1AP_EUTRA-NR-CellResourceCoordinationReq-Container.h" #include "F1AP_DRBs-SetupMod-List.h" #include "F1AP_DRBs-Required-ToBeModified-List.h" @@ -296,7 +291,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_PacketDelayBudget.h" #include "F1AP_GNBCUConfigurationUpdate.h" #include "F1AP_Cells-Broadcast-Completed-Item.h" -#include "F1AP_RRCRconfigurationCompleteIndicator.h" #include "F1AP_PagingPriority.h" #include "F1AP_Cells-Failed-to-be-Activated-List.h" #include "F1AP_Endpoint-IP-address-and-port.h" @@ -306,7 +300,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_ResetType.h" #include "F1AP_FDD-Info.h" #include "F1AP_DLUPTNLInformation-ToBeSetup-List.h" -#include "F1AP_QoSFlowIndicator.h" #include "F1AP_NR-CGI-List-For-Restart-List.h" #include "F1AP_F1SetupResponse.h" #include "F1AP_UEContextSetupResponse.h" @@ -325,7 +318,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_Cells-to-be-Barred-List.h" #include "F1AP_Presence.h" #include "F1AP_CellBarred.h" -#include "F1AP_SIBtype.h" #include "F1AP_RequestType.h" #include "F1AP_NRFreqInfo.h" #include "F1AP_Potential-SpCell-Item.h" @@ -348,7 +340,6 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "F1AP_GBR-QoSFlowInformation.h" #include "F1AP_SCellIndex.h" #include "F1AP_DRBs-SetupMod-Item.h" -#include "F1AP_TransmissionStopIndicator.h" #include "F1AP_UEContextSetupFailure.h" #include "F1AP_DRBs-FailedToBeModified-List.h" #include "F1AP_DRBs-FailedToBeSetupMod-Item.h" diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 01cd4aa9e0..20926c10d1 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -139,10 +139,11 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, served_celles_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *)ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); /* tac */ - OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); - LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", - i, F1AP_SETUP_REQ(message_p).tac[i]); - + if (served_celles_item_p->served_Cell_Information.fiveGS_TAC) { + OCTET_STRING_TO_INT16(served_celles_item_p->served_Cell_Information.fiveGS_TAC, F1AP_SETUP_REQ(message_p).tac[i]); + LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", + i, F1AP_SETUP_REQ(message_p).tac[i]); + } /* - nRCGI */ TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], F1AP_SETUP_REQ(message_p).mnc[i], @@ -356,20 +357,32 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); //printf("\n"); - OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, - (const char*)f1ap_setup_resp->SI_container[i][0], - f1ap_setup_resp->SI_container_length[i][0]); - - LOG_D(F1AP, "f1ap_setup_resp->SI_container_length = %d \n", f1ap_setup_resp->SI_container_length[0][0]); + for (int j=2; + j<10; + j++) { + if (j==6) j=9; + if (f1ap_setup_resp->SI_container[i][j]!=NULL) { + LOG_I(F1AP,"SETUP RESP: SI %d, Type %d\n",i,j); + AssertFatal((j < 6) || (j == 9), "Illegal SI type %d\n",j); + F1AP_SibtypetobeupdatedListItem_t *sib_item = calloc(1,sizeof(*sib_item)); + sib_item->sIBtype = j; + OCTET_STRING_fromBuf(&sib_item->sIBmessage, + (const char*)f1ap_setup_resp->SI_container[i][j], + f1ap_setup_resp->SI_container_length[i][j]); + + LOG_I(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,j,f1ap_setup_resp->SI_container_length[i][j]); + ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item); + } + } cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; - F1AP_ProtocolExtensionContainer_160P9_t p_160P9_t; - memset((void *)&p_160P9_t, 0, sizeof(F1AP_ProtocolExtensionContainer_160P9_t)); + F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t; + memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t)); - ASN_SEQUENCE_ADD(&p_160P9_t.list, + ASN_SEQUENCE_ADD(&p_154P112_t.list, cells_to_be_activated_list_itemExtIEs); - cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_160P9_t; + cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_154P112_t; free(gNB_CUSystemInformation); gNB_CUSystemInformation = NULL; @@ -829,17 +842,13 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; - protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_SpectrumSharingGroupID; - protected_eutra_resources_item_ies->value.choice.SpectrumSharingGroupID = 1L; - + protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_Protected_EUTRA_Resources_Item; + ((F1AP_Protected_EUTRA_Resources_Item_t*)&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item)->spectrumSharingGroupID = 123L; + memset(&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item,0, + sizeof(F1AP_Protected_EUTRA_Resources_Item_t)); ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); - /* 8.2 ListofEUTRACellsinGNBDUCoordination */ - protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); - protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; - protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; - protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_ListofEUTRACellsinGNBDUCoordination; - +/* F1AP_Served_EUTRA_Cells_Information_t served_eutra_cells_information; memset((void *)&served_eutra_cells_information, 0, sizeof(F1AP_Served_EUTRA_Cells_Information_t)); @@ -870,6 +879,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ ASN_SEQUENCE_ADD(&protected_eutra_resources_item_ies->value.choice.ListofEUTRACellsinGNBDUCoordination.list, &served_eutra_cells_information); ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); +*/ } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 306a1fe14b..f4c09c4725 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -109,7 +109,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RNTI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_C_RNTI, true); - BUFFER_TO_INT16(ie->value.choice.C_RNTI.buf, rnti); + rnti = ie->value.choice.C_RNTI; /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, @@ -260,19 +260,22 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* optional */ /* c7. RAT_FrequencyPriorityInformation */ /* TODO */ - if (0) { - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation; - - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP = 123L; - + int endc=1; + ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation; + if (endc==1) { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 123L; + } + else { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L; + } //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 789ce4c715..1857678ce9 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -108,7 +108,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* mandatory */ /* c4. ServCellIndex */ ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; + ie->id = F1AP_ProtocolIE_ID_id_ServCellIndex; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; ie->value.choice.ServCellIndex = 2; @@ -379,75 +379,86 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } } else { - /* 12.1.2 dRB_Information */ - drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_dRB_Information; - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information = (F1AP_DRB_Information_t *)calloc(1, sizeof(F1AP_DRB_Information_t)); - + /* 12.1.2 DRB_Information */ + drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_choice_extension; + + F1AP_QoSInformation_ExtIEs_t *ie; + ie = (F1AP_QoSInformation_ExtIEs_t *)calloc(1, sizeof(F1AP_QoS_Characteristics_ExtIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_DRB_Information; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_QoSInformation_ExtIEs__value_PR_DRB_Information; + F1AP_DRB_Information_t *DRB_Information = &ie->value.choice.DRB_Information; + + drbs_toBeSetup_item.qoSInformation.choice.choice_extension = (struct F1AP_ProtocolIE_SingleContainer*)ie; + + /* 12.1.2.1 dRB_QoS */ { /* qoS_Characteristics */ { int some_decide_qoS_characteristics = 1; // BK: Need Check if (some_decide_qoS_characteristics) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); + DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); /* fiveQI */ - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; /* OPTIONAL */ /* qoSPriorityLevel */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; } } else { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); + DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); /* qoSPriorityLevel */ - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; /* packetDelayBudget */ - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; /* packetErrorRate */ - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Scalar = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Exponent = 6L; + /* OPTIONAL */ /* delayCritical */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); + *DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; } } // if some_decide_qoS_characteristics @@ -456,32 +467,32 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* nGRANallocationRetentionPriority */ { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum + DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum } // nGRANallocationRetentionPriority /* OPTIONAL */ /* gBR_QoS_Flow_Information */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); + DRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); + asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); + asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); + asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); + asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); /* OPTIONAL */ /* maxPacketLossRateDownlink */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + *DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; } /* OPTIONAL */ /* maxPacketLossRateUplink */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); + *DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; } } @@ -489,8 +500,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* reflective_QoS_Attribute */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L; + DRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); + *DRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L; } } // dRB_QoS @@ -498,21 +509,21 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 12.1.2.2 sNSSAI */ { /* sST */ - OCTET_STRING_fromBuf(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sST, "asdsa1d32sa1d31asd31as", + OCTET_STRING_fromBuf(&DRB_Information->sNSSAI.sST, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); /* OPTIONAL */ /* sD */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sD = (OCTET_STRING_t *)calloc(1, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->sNSSAI.sD, "asdsa1d32sa1d31asd31as", + DRB_Information->sNSSAI.sD = (OCTET_STRING_t *)calloc(1, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(DRB_Information->sNSSAI.sD, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); } } /* OPTIONAL */ /* 12.1.2.3 notificationControl */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = (F1AP_NotificationControl_t *)calloc(1, sizeof(F1AP_NotificationControl_t)); - *drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->notificationControl = F1AP_NotificationControl_active; // enum + DRB_Information->notificationControl = (F1AP_NotificationControl_t *)calloc(1, sizeof(F1AP_NotificationControl_t)); + *DRB_Information->notificationControl = F1AP_NotificationControl_active; // enum } /* 12.1.2.4 flows_Mapped_To_DRB_List */ // BK: need verifiy @@ -523,7 +534,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, memset((void *)&flows_mapped_to_drb_item, 0, sizeof(F1AP_Flows_Mapped_To_DRB_Item_t)); /* qoSFlowIndicator */ - flows_mapped_to_drb_item.qoSFlowIndicator = 1L; + flows_mapped_to_drb_item.qoSFlowIdentifier = 1L; /* qoSFlowLevelQoSParameters */ { @@ -569,8 +580,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; /* packetErrorRate */ - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate = 1L; - + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Scalar = 1L; + flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Exponent = 6L; /* OPTIONAL */ /* delayCritical */ if (0) { @@ -637,7 +648,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } // qoSFlowLevelQoSParameters // BK: need check - ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.qoSInformation.choice.dRB_Information->flows_Mapped_To_DRB_List.list, &flows_mapped_to_drb_item); + ASN_SEQUENCE_ADD(&DRB_Information->flows_Mapped_To_DRB_List.list, &flows_mapped_to_drb_item); } } // if some_decide_qos @@ -672,7 +683,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_am; break; default: - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um; + drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um_bidirectional; } /* OPTIONAL */ @@ -716,13 +727,13 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RAT_FrequencyPriorityInformation; - int some_decide_rat = 1; // BK: Need Check - if (some_decide_rat) { - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP = 11L; + int endc = 1; // RK: Get this from somewhere ... + if (endc) { + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 11L; } else { - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 11L; + ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN; + ie->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L; } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -1070,7 +1081,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* mandatory */ /* c4. ServCellIndex */ ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ServCellndex; + ie->id = F1AP_ProtocolIE_ID_id_ServCellIndex; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ServCellIndex; ie->value.choice.ServCellIndex = 5L; @@ -1114,13 +1125,13 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { } /* optional */ - /* c6. TransmissionStopIndicator */ + /* c6. TransmissionActionIndicator */ if (1) { ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransmissionStopIndicator; + ie->id = F1AP_ProtocolIE_ID_id_TransmissionActionIndicator; ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionStopIndicator; - ie->value.choice.TransmissionStopIndicator = F1AP_TransmissionStopIndicator_true; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator; + ie->value.choice.TransmissionActionIndicator = F1AP_TransmissionActionIndicator_stop; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -1140,10 +1151,10 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* c7. RRCRconfigurationCompleteIndicator */ if (1) { ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCRconfigurationCompleteIndicator; + ie->id = F1AP_ProtocolIE_ID_id_RRCReconfigurationCompleteIndicator; ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCRconfigurationCompleteIndicator; - ie->value.choice.RRCRconfigurationCompleteIndicator = F1AP_RRCRconfigurationCompleteIndicator_true; + ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCReconfigurationCompleteIndicator; + ie->value.choice.RRCReconfigurationCompleteIndicator = F1AP_RRCReconfigurationCompleteIndicator_true; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -1325,7 +1336,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { } /* rLCMode */ - drbs_toBeSetupMod_item.rLCMode = F1AP_RLCMode_rlc_um; // enum + drbs_toBeSetupMod_item.rLCMode = F1AP_RLCMode_rlc_um_bidirectional; // enum /* OPTIONAL */ /* ULConfiguration */ @@ -1366,9 +1377,10 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { drbs_toBeModified_item.dRBID = 30L; /* qoSInformation */ - drbs_toBeModified_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeModified_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; + drbs_toBeModified_item.qoSInformation =calloc(1,sizeof(*drbs_toBeModified_item.qoSInformation)); + drbs_toBeModified_item.qoSInformation->present = F1AP_QoSInformation_PR_eUTRANQoS; + drbs_toBeModified_item.qoSInformation->choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + drbs_toBeModified_item.qoSInformation->choice.eUTRANQoS->qCI = 254L; /* ULTunnels_ToBeModified_List */ int j = 0; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 86b5b1cb77..0b71ce38b7 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -95,7 +95,6 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { uint8_t *buffer; uint32_t len; int i = 0; - int j = 0; /* Create */ /* 0. pdu Type */ @@ -189,7 +188,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ - OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, (const char*)&f1ap_du_data->tac[i], 3); @@ -201,19 +200,11 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { 2); } - /* - broadcast PLMNs */ - // RK: add the num_available_broadcast_PLMNs to the message - int num_available_broadcast_PLMNs = 1; //f1ap_du_data->num_available_broadcast_PLMNs; - LOG_D(F1AP, "num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); - for (j=0; - j PLMN BroadcastPLMNs Item */ - F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //MCC_MNC_TO_PLMNID(208, 95, 2, &broadcastPLMNs_Item->pLMN_Identity); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); - } + /* servedPLMN information */ + F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); + memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; @@ -237,7 +228,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* FDD.1.3 freqBandListNr */ int fdd_ul_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_frequency_bands; - LOG_D(F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); + LOG_I(F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); int fdd_ul_j; for (fdd_ul_j=0; fdd_ul_jnr_mode_info[i].fdd.dl_num_frequency_bands; - LOG_D(F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); + LOG_I(F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); int fdd_dl_j; for (fdd_dl_j=0; fdd_dl_jnr_mode_info[i].tdd.num_frequency_bands; - LOG_D(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); + LOG_I(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); + AssertFatal(tdd_num_available_freq_Bands > 0, "should have at least one TDD band available\n"); int j; for (j=0; jnRPCI; - F1AP_ProtocolExtensionContainer_160P9_t *ext = (F1AP_ProtocolExtensionContainer_160P9_t *)cell->iE_Extensions; - AssertFatal(ext!=NULL,"Extension for SI is null\n"); - F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count; - AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); - LOG_D(F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", - i, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], - F1AP_SETUP_RESP (msg_p).nr_cellid[i], F1AP_SETUP_RESP (msg_p).num_SI[i]); - for (int si =0;si < ext->list.count;si++) { - size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size; - F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size; - LOG_D(F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %ld bytes\n", i, si, size); - F1AP_SETUP_RESP (msg_p).SI_container[i][si] = malloc(F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); - - memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][si], - (void*)ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.buf, - F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); - } - } - break; - } - } + F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions; + AssertFatal(ext!=NULL,"Extension is null\n"); + for (int cnt=0;cntlist.count;cnt++) { + F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt]; + switch (cells_to_be_activated_list_itemExtIEs->id) { +/* + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING: + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List +*/ + case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation: + { + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t*)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; + F1AP_SETUP_RESP (msg_p).num_SI[i] = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; + AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); + LOG_D(F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", + i, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], + F1AP_SETUP_RESP (msg_p).nr_cellid[i], F1AP_SETUP_RESP (msg_p).num_SI[i]); + for (int si =0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) { + F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; + size_t size = sib_item->sIBmessage.size; + F1AP_SETUP_RESP (msg_p).SI_container_length[i][sib_item->sIBtype] = size; + LOG_I(F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size); + F1AP_SETUP_RESP (msg_p).SI_container[i][sib_item->sIBtype] = malloc(size); + memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][sib_item->sIBtype], + (void*)sib_item->sIBmessage.buf, + size); + } + } + break; + case F1AP_ProtocolIE_ID_id_AvailablePLMNList: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + case F1AP_ProtocolIE_ID_id_ExtendedAvailablePLMN_List: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + case F1AP_ProtocolIE_ID_id_IAB_Info_IAB_donor_CU: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + case F1AP_ProtocolIE_ID_id_AvailableSNPN_ID_List: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); + break; + default: + AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n",(int)cells_to_be_activated_list_itemExtIEs->id); + break; + } + } // for (cnt=... + } // for (cells_to_activate... + } // switch ie + } // for IE AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); AssertFatal(num_cells_to_activate>0,"No cells activated\n"); F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate; @@ -542,7 +566,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); - itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); + itti_send_msg_to_task(TASK_ENB_APP, instance, msg_p); return 0; } @@ -635,7 +659,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ - OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, (const char *) &f1ap_setup_req->tac[i], 3); @@ -647,17 +671,11 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, 2); } - /* - broadcast PLMNs */ - int maxnoofBPLMNS = 1; - for (i=0; - i PLMN BroadcastPLMNs Item */ - F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); - } + F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); + memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); + // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; @@ -803,7 +821,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 /* - fiveGS_TAC */ - OCTET_STRING_fromBuf(&served_cell_information.fiveGS_TAC, + OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, (const char *) &f1ap_setup_req->tac[i], 3); @@ -815,17 +833,12 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, 2); } - /* - broadcast PLMNs */ - int maxnoofBPLMNS = 1; - for (i=0; - i PLMN BroadcastPLMNs Item */ - F1AP_BroadcastPLMNs_Item_t *broadcastPLMNs_Item = (F1AP_BroadcastPLMNs_Item_t *)calloc(1, sizeof(F1AP_BroadcastPLMNs_Item_t)); - //memset((void *)&broadcastPLMNs_Item, 0, sizeof(F1AP_BroadcastPLMNs_Item_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &broadcastPLMNs_Item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, broadcastPLMNs_Item); - } + F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); + memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); + + // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t nR_Mode_Info; @@ -963,42 +976,6 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ - /* c5. Active_Cells_List */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Active_Cells_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Active_Cells_List; - - for (i=0; - i<1; - i++) { - // - F1AP_Active_Cells_ItemIEs_t *active_cells_item_ies; - active_cells_item_ies = (F1AP_Active_Cells_ItemIEs_t *)calloc(1, sizeof(F1AP_Active_Cells_ItemIEs_t)); - active_cells_item_ies->id = F1AP_ProtocolIE_ID_id_Active_Cells_Item; - active_cells_item_ies->criticality = F1AP_Criticality_reject; - active_cells_item_ies->value.present = F1AP_Active_Cells_ItemIEs__value_PR_Active_Cells_Item; - - F1AP_Active_Cells_Item_t active_cells_item; - memset((void *)&active_cells_item, 0, sizeof(F1AP_Active_Cells_Item_t)); - - /* 3.1 oldNRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); - active_cells_item.nRCGI = nRCGI; - - /* ADD */ - active_cells_item_ies->value.choice.Active_Cells_Item = active_cells_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.Active_Cells_List.list, - active_cells_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 setup request\n"); diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index ee096337dd..1d6e729ab2 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -161,10 +161,10 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true); switch(ie->value.choice.RAT_FrequencyPriorityInformation.present) { - case F1AP_RAT_FrequencyPriorityInformation_PR_subscriberProfileIDforRFP: + case F1AP_RAT_FrequencyPriorityInformation_PR_eNDC: //subscriberProfileIDforRFP = ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP; break; - case F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority: + case F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN: //rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority; break; default: @@ -721,7 +721,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, } else { LOG_I(F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti); - ue_context_p->ue_context.Status = RRC_CONNECTED; + ue_context_p->ue_context.StatusRrc = RRC_CONNECTED; } break; @@ -836,7 +836,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_C_RNTI; - C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); + ie->value.choice.C_RNTI=rntiP; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index b66141250b..c8aa4a6119 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -86,9 +86,9 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat DevAssert(sctp_new_association_resp != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { - LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", + LOG_E(F1AP, "Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n", sctp_new_association_resp->sctp_state, - instance, + (int)instance, sctp_new_association_resp->ulp_cnx_id); //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 841c77eef5..bfd0e8e9af 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -91,7 +91,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, BIT_STRING_TO_NR_CELL_IDENTITY(&ie->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid); /* ServCellIndex */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_ServCellndex, true); + F1AP_ProtocolIE_ID_id_ServCellIndex, true); f1ap_ue_context_setup_req->servCellIndex = ie->value.choice.ServCellIndex; /* optional */ /* CellULConfigured */ @@ -227,7 +227,8 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; ie->criticality = F1AP_Criticality_ignore; ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_C_RNTI; - C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); + //C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); + ie->value.choice.C_RNTI=rntiP; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -1016,7 +1017,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { srbs_failedToBeSetupMod_item.sRBID = 50L; srbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); srbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - srbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + srbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; /* ADD */ srbs_failedToBeSetupMod_item_ies->value.choice.SRBs_FailedToBeSetupMod_Item = srbs_failedToBeSetupMod_item; ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetupMod_List.list, @@ -1047,7 +1048,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { drbs_failedToBeSetupMod_item.dRBID = 30L; drbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); drbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + drbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; /* ADD */ drbs_failedToBeSetupMod_item_ies->value.choice.DRBs_FailedToBeSetupMod_Item = drbs_failedToBeSetupMod_item; ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetupMod_List.list, @@ -1083,7 +1084,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { scell_failedtoSetupMod_item.sCell_ID = nRCGI; scell_failedtoSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); scell_failedtoSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - scell_failedtoSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + scell_failedtoSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; /* ADD */ scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item = scell_failedtoSetupMod_item; ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetupMod_List.list, @@ -1114,7 +1115,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { drbs_failedToBeModified_item.dRBID = 30L; drbs_failedToBeModified_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); drbs_failedToBeModified_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeModified_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnd_du_ue_f1ap_id; + drbs_failedToBeModified_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; /* ADD */ drbs_failedToBeModified_item_ies->value.choice.DRBs_FailedToBeModified_Item = drbs_failedToBeModified_item; ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeModified_List.list, diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index e448690139..6e5f0f4e49 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -84,12 +84,8 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT END----------------- \n"); } - encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer); - - if (encoded < 0) { - LOG_E(F1AP, "Failed to encode F1AP message\n"); - return -1; - } + AssertFatal((encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer))>0, + "Failed to encode F1AP message\n"); *length = encoded; diff --git a/openair2/GNB_APP/L1_nr_paramdef.h b/openair2/GNB_APP/L1_nr_paramdef.h index 67be560778..88f2cb1615 100644 --- a/openair2/GNB_APP/L1_nr_paramdef.h +++ b/openair2/GNB_APP/L1_nr_paramdef.h @@ -62,7 +62,7 @@ {CONFIG_STRING_L1_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ {CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \ -{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0} \ +{CONFIG_STRING_L1_PUSCH_PROC_THREADS, NULL, 0, uptr:NULL, defintval:3, TYPE_UINT, 0} \ } #define L1_CC_IDX 0 #define L1_TRANSPORT_N_PREFERENCE_IDX 1 diff --git a/openair2/GNB_APP/MACRLC_nr_paramdef.h b/openair2/GNB_APP/MACRLC_nr_paramdef.h index 308af2eeb9..60b40cb349 100644 --- a/openair2/GNB_APP/MACRLC_nr_paramdef.h +++ b/openair2/GNB_APP/MACRLC_nr_paramdef.h @@ -55,7 +55,7 @@ #define CONFIG_STRING_MACRLC_REMOTE_S_PORTC "remote_s_portc" #define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd" #define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd" - +#define CONFIG_STRING_MACRLC_ULSCH_MAX_SLOTS_INACTIVITY "ulsch_max_slots_inactivity" /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* MacRLC configuration parameters */ @@ -79,6 +79,7 @@ {CONFIG_STRING_MACRLC_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defintval:50020, TYPE_UINT, 0}, \ {CONFIG_STRING_MACRLC_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \ {CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \ +{CONFIG_STRING_MACRLC_ULSCH_MAX_SLOTS_INACTIVITY, "Maximum number of slots before a UE is scheduled ULSCH due to inactivity", 0, uptr:NULL, defintval:200, TYPE_UINT, 0}, \ } #define MACRLC_CC_IDX 0 #define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1 @@ -97,5 +98,6 @@ #define MACRLC_REMOTE_S_PORTC_IDX 14 #define MACRLC_LOCAL_S_PORTD_IDX 15 #define MACRLC_REMOTE_S_PORTD_IDX 16 +#define MACRLC_ULSCH_MAX_SLOTS_INACTIVITY 17 /*---------------------------------------------------------------------------------------------------------------------------------------------------------*/ #endif diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 77e4564632..b525e7edb7 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -147,8 +147,6 @@ void *gNB_app_task(void *args_p) LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); - RCconfig_NR_L1(); - RCconfig_nr_macrlc(); LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 608827cc7a..e578e98c5e 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -35,6 +35,7 @@ #include "assertions.h" #include "gnb_config.h" #include "gnb_paramdef.h" +#include "enb_paramdef.h" #include "UTIL/OTG/otg.h" #include "UTIL/OTG/otg_externs.h" #include "intertask_interface.h" @@ -53,11 +54,12 @@ //#include "L1_paramdef.h" #include "L1_nr_paramdef.h" -#include "MACRLC_paramdef.h" +#include "MACRLC_nr_paramdef.h" #include "common/config/config_userapi.h" //#include "RRC_config_tools.h" #include "gnb_paramdef.h" #include "NR_MAC_gNB/mac_proto.h" +#include #include "NR_asn_constant.h" #include "executables/thread-common.h" @@ -123,7 +125,37 @@ void prepare_scc(NR_ServingCellConfigCommon_t *scc) { scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon)); scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->controlResourceSetZero = CALLOC(1,sizeof(long)); scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceZero = CALLOC(1,sizeof(long)); - // scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = CALLOC(1,sizeof(struct NR_ControlResourceSet)); + + NR_ControlResourceSet_t *coreset0 = CALLOC(1,sizeof(struct NR_ControlResourceSet)); + coreset0->controlResourceSetId = 0; + // frequencyDomainResources '11111111 00000000 00000000 00000000 00000000 00000'B, + if(coreset0->frequencyDomainResources.buf == NULL) coreset0->frequencyDomainResources.buf = calloc(1,6); + coreset0->frequencyDomainResources.buf[0] = 0xff; + coreset0->frequencyDomainResources.buf[1] = 0; + coreset0->frequencyDomainResources.buf[2] = 0; + coreset0->frequencyDomainResources.buf[3] = 0; + coreset0->frequencyDomainResources.buf[4] = 0; + coreset0->frequencyDomainResources.buf[5] = 0; + coreset0->frequencyDomainResources.size = 6; + coreset0->frequencyDomainResources.bits_unused = 3; + coreset0->duration = 1; + coreset0->cce_REG_MappingType.present=NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved; + coreset0->cce_REG_MappingType.choice.interleaved=calloc(1,sizeof(*coreset0->cce_REG_MappingType.choice.interleaved)); + coreset0->cce_REG_MappingType.choice.interleaved->reg_BundleSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6; + coreset0->cce_REG_MappingType.choice.interleaved->interleaverSize = NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n2; + coreset0->cce_REG_MappingType.choice.interleaved->shiftIndex = scc->physCellId; + coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle; + if(coreset0->tci_StatesPDCCH_ToAddList == NULL) coreset0->tci_StatesPDCCH_ToAddList = calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList)); + NR_TCI_StateId_t *tci[8]; + for (int i=0;i<8;i++) { + tci[i]=calloc(1,sizeof(*tci[i])); + *tci[i] = i; + ASN_SEQUENCE_ADD(&coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]); + } + coreset0->tci_StatesPDCCH_ToReleaseList = NULL; + coreset0->tci_PresentInDCI = NULL; + coreset0->pdcch_DMRS_ScramblingID = NULL; + scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet = coreset0; // scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList)); // scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = CALLOC(1,sizeof(NR_SearchSpaceId_t)); @@ -297,7 +329,7 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) { void prepare_scd(NR_ServingCellConfig_t *scd) { // Allocate downlink structures - scd->downlinkBWP_ToAddModList = CALLOC(1, sizeof(scd->downlinkBWP_ToAddModList)); + scd->downlinkBWP_ToAddModList = CALLOC(1, sizeof(*scd->downlinkBWP_ToAddModList)); // Downlink bandwidth part NR_BWP_Downlink_t *bwp = calloc(1, sizeof(*bwp)); @@ -318,29 +350,25 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { NR_DMRS_DownlinkCfg->phaseTrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup; NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup = CALLOC(1, sizeof(*NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup)); NR_PTRS_DownlinkConfig_t *NR_PTRS_DownlinkCfg = NR_DMRS_DownlinkCfg->phaseTrackingRS->choice.setup; - NR_PTRS_DownlinkCfg->frequencyDensity = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->frequencyDensity)); - int *dl_rbs[2]; + NR_PTRS_DownlinkCfg->frequencyDensity = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->frequencyDensity)); + long *dl_rbs = CALLOC(2, sizeof(long)); for (int i=0;i<2;i++) { - dl_rbs[i] = CALLOC(1, sizeof(*dl_rbs[i])); - *dl_rbs[i] = 0; - ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->frequencyDensity->list, dl_rbs[i]); + ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->frequencyDensity->list, &dl_rbs[i]); } - NR_PTRS_DownlinkCfg->timeDensity = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->timeDensity)); - int *dl_mcs[3]; + NR_PTRS_DownlinkCfg->timeDensity = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->timeDensity)); + long *dl_mcs = CALLOC(3, sizeof(long)); for (int i=0;i<3;i++) { - dl_mcs[i] = CALLOC(1, sizeof(*dl_mcs[i])); - *dl_mcs[i] = 0; - ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->timeDensity->list, dl_mcs[i]); + ASN_SEQUENCE_ADD(&NR_PTRS_DownlinkCfg->timeDensity->list, &dl_mcs[i]); } - NR_PTRS_DownlinkCfg->epre_Ratio = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->epre_Ratio)); - NR_PTRS_DownlinkCfg->resourceElementOffset = CALLOC(1, sizeof(NR_PTRS_DownlinkCfg->resourceElementOffset)); + NR_PTRS_DownlinkCfg->epre_Ratio = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->epre_Ratio)); + NR_PTRS_DownlinkCfg->resourceElementOffset = CALLOC(1, sizeof(*NR_PTRS_DownlinkCfg->resourceElementOffset)); *NR_PTRS_DownlinkCfg->resourceElementOffset = 0; ASN_SEQUENCE_ADD(&scd->downlinkBWP_ToAddModList->list,bwp); // Allocate uplink structures - scd->uplinkConfig = CALLOC(1, sizeof(NR_UplinkConfig_t)); - scd->uplinkConfig->uplinkBWP_ToAddModList = CALLOC(1, sizeof(scd->uplinkConfig->uplinkBWP_ToAddModList)); + scd->uplinkConfig = CALLOC(1, sizeof(*scd->uplinkConfig)); + scd->uplinkConfig->uplinkBWP_ToAddModList = CALLOC(1, sizeof(*scd->uplinkConfig->uplinkBWP_ToAddModList)); NR_PUSCH_Config_t *pusch_Config = CALLOC(1, sizeof(*pusch_Config)); @@ -355,20 +383,16 @@ void prepare_scd(NR_ServingCellConfig_t *scd) { NR_PTRS_UplinkConfig_t *NR_PTRS_UplinkConfig = NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup; NR_PTRS_UplinkConfig->transformPrecoderDisabled = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled)); NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity)); - int *n_rbs[2]; + long *n_rbs = CALLOC(2, sizeof(long)); for (int i=0;i<2;i++) { - n_rbs[i] = CALLOC(1, sizeof(*n_rbs[i])); - *n_rbs[i] = 0; - ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity->list, n_rbs[i]); + ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->frequencyDensity->list, &n_rbs[i]); } NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity)); - int *ptrs_mcs[3]; + long *ptrs_mcs = CALLOC(3, sizeof(long)); for (int i = 0; i < 3; i++) { - ptrs_mcs[i] = CALLOC(1, sizeof(*ptrs_mcs[i])); - *ptrs_mcs[i] = 0; - ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity->list, ptrs_mcs[i]); + ASN_SEQUENCE_ADD(&NR_PTRS_UplinkConfig->transformPrecoderDisabled->timeDensity->list, &ptrs_mcs[i]); } - NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = CALLOC(1, sizeof(NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset)); + NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = CALLOC(1, sizeof(*NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset)); *NR_PTRS_UplinkConfig->transformPrecoderDisabled->resourceElementOffset = 0; // UL bandwidth part @@ -589,15 +613,17 @@ void RCconfig_NR_L1(void) { RC.nb_nr_CC = (int *)malloc((1+RC.nb_nr_inst)*sizeof(int)); RC.nb_nr_CC[0]=1; - RC.nb_nr_inst =1; // DJP - feptx_prec uses num_gNB but phy_init_RU uses nb_nr_inst - LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_nr_inst=1 this is because phy_init_RU() uses that to index and not RC.num_gNB - why the 2 similar variables?\n", __FUNCTION__); LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_nr_CC[0]=%d for init_gNB_afterRU()\n", __FUNCTION__, RC.nb_nr_CC[0]); LOG_I(PHY,"%s() NFAPI PNF mode - RC.nb_nr_macrlc_inst:%d because used by mac_top_init_gNB()\n", __FUNCTION__, RC.nb_nr_macrlc_inst); mac_top_init_gNB(); - configure_nr_nfapi_pnf(RC.gNB[j]->eth_params_n.remote_addr, RC.gNB[j]->eth_params_n.remote_portc, RC.gNB[j]->eth_params_n.my_addr, RC.gNB[j]->eth_params_n.my_portd, RC.gNB[j]->eth_params_n .remote_portd); + configure_nr_nfapi_pnf(RC.gNB[j]->eth_params_n.remote_addr, + RC.gNB[j]->eth_params_n.remote_portc, + RC.gNB[j]->eth_params_n.my_addr, + RC.gNB[j]->eth_params_n.my_portd, + RC.gNB[j]->eth_params_n.remote_portd); }else { // other midhaul } }// for (j = 0; j < RC.nb_nr_L1_inst; j++) @@ -673,6 +699,7 @@ void RCconfig_nr_macrlc() { }else { // other midhaul AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr)); } + RC.nrmac[j]->ulsch_max_slots_inactivity = *(MacRLC_ParamList.paramarray[j][MACRLC_ULSCH_MAX_SLOTS_INACTIVITY].uptr); }// for (j=0;j 0 AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found"); @@ -954,6 +981,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { NRRRC_CONFIGURATION_REQ (msg_p).ssb_SubcarrierOffset = *GNBParamList.paramarray[i][GNB_SSB_SUBCARRIEROFFSET_IDX].iptr; printf("pdsch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr; + printf("pusch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr); + NRRRC_CONFIGURATION_REQ (msg_p).pusch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr; printf("pusch_TargetSNRx10 %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_TARGETPOW_X10_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).pusch_TargetSNRx10 = *GNBParamList.paramarray[i][GNB_PUSCH_TARGETPOW_X10_IDX].iptr; printf("pucch_TargetSNRx10 %d\n",*GNBParamList.paramarray[i][GNB_PUCCH_TARGETPOW_X10_IDX].iptr); @@ -1018,20 +1047,23 @@ int RCconfig_nr_gtpu(void ) { MessageDef *message; if (gnb_mode == 1) { // NSA - AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_ENB_S1_REQ))!=NULL,""); + message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_ENB_S1_REQ); + AssertFatal(message!=NULL,""); // IPV4_STR_ADDR_TO_INT_NWBO ( address, RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); // LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,RC.gtpv1u_data_g->enb_ip_address_for_S1u_S12_S4_up); IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up, "BAD IP ADDRESS FORMAT FOR eNB S1_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_ENB_S1_REQ(message).enb_ip_address_for_S1u_S12_S4_up); GTPV1U_ENB_S1_REQ(message).enb_port_for_S1u_S12_S4_up = gnb_port_for_S1U; } else {// TODO SA - AssertFatal((message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_GNB_NG_REQ))!=NULL,""); + message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_GNB_NG_REQ); + AssertFatal(message!=NULL,""); IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_GNB_NG_REQ(message).gnb_ip_address_for_NGu_up, "BAD IP ADDRESS FORMAT FOR gNB NG_U !\n" ); LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_GNB_NG_REQ(message).gnb_ip_address_for_NGu_up); GTPV1U_GNB_NG_REQ(message).gnb_port_for_NGu_up = gnb_port_for_NGU; } - - itti_send_msg_to_task (TASK_GTPV1_U, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) + strcpy(GTPV1U_ENB_S1_REQ(message).addrStr,address); + sprintf(GTPV1U_ENB_S1_REQ(message).portStr,"%d", gnb_port_for_NGU); + itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) } else LOG_E(GTPU,"invalid address for NGU\n"); diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 0d965171ef..4f305b1f4d 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -92,7 +92,7 @@ typedef struct ru_config_s { uint8_t if_compress; } ru_config_t; */ -extern void RCconfig_RU(void); +extern void NRRCconfig_RU(void); extern void RCconfig_nr_flexran(void); extern void RCconfig_NR_L1(void); extern void RCconfig_nr_macrlc(void); diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 403602c109..8b326d58c9 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -115,6 +115,7 @@ typedef enum { #define GNB_CONFIG_STRING_REMOTE_S_PORTD "remote_s_portd" #define GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET "ssb_SubcarrierOffset" #define GNB_CONFIG_STRING_PDSCHANTENNAPORTS "pdsch_AntennaPorts" +#define GNB_CONFIG_STRING_PUSCHANTENNAPORTS "pusch_AntennaPorts" #define GNB_CONFIG_STRING_PUSCHTARGETPOWX10 "pusch_TargetSNRx10" #define GNB_CONFIG_STRING_PUCCHTARGETPOWX10 "pucch_TargetSNRx10" @@ -139,6 +140,7 @@ typedef enum { {GNB_CONFIG_STRING_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0, iptr:NULL, defintval:31, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_PDSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ +{GNB_CONFIG_STRING_PUSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_PUSCHTARGETPOWX10, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_PUCCHTARGETPOWX10, NULL, 0, iptr:NULL, defintval:200, TYPE_INT, 0}, \ } @@ -159,8 +161,9 @@ typedef enum { #define GNB_REMOTE_S_PORTD_IDX 13 #define GNB_SSB_SUBCARRIEROFFSET_IDX 14 #define GNB_PDSCH_ANTENNAPORTS_IDX 15 -#define GNB_PUSCH_TARGETPOW_X10_IDX 16 -#define GNB_PUCCH_TARGETPOW_X10_IDX 17 +#define GNB_PUSCH_ANTENNAPORTS_IDX 16 +#define GNB_PUSCH_TARGETPOW_X10_IDX 17 +#define GNB_PUCCH_TARGETPOW_X10_IDX 18 #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define GNBPARAMS_CHECK { \ diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c index 781347abaa..71f91a67ec 100644 --- a/openair2/LAYER2/MAC/config.c +++ b/openair2/LAYER2/MAC/config.c @@ -337,7 +337,8 @@ config_sib2(int Mod_idP, LTE_ARFCN_ValueEUTRA_t *ul_CArrierFreqP, long *ul_BandwidthP, LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmissionP, - struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigListP) { + struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigListP, + int dl_Bandwidth) { nfapi_config_request_t *cfg = &RC.mac[Mod_idP]->config[CC_idP]; cfg->subframe_config.pb.value = radioResourceConfigCommonP->pdsch_ConfigCommon.p_b; cfg->subframe_config.pb.tl.tag = NFAPI_SUBFRAME_CONFIG_PB_TAG; @@ -345,7 +346,7 @@ config_sib2(int Mod_idP, cfg->rf_config.reference_signal_power.value = radioResourceConfigCommonP->pdsch_ConfigCommon.referenceSignalPower; cfg->rf_config.reference_signal_power.tl.tag = NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG; cfg->num_tlv++; - cfg->nfapi_config.max_transmit_power.value = cfg->rf_config.reference_signal_power.value + power_off_dB[cfg->rf_config.dl_channel_bandwidth.value]; + cfg->nfapi_config.max_transmit_power.value = cfg->rf_config.reference_signal_power.value + power_off_dB[dl_Bandwidth]; cfg->nfapi_config.max_transmit_power.tl.tag = NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG; cfg->num_tlv++; cfg->prach_config.configuration_index.value = radioResourceConfigCommonP->prach_Config.prach_ConfigInfo.prach_ConfigIndex; @@ -870,7 +871,8 @@ int rrc_mac_config_req_eNB(module_id_t Mod_idP, config_sib2(Mod_idP, CC_idP, radioResourceConfigCommon, radioResourceConfigCommon_BR, NULL, ul_Bandwidth, additionalSpectrumEmission, - mbsfn_SubframeConfigList); + mbsfn_SubframeConfigList, + mib->message.dl_Bandwidth); } // mib != NULL if (mobilityControlInfo !=NULL) { diff --git a/openair2/LAYER2/MAC/config_ue.c b/openair2/LAYER2/MAC/config_ue.c index 1c5e706218..79202d87e3 100644 --- a/openair2/LAYER2/MAC/config_ue.c +++ b/openair2/LAYER2/MAC/config_ue.c @@ -85,10 +85,6 @@ void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index) { ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure } -int32_t **rxdata; -int32_t **txdata; - - int rrc_mac_config_req_ue(module_id_t Mod_idP, int CC_idP, diff --git a/openair2/LAYER2/MAC/defs_NB_IoT.h b/openair2/LAYER2/MAC/defs_NB_IoT.h index 517f01d1b9..78524e104d 100644 --- a/openair2/LAYER2/MAC/defs_NB_IoT.h +++ b/openair2/LAYER2/MAC/defs_NB_IoT.h @@ -537,9 +537,6 @@ typedef struct { // global variables -nprach_parameters_NB_IoT_t nprach_list[3]; -//DLSF Table -DLSF_INFO_t DLSF_information; #endif /*__LAYER2_MAC_DEFS_NB_IoT_H__ */ diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index ccbff6a5eb..4e063d2207 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -595,6 +595,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, CC_id = UE_PCCID(module_idP, UE_id); UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]); +/* to be merged with MAC_stats.log generation. probably redundant if (((frameP & 127) == 0) && (subframeP == 0)) { double total_bler; if(UE_scheduling_control->pusch_rx_num[CC_id] == 0 && UE_scheduling_control->pusch_rx_error_num[CC_id] == 0) { @@ -632,7 +633,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, UE_scheduling_control->aperiodic_ri_received[CC_id] ); } - +*/ RC.eNB[module_idP][CC_id]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP] = -63; if (UE_id == UE_info->list.head) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 3dea211dbc..8a400af1f3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -476,8 +476,8 @@ void generate_Msg2(module_id_t module_idP, first_rb = 0; vrb_map[first_rb] = 1; vrb_map[first_rb + 1] = 1; - vrb_map[first_rb + 2] = 1; - vrb_map[first_rb + 3] = 1; + //vrb_map[first_rb + 2] = 1; + //vrb_map[first_rb + 3] = 1; memset((void *) dl_config_pdu, 0, sizeof(nfapi_dl_config_request_pdu_t)); dl_config_pdu->pdu_type = NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE; dl_config_pdu->pdu_size = (uint8_t) (2 + sizeof(nfapi_dl_config_dci_dl_pdu)); @@ -488,12 +488,12 @@ void generate_Msg2(module_id_t module_idP, dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.rnti_type = 2; // RA-RNTI : see Table 4-10 from SCF082 - nFAPI specifications dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.transmission_power = 6000; // equal to RS power dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.harq_process = 0; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 1; // no TPC + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.tpc = 0; // no TPC dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.new_data_indicator_1 = 1; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = 0; + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.mcs_1 = 1; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.redundancy_version_1 = 0; dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.virtual_resource_block_assignment_flag = 0; - dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4); + dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 2); // This checks if the above DCI allocation is feasible in current subframe if (!CCE_allocation_infeasible(module_idP, CC_idP, 0, subframeP, @@ -512,7 +512,7 @@ void generate_Msg2(module_id_t module_idP, dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.rnti = ra->RA_rnti; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_allocation_type = 2; // format 1A/1B/1D dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.virtual_resource_block_assignment_flag = 0; // localized - dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 4); + dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.resource_block_coding = getRIV(N_RB_DL, first_rb, 2); dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.modulation = 2; //QPSK dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.redundancy_version = 0; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.transport_blocks = 1; // first block @@ -901,7 +901,7 @@ generate_Msg4(module_id_t module_idP, } // rach_resource_type > 0 else { // This is normal LTE case - LOG_I(MAC, "generate_Msg4 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP); + LOG_D(MAC, "generate_Msg4 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP); if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) { // Get RRCConnectionSetup for Piggyback @@ -918,7 +918,7 @@ generate_Msg4(module_id_t module_idP, module_idP, CC_idP, frameP, subframeP, UE_id, rrc_sdu_length); // AssertFatal(rrc_sdu_length > 0, // "[MAC][eNB Scheduler] CCCH not allocated, rrc_sdu_length: %d\n", rrc_sdu_length); - LOG_I(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n", + LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Generating Msg4 with RRC Piggyback (RNTI %x)\n", module_idP, CC_idP, frameP, subframeP, ra->rnti); /// Choose first 4 RBs for Msg4, should really check that these are free! first_rb = 0; @@ -1086,7 +1086,7 @@ generate_Msg4(module_id_t module_idP, } } // CCE Allocation feasible } else { - LOG_I(MAC, + LOG_D(MAC, "eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d: Delaying Msg4 for RRC Piggyback (RNTI %x)\n", module_idP, CC_idP, frameP, subframeP, ra->rnti); ra->Msg4_subframe ++; @@ -1289,8 +1289,8 @@ initiate_ra_proc(module_id_t module_idP, } LOG_D(MAC, - "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d Initiating RA procedure for preamble index %d\n", - module_idP, CC_id, frameP, subframeP, preamble_index); + "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d Initiating RA procedure for preamble index %d, timing offset %d\n", + module_idP, CC_id, frameP, subframeP, preamble_index, timing_offset); LOG_D(MAC, "[eNB %d][RAPROC] CC_id %d Frame %d, Subframe %d PRACH resource type %d\n", module_idP, CC_id, frameP, subframeP, rach_resource_type); @@ -1332,6 +1332,9 @@ initiate_ra_proc(module_id_t module_idP, abort(); case 1 : + case 3 : + case 4 : + case 5 : offset = 6; break; } diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index b516b04e03..596d978a98 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -651,7 +651,7 @@ schedule_ue_spec(module_id_t module_idP, eNB_UE_stats->rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); eNB_UE_stats->harq_pid = harq_pid; eNB_UE_stats->harq_round = round_DL; - + eNB_UE_stats->dlsch_rounds[round_DL&7]++; if (eNB_UE_stats->rrc_status < RRC_RECONFIGURED) { ue_sched_ctrl->uplane_inactivity_timer = 0; } @@ -792,7 +792,6 @@ schedule_ue_spec(module_id_t module_idP, // No TX request for retransmission (check if null request for FAPI) } - //eNB_UE_stats->dlsch_trials[round]++; eNB_UE_stats->num_retransmission += 1; eNB_UE_stats->rbs_used_retx = nb_rb; eNB_UE_stats->total_rbs_used_retx += nb_rb; @@ -1065,20 +1064,23 @@ schedule_ue_spec(module_id_t module_idP, ue_template->pucch_tpc_tx_frame = frameP; ue_template->pucch_tpc_tx_subframe = subframeP; - if (snr > target_snr + 4) { + if (snr > target_snr + PUCCH_PCHYST) { tpc = 0; //-1 - } else if (snr < target_snr - 4) { + ue_sched_ctrl->pucch_tpc_accumulated[CC_id]--; + } else if (snr < target_snr - PUCCH_PCHYST) { tpc = 2; //+1 + ue_sched_ctrl->pucch_tpc_accumulated[CC_id]--; } else { tpc = 1; //0 } - LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, snr/target snr %d/%d (normal case)\n", + LOG_D(MAC, "[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d (accumulated %d), snr/target snr %d/%d (normal case)\n", module_idP, frameP, subframeP, harq_pid, tpc, + ue_sched_ctrl->pucch_tpc_accumulated[CC_id], snr, target_snr); } // Po_PUCCH has been updated @@ -1700,9 +1702,9 @@ schedule_ue_spec_br(module_id_t module_idP, UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_frame = frameP; UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe = subframeP; - if (snr > target_snr + 4) { + if (snr > target_snr + PUCCH_PCHYST) { tpc = 0; //-1 - } else if (snr < target_snr - 4) { + } else if (snr < target_snr - PUCCH_PCHYST) { tpc = 2; //+1 } else { tpc = 1; //0 diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c index 23137b7887..e9f0b807c4 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -47,7 +47,7 @@ #include "OCG_extern.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "rlc.h" - +#include "common/utils/lte/prach_utils.h" #include "T.h" @@ -195,7 +195,7 @@ void dlsch_scheduler_pre_ue_select_fairRR( // Initialization for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - dlsch_ue_max_num[CC_id] = (uint16_t)RC.rrc[module_idP]->configuration.radioresourceconfig[CC_id].ue_multiple_max; + dlsch_ue_max_num[CC_id] = eNB->ue_multiple_max; // save origin DL PDU number DL_req = &eNB->DL_req[CC_id].dl_config_request_body; saved_dlsch_dci[CC_id] = DL_req->number_pdu; @@ -1044,48 +1044,6 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, } } -#ifdef TM5 - - // This has to be revisited!!!! - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - i1 = 0; - i2 = 0; - i3 = 0; - - for (j = 0; j < N_RBG[CC_id]; j++) { - if (MIMO_mode_indicator[CC_id][j] == 2) { - i1 = i1 + 1; - } else if (MIMO_mode_indicator[CC_id][j] == 1) { - i2 = i2 + 1; - } else if (MIMO_mode_indicator[CC_id][j] == 0) { - i3 = i3 + 1; - } - } - - if ((i1 < N_RBG[CC_id]) && (i2 > 0) && (i3 == 0)) { - PHY_vars_eNB_g[Mod_id][CC_id]->check_for_SUMIMO_transmissions = - PHY_vars_eNB_g[Mod_id][CC_id]-> - check_for_SUMIMO_transmissions + 1; - } - - if (i3 == N_RBG[CC_id] && i1 == 0 && i2 == 0) { - PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions = - PHY_vars_eNB_g[Mod_id][CC_id]->FULL_MUMIMO_transmissions + - 1; - } - - if((i1 < N_RBG[CC_id]) && (i3 > 0)) { - PHY_vars_eNB_g[Mod_id][CC_id]-> - check_for_MUMIMO_transmissions + 1; - } - - PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions = - PHY_vars_eNB_g[Mod_id][CC_id]->check_for_total_transmissions + - 1; - } - -#endif - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) { if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2) { @@ -1154,7 +1112,6 @@ schedule_ue_spec_fairRR(module_id_t module_idP, // int continue_flag = 0; int32_t snr, target_snr; int32_t tpc = 1; - static int32_t tpc_accumulated = 0; UE_sched_ctrl_t *ue_sched_ctl; int mcs; int i; @@ -1540,7 +1497,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, subframeP, S_DL_SCHEDULED, rnti); - //eNB_UE_stats->dlsch_trials[round]++; + UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[round]++; UE_info->eNB_UE_stats[CC_id][UE_id].num_retransmission += 1; UE_info->eNB_UE_stats[CC_id][UE_id].rbs_used_retx = nb_rb; UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used_retx += nb_rb; @@ -1982,6 +1939,7 @@ schedule_ue_spec_fairRR(module_id_t module_idP, // store stats eNB->eNB_stats[CC_id].dlsch_bytes_tx+=sdu_length_total; eNB->eNB_stats[CC_id].dlsch_pdus_tx+=1; + UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[0]++; UE_info->eNB_UE_stats[CC_id][UE_id].rbs_used = nb_rb; UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used += nb_rb; UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_mcs1=eNB_UE_stats->dlsch_mcs1; @@ -2015,19 +1973,19 @@ schedule_ue_spec_fairRR(module_id_t module_idP, UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_frame=frameP; UE_info->UE_template[CC_id][UE_id].pucch_tpc_tx_subframe=subframeP; - if (snr > target_snr + 4) { + if (snr > target_snr + PUCCH_PCHYST) { tpc = 0; //-1 - tpc_accumulated--; - } else if (snr < target_snr - 4) { + ue_sched_ctl->pucch_tpc_accumulated[CC_id]--; + } else if (snr < target_snr - PUCCH_PCHYST) { tpc = 2; //+1 - tpc_accumulated++; + ue_sched_ctl->pucch_tpc_accumulated[CC_id]++; } else { tpc = 1; //0 } LOG_D(MAC,"[eNB %d] DLSCH scheduler: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n", module_idP,frameP, subframeP,harq_pid,tpc, - tpc_accumulated,snr,target_snr); + ue_sched_ctl->pucch_tpc_accumulated[CC_id],snr,target_snr); } // Po_PUCCH has been updated else { tpc = 1; //0 @@ -2245,7 +2203,6 @@ void ulsch_scheduler_pre_ue_select_fairRR( uint8_t first_ue_id[MAX_NUM_CCs][20]; uint8_t ul_inactivity_num[MAX_NUM_CCs]; uint8_t ul_inactivity_id[MAX_NUM_CCs][20]={{0}}; - // LTE_DL_FRAME_PARMS *frame_parms; uint8_t ulsch_ue_max_num[MAX_NUM_CCs]; uint16_t saved_ulsch_dci[MAX_NUM_CCs]; rnti_t rnti; @@ -2263,7 +2220,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( //save ulsch dci number saved_ulsch_dci[CC_id] = eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body.number_of_dci; // maximum multiplicity number - ulsch_ue_max_num[CC_id] =RC.rrc[module_idP]->configuration.radioresourceconfig[CC_id].ue_multiple_max; + ulsch_ue_max_num[CC_id] =eNB->ue_multiple_max; cc_id_flag[CC_id] = 0; ue_first_num[CC_id] = 0; ul_inactivity_num[CC_id] = 0; @@ -2290,6 +2247,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( // UL DCI HI_DCI0_req = &eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; + if ( (ulsch_ue_select[CC_id].ue_num >= ulsch_ue_max_num[CC_id]) || (cc_id_flag[CC_id] == 1) ) { cc_id_flag[CC_id] = 1; HI_DCI0_req->number_of_dci = saved_ulsch_dci[CC_id]; @@ -2322,6 +2280,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( //round round = UE_info->UE_sched_ctrl[UE_id].round_UL[CC_id][harq_pid]; + if ( round > 0 ) { hi_dci0_pdu = &HI_DCI0_req->hi_dci0_pdu_list[HI_DCI0_req->number_of_dci+HI_DCI0_req->number_of_hi]; format_flag = 2; @@ -2352,6 +2311,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( UE_info->UE_template[CC_id][UE_id].scheduled_ul_bytes = 0; } + if ( UE_id > last_ulsch_ue_id[CC_id] && ((ulsch_ue_select[CC_id].ue_num+ue_first_num[CC_id]) < ulsch_ue_max_num[CC_id]) ) { if ( bytes_to_schedule > 0 ) { first_ue_id[CC_id][ue_first_num[CC_id]]= UE_id; @@ -2369,9 +2329,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( UE_sched_ctl = &UE_info->UE_sched_ctrl[UE_id]; rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); - - if ( ((UE_sched_ctl->ul_inactivity_timer>64)&&(UE_sched_ctl->ul_scheduled==0)) || - ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) || + if ( ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) || ((UE_sched_ctl->cqi_req_timer>64)&&((rrc_status >= RRC_CONNECTED))) ) { first_ue_id[CC_id][ue_first_num[CC_id]]= UE_id; first_ue_total[CC_id] [ue_first_num[CC_id]] = 0; @@ -2482,6 +2440,7 @@ void ulsch_scheduler_pre_ue_select_fairRR( } rrc_status = mac_eNB_get_rrc_status(module_idP, rnti); + if ( (bytes_to_schedule > 0) || (UE_info->UE_template[CC_id][UE_id].ul_SR > 0) || ((UE_sched_ctl->ul_inactivity_timer>64)&&(UE_sched_ctl->ul_scheduled==0)) || ((UE_sched_ctl->ul_inactivity_timer>10)&&(UE_sched_ctl->ul_scheduled==0)&&(rrc_status < RRC_CONNECTED)) || @@ -2595,7 +2554,6 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, eNB_MAC_INST *eNB = RC.mac[module_idP]; UE_info_t *UE_info= &eNB->UE_info; UE_TEMPLATE *UE_template = NULL; - LTE_DL_FRAME_PARMS *frame_parms = NULL; uint8_t ue_num_temp; uint8_t total_rbs=0; uint8_t average_rbs; @@ -2617,18 +2575,17 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, // MCS and RB assgin for ( CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++ ) { cc = &RC.mac[module_idP]->common_channels[CC_id]; - frame_parms = &(RC.eNB[module_idP][CC_id]->frame_parms); - + int N_RB_UL = to_prb(cc->ul_Bandwidth); if (cc->tdd_Config) { //TDD - if (frame_parms->N_RB_UL == 25) { + if (N_RB_UL == 25) { num_pucch_rb = 1; - } else if (frame_parms->N_RB_UL == 50) { + } else if (N_RB_UL == 50) { num_pucch_rb = 2; } else { num_pucch_rb = 3; } } else {//FDD - if (frame_parms->N_RB_UL == 25) { + if (N_RB_UL == 25) { num_pucch_rb = 1; } else { num_pucch_rb = 2; @@ -2653,13 +2610,13 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, continue; } - if (first_rb[CC_id] >= frame_parms->N_RB_UL-num_pucch_rb ) { + if (first_rb[CC_id] >= N_RB_UL-num_pucch_rb ) { LOG_W(MAC,"[eNB %d] frame %d subframe %d, UE %d/%x CC %d: dropping, not enough RBs\n", module_idP,frameP,subframeP,UE_id,UE_RNTI(CC_id,UE_id),CC_id); break; } - total_rbs = frame_parms->N_RB_UL-num_pucch_rb-first_rb[CC_id]; + total_rbs = N_RB_UL-num_pucch_rb-first_rb[CC_id]; average_rbs = (int)round((double)total_rbs/(double)ue_num_temp); if ( average_rbs < 3 ) { @@ -2727,19 +2684,20 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_info->UE_sched_ctrl[UE_id].pusch_rx_num_old[CC_id] = UE_info->UE_sched_ctrl[UE_id].pusch_rx_num[CC_id]; UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num_old[CC_id] = UE_info->UE_sched_ctrl[UE_id].pusch_rx_error_num[CC_id]; - if(bler < 0.5) { - if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] !=0) { - UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]--; + if (eNB->use_mcs_offset == 1) { + if(bler < eNB->bler_lower) { + if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] !=0) { + UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]--; + } } - } - if(bler >= 2) { - UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]++; - if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] >= 20) { - UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]=20; + if(bler >= eNB->bler_upper) { + UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]++; + if(UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id] >= 20) { + UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]=20; + } } } } - snr = UE_info->UE_sched_ctrl[UE_id].pusch_snr_avg[CC_id]; mcs = 20 - UE_info->UE_sched_ctrl[UE_id].mcs_offset[CC_id]; @@ -2758,15 +2716,20 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ul_total_buffer > 0 ) { rb_table_index = 2; tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); - tx_power = (int8_t)(hundred_times_log10_NPRB[rb_table[rb_table_index] - 1] / 100); + tx_power= estimate_ue_tx_power(0,tbs*8,rb_table[rb_table_index],0,cc->Ncp,0); - while ( (tbs < bytes_to_schedule) && (rb_table[rb_table_index]<(frame_parms->N_RB_UL-num_pucch_rb-first_rb[CC_id])) && - ((UE_template->phr_info - tx_power) > 0) && (rb_table_index < 32 )) { - rb_table_index++; + while ( (((UE_template->phr_info - tx_power) < 0 ) || (tbs > bytes_to_schedule)) && (mcs > 3) ) { + mcs--; tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); - tx_power = (int8_t)(hundred_times_log10_NPRB[rb_table[rb_table_index] - 1] / 100); + tx_power= estimate_ue_tx_power(0,tbs*8,rb_table[rb_table_index],0,cc->Ncp,0); } + while ( (tbs < bytes_to_schedule) && (rb_table[rb_table_index]<(N_RB_UL-num_pucch_rb-first_rb[CC_id])) && + ((UE_template->phr_info - tx_power) > 0) && (rb_table_index < eNB->max_ul_rb_index )) { + rb_table_index++; + tbs = get_TBS_UL(mcs,rb_table[rb_table_index]); + tx_power= estimate_ue_tx_power(0,tbs*8,rb_table[rb_table_index],0,cc->Ncp,0); + } if ( rb_table[rb_table_index]<3 ) { rb_table_index=2; } @@ -2807,11 +2770,12 @@ void ulsch_scheduler_pre_processor_fairRR(module_id_t module_idP, UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10; } else { // assigne RBS( 3 RBs) +/* first_rb[CC_id] = first_rb[CC_id] + 3; UE_info->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul = 3; UE_info->UE_template[CC_id][UE_id].pre_allocated_rb_table_index_ul = 2; - UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10; - } + UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul = 10; +*/ } } } else if ( ulsch_ue_select[CC_id].list[ulsch_ue_num].ue_priority == SCH_UL_INACTIVE ) { // assigne RBS( 3 RBs) @@ -2913,12 +2877,10 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP, ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]; memset(ulsch_ue_select, 0, sizeof(ulsch_ue_select)); - LTE_DL_FRAME_PARMS *frame_parms ; for (CC_id=0; CC_idcommon_channels[CC_id]; - frame_parms= &RC.eNB[module_idP][CC_id]->frame_parms; - + int N_RB_UL=to_prb(cc->ul_Bandwidth); // output of scheduling, the UE numbers in RBs, where it is in the code??? // check if RA (Msg3) is active in this subframeP, if so skip the PRBs used for Msg3 // Msg3 is using 1 PRB so we need to increase first_rb accordingly @@ -2928,13 +2890,13 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP, ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_MSG3; if (cc->tdd_Config == NULL) { - if(frame_parms->N_RB_UL == 25) { + if(N_RB_UL == 25) { ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1; } else { ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 2; } } else { - switch(frame_parms->N_RB_UL) { + switch(N_RB_UL) { case 25: default: ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = 1; @@ -2958,14 +2920,18 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP, } //PRACH - if (is_prach_subframe(frame_parms,sched_frame,sched_subframe)==1) { + if (is_prach_subframe0(cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,cc->tdd_Config!=NULL ? 1 : 0, + cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex, + sched_frame,sched_subframe)==1) { ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_PRACH; - ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = get_prach_prb_offset( - frame_parms, - frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, - frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset, - 0,//tdd_mapindex - frameP); //Nf --> shouldn't it be sched_frame ??? + ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = + get_prach_prb_offset(cc->tdd_Config!=NULL ? 1 : 0, + cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0, + to_prb(cc->ul_Bandwidth), + cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex, + cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset, + 0, + sched_frame); ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].nb_rb = 6; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].UE_id = -1; ulsch_ue_select[CC_id].ue_num++; @@ -2993,7 +2959,6 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, uint32_t cqi_req,cshift,ndi,tpc; int32_t snr; int32_t target_snr=0; - static int32_t tpc_accumulated=0; int CC_id,ulsch_ue_num; int N_RB_UL; eNB_MAC_INST *eNB = RC.mac[module_idP]; @@ -3012,7 +2977,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; nfapi_ul_config_request_body_t *ul_req_tmp; nfapi_ul_config_ulsch_harq_information *ulsch_harq_information; - LOG_D(MAC,"entering ulsch preprocesor\n"); + LOG_D(MAC,"entering ulsch preprocesor for %d.%d\n",sched_frame,sched_subframeP); ulsch_scheduler_pre_processor_fairRR(module_idP, frameP, subframeP, @@ -3185,12 +3150,12 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, UE_template->pusch_tpc_tx_frame=frameP; UE_template->pusch_tpc_tx_subframe=subframeP; - if (snr > target_snr + 4) { + if (snr > target_snr + PUSCH_PCHYST) { tpc = 0; //-1 - tpc_accumulated--; - } else if (snr < target_snr - 4) { + UE_sched_ctrl->pusch_tpc_accumulated[CC_id]--; + } else if (snr < target_snr - PUSCH_PCHYST) { tpc = 2; //+1 - tpc_accumulated++; + UE_sched_ctrl->pusch_tpc_accumulated[CC_id]++; } else { tpc = 1; //0 } @@ -3201,7 +3166,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, if (tpc!=1) { LOG_D(MAC,"[eNB %d] ULSCH schedulerRR: frame %d, subframe %d, harq_pid %d, tpc %d, accumulated %d, snr/target snr %d/%d\n", module_idP,frameP,subframeP,harq_pid,tpc, - tpc_accumulated,snr,target_snr); + UE_sched_ctrl->pusch_tpc_accumulated[CC_id],snr,target_snr); } // new transmission @@ -3214,6 +3179,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, UE_sched_ctrl->cqi_req_timer); ndi = 1-UE_template->oldNDI_UL[harq_pid]; UE_template->oldNDI_UL[harq_pid]=ndi; + UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[0]++; UE_info->eNB_UE_stats[CC_id][UE_id].snr = snr; UE_info->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr; UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_mcs1=UE_template->pre_assigned_mcs_ul; @@ -3402,6 +3368,7 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, T_INT(round)); UE_info->eNB_UE_stats[CC_id][UE_id].snr = snr; UE_info->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr; + uint8_t mcs_rv = 0; if(rvidx_tab[round&3]==1) { diff --git a/openair2/LAYER2/MAC/eNB_scheduler_mch.c b/openair2/LAYER2/MAC/eNB_scheduler_mch.c index f3a77ed703..1272b16ec0 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_mch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_mch.c @@ -84,7 +84,7 @@ get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, static uint32_t bytes_in_buffer=0; static uint32_t msi_pmch_stop=0; -uint16_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; +rb_id_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; static uint32_t msi_sfs=0; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index 47c27798bf..c83cc1d9d3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -57,7 +57,7 @@ #include "flexran_agent_mac.h" #include #include - +#include "common/utils/lte/prach_utils.h" #include "T.h" @@ -144,16 +144,18 @@ rx_sdu(const module_id_t enb_mod_idP, if (UE_id != -1) { UE_scheduling_control = &UE_info->UE_sched_ctrl[UE_id]; UE_template_ptr = &UE_info->UE_template[CC_idP][UE_id]; - LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d\n", + LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d Received ULSCH (%s) sdu round %d from PHY (rnti %x, UE_id %d) ul_cqi %d, timing_advance %d\n", enb_mod_idP, harq_pid, CC_idP, frameP, subframeP, + sduP==NULL ? "in error" : "OK", UE_scheduling_control->round_UL[CC_idP][harq_pid], current_rnti, UE_id, - ul_cqi); + ul_cqi, + timing_advance); AssertFatal(UE_scheduling_control->round_UL[CC_idP][harq_pid] < 8, "round >= 8\n"); if (sduP != NULL) { @@ -219,7 +221,7 @@ rx_sdu(const module_id_t enb_mod_idP, if (UE_scheduling_control->round_UL[CC_idP][harq_pid] == 3) { UE_scheduling_control->ul_scheduled &= (~(1 << harq_pid)); UE_scheduling_control->round_UL[CC_idP][harq_pid] = 0; - + UE_info->eNB_UE_stats[CC_idP][UE_id].ulsch_errors++; if (UE_scheduling_control->ul_consecutive_errors++ == 10) { UE_scheduling_control->ul_failure_timer = 1; } @@ -236,6 +238,7 @@ rx_sdu(const module_id_t enb_mod_idP, } } else { UE_scheduling_control->round_UL[CC_idP][harq_pid]++; + UE_info->eNB_UE_stats[CC_idP][UE_id].ulsch_rounds[UE_scheduling_control->round_UL[CC_idP][harq_pid]]++; } /* CDRX UL HARQ timers */ @@ -287,14 +290,17 @@ rx_sdu(const module_id_t enb_mod_idP, AssertFatal(mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx > 1, "maxHARQ %d should be greater than 1\n", (int) mac->common_channels[CC_idP].radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx); - LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d [RAPROC Msg3] Received ULSCH sdu round %d from PHY (rnti %x, RA_id %d) ul_cqi %d\n", + LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d [RAPROC Msg3] Received ULSCH sdu (%s) round %d from PHY (rnti %x, RA_id %d) ul_cqi %d, timing advance %d\n", enb_mod_idP, harq_pid, CC_idP, + sduP!=NULL ? "OK" : "in error", ra->msg3_round, current_rnti, RA_id, - ul_cqi); + ul_cqi, + timing_advance); + first_rb = ra->msg3_first_rb; if (sduP == NULL) { // we've got an error on Msg3 @@ -403,7 +409,8 @@ rx_sdu(const module_id_t enb_mod_idP, switch (rx_ces[i]) { // implement and process PHR + CRNTI + BSR case POWER_HEADROOM: if (UE_id != -1) { - UE_template_ptr->phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET + (int8_t)(hundred_times_log10_NPRB[UE_template_ptr->nb_rb_ul[harq_pid] - 1] / 100); + /*UE_template_ptr->phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET + (int8_t)(hundred_times_log10_NPRB[UE_template_ptr->nb_rb_ul[harq_pid] - 1] / 100);i*/ + UE_template_ptr->phr_info = (payload_ptr[0] & 0x3f) - PHR_MAPPING_OFFSET + estimate_ue_tx_power(0,sdu_lenP*8,UE_template_ptr->nb_rb_ul[harq_pid],0,mac->common_channels[CC_idP].Ncp,0); if (UE_template_ptr->phr_info > 40) { UE_template_ptr->phr_info = 40; @@ -424,7 +431,7 @@ rx_sdu(const module_id_t enb_mod_idP, case CRNTI: old_rnti = (((uint16_t) payload_ptr[0]) << 8) + payload_ptr[1]; old_UE_id = find_UE_id(enb_mod_idP, old_rnti); - LOG_D(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n", + LOG_I(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d MAC CE_LCID %d (ce %d/%d): CRNTI %x (UE_id %d) in Msg3\n", enb_mod_idP, frameP, subframeP, @@ -438,7 +445,7 @@ rx_sdu(const module_id_t enb_mod_idP, /* Receiving CRNTI means that the current rnti has to go away */ if (old_UE_id != -1) { if (mac_eNB_get_rrc_status(enb_mod_idP,old_rnti) == RRC_HO_EXECUTION) { - LOG_I(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) Handover case\n", + LOG_D(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) Handover case\n", enb_mod_idP, frameP, subframeP, @@ -1293,16 +1300,19 @@ schedule_ulsch(module_id_t module_idP, /* Note: RC.nb_mac_CC[module_idP] should be lower than or equal to NFAPI_CC_MAX */ for (int CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++, cc++) { - LTE_DL_FRAME_PARMS *frame_parms = &RC.eNB[module_idP][CC_id]->frame_parms; - if (is_prach_subframe(frame_parms, sched_frame, sched_subframe)) { - int start_rb = get_prach_prb_offset( - frame_parms, - frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex, - frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset, - 0, // tdd_mapindex - sched_frame); // Nf + + if (is_prach_subframe0(cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,cc->tdd_Config!=NULL ? 1 : 0, + cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex, + sched_frame, sched_subframe)) { + int start_rb = get_prach_prb_offset(cc->tdd_Config!=NULL ? 1 : 0, + cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0, + to_prb(cc->ul_Bandwidth), + cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex, + cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset, + 0, // tdd_mapindex + sched_frame); // Nf for (int i = 0; i < 6; i++) - cc[CC_id].vrb_map_UL[start_rb + i] = 1; + cc->vrb_map_UL[start_rb + i] = 1; } /* HACK: let's remove the PUCCH from available RBs @@ -1314,24 +1324,24 @@ schedule_ulsch(module_id_t module_idP, */ switch (to_prb(cc[CC_id].ul_Bandwidth)) { case 25: - cc[CC_id].vrb_map_UL[0] = 1; - cc[CC_id].vrb_map_UL[24] = 1; + cc->vrb_map_UL[0] = 1; + cc->vrb_map_UL[24] = 1; break; case 50: - cc[CC_id].vrb_map_UL[0] = 1; - cc[CC_id].vrb_map_UL[1] = 1; - cc[CC_id].vrb_map_UL[48] = 1; - cc[CC_id].vrb_map_UL[49] = 1; + cc->vrb_map_UL[0] = 1; + cc->vrb_map_UL[1] = 1; + cc->vrb_map_UL[48] = 1; + cc->vrb_map_UL[49] = 1; break; case 100: - cc[CC_id].vrb_map_UL[0] = 1; - cc[CC_id].vrb_map_UL[1] = 1; - cc[CC_id].vrb_map_UL[2] = 1; - cc[CC_id].vrb_map_UL[97] = 1; - cc[CC_id].vrb_map_UL[98] = 1; - cc[CC_id].vrb_map_UL[99] = 1; + cc->vrb_map_UL[0] = 1; + cc->vrb_map_UL[1] = 1; + cc->vrb_map_UL[2] = 1; + cc->vrb_map_UL[97] = 1; + cc->vrb_map_UL[98] = 1; + cc->vrb_map_UL[99] = 1; break; default: @@ -1349,6 +1359,8 @@ schedule_ulsch(module_id_t module_idP, /* * Schedule the DCI0 for ULSCH */ + + void schedule_ulsch_rnti(module_id_t module_idP, int CC_id, @@ -1356,7 +1368,6 @@ schedule_ulsch_rnti(module_id_t module_idP, sub_frame_t subframeP, unsigned char sched_subframeP) { /* TODO: does this need to be static? */ - static int32_t tpc_accumulated = 0; /* values from 0 to 7 can be used for mapping the cyclic shift * (36.211 , Table 5.5.2.1.1-1) */ const uint32_t cshift = 0; @@ -1481,8 +1492,7 @@ schedule_ulsch_rnti(module_id_t module_idP, /* Power control */ /* * Compute the expected ULSCH RX snr (for the stats) - * This is the normalized RX snr and this should be constant (regardless - * of mcs) Is not in dBm, unit from nfapi, converting to dBm + * */ const int32_t snr = UE_sched_ctrl_ptr->pusch_snr[CC_id]; const int32_t target_snr = mac->puSch10xSnr / 10; @@ -1501,12 +1511,12 @@ schedule_ulsch_rnti(module_id_t module_idP, UE_template_ptr->pusch_tpc_tx_frame = frameP; UE_template_ptr->pusch_tpc_tx_subframe = subframeP; - if (snr > target_snr + 4) { + if (snr > target_snr + PUSCH_PCHYST) { tpc = 0; // -1 - tpc_accumulated--; - } else if (snr < target_snr - 4) { + UE_sched_ctrl_ptr->pusch_tpc_accumulated[CC_id]--; + } else if (snr < target_snr - PUSCH_PCHYST) { tpc = 2; // +1 - tpc_accumulated++; + UE_sched_ctrl_ptr->pusch_tpc_accumulated[CC_id]++; } } if (tpc != 1) { @@ -1518,7 +1528,7 @@ schedule_ulsch_rnti(module_id_t module_idP, subframeP, harq_pid, tpc, - tpc_accumulated, + UE_sched_ctrl_ptr->pusch_tpc_accumulated[CC_id], snr, target_snr); } @@ -1572,6 +1582,7 @@ schedule_ulsch_rnti(module_id_t module_idP, const uint8_t ndi = 1 - UE_template_ptr->oldNDI_UL[harq_pid]; // NDI: new data indicator const uint8_t mcs = UE_template_ptr->pre_assigned_mcs_ul; UE_template_ptr->oldNDI_UL[harq_pid] = ndi; + UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[0]++; UE_info->eNB_UE_stats[CC_id][UE_id].snr = snr; UE_info->eNB_UE_stats[CC_id][UE_id].target_snr = target_snr; UE_template_ptr->mcs_UL[harq_pid] = mcs; @@ -1593,8 +1604,6 @@ schedule_ulsch_rnti(module_id_t module_idP, UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_mcs2 = mcs; - while (rb_table[rb_table_index] > 45 && rb_table_index > 0) - rb_table_index--; UE_template_ptr->TBS_UL[harq_pid] = get_TBS_UL(mcs, rb_table[rb_table_index]); UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used_rx += rb_table[rb_table_index]; @@ -2080,10 +2089,10 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP, if (snr > target_snr + 4) { tpc = 0; //-1 - UE_sched_ctrl->tpc_accumulated[CC_id]--; + UE_sched_ctrl->pusch_tpc_accumulated[CC_id]--; } else if (snr < target_snr - 4) { tpc = 2; //+1 - UE_sched_ctrl->tpc_accumulated[CC_id]++; + UE_sched_ctrl->pusch_tpc_accumulated[CC_id]++; } else { tpc = 1; //0 } @@ -2098,7 +2107,7 @@ void schedule_ulsch_rnti_emtc(module_id_t module_idP, subframeP, harq_pid, tpc, - UE_sched_ctrl->tpc_accumulated[CC_id], + UE_sched_ctrl->pusch_tpc_accumulated[CC_id], snr, target_snr); } diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index ae8522bc83..062f613526 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -83,7 +83,7 @@ #define MAX_MAC_INST 16 #define BCCH_PAYLOAD_SIZE_MAX 128 -#define CCCH_PAYLOAD_SIZE_MAX 128 +#define CCCH_PAYLOAD_SIZE_MAX 512 #define PCCH_PAYLOAD_SIZE_MAX 128 #define RAR_PAYLOAD_SIZE_MAX 128 @@ -143,7 +143,10 @@ #define MAX_SUPPORTED_BW 4 /*!\brief CQI values range from 1 to 15 (4 bits) */ #define CQI_VALUE_RANGE 16 - +/*!\brief Hysteresis of PUSCH power control loop */ +#define PUSCH_PCHYST 1 +/*!\brief Hysteresis of PUCCH power control loop */ +#define PUCCH_PCHYST 1 /*!\brief value for indicating BSR Timer is not running */ #define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) @@ -615,6 +618,8 @@ typedef struct { // here for RX // + + uint32_t ulsch_rounds[4]; uint32_t ulsch_bitrate; // uint32_t ulsch_bytes_rx; @@ -684,6 +689,17 @@ typedef struct { // Length of SDU Got from LC DL uint32_t sdu_length_tx[NB_RB_MAX]; + int lc_bytes_tx[64]; + int dlsch_rounds[8]; + int dlsch_errors; + int dlsch_total_bytes; + + int lc_bytes_rx[64]; + int ulsch_rounds[8]; + int ulsch_errors; + int ulsch_total_bytes_scheduled; + int ulsch_total_bytes_rx; + /// overall // @@ -776,7 +792,6 @@ typedef struct { uint32_t num_mac_sdu_rx; // Length of SDU Got from LC UL - Size array can be refined uint32_t sdu_length_rx[NB_RB_MAX]; - } eNB_UE_STATS; /*! \brief eNB template for UE context information */ @@ -982,7 +997,8 @@ typedef struct { uint16_t feedback_cnt[NFAPI_CC_MAX]; uint16_t timing_advance; uint16_t timing_advance_r9; - uint8_t tpc_accumulated[NFAPI_CC_MAX]; + int8_t pusch_tpc_accumulated[NFAPI_CC_MAX]; + int8_t pucch_tpc_accumulated[NFAPI_CC_MAX]; uint8_t periodic_wideband_cqi[NFAPI_CC_MAX]; uint8_t periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX]; uint8_t periodic_wideband_pmi[NFAPI_CC_MAX]; @@ -1342,6 +1358,7 @@ typedef struct { uint8_t FeMBMS_flag; } COMMON_channels_t; /*! \brief top level eNB MAC structure */ + typedef struct eNB_MAC_INST_s { /// Ethernet parameters for northbound midhaul interface eth_params_t eth_params_n; @@ -1435,6 +1452,17 @@ typedef struct eNB_MAC_INST_s { int32_t puSch10xSnr; int32_t puCch10xSnr; + + int max_ul_rb_index; + + int ue_multiple_max; + + int use_mcs_offset; + + double bler_lower; + + double bler_upper; + pthread_t mac_stats_thread; } eNB_MAC_INST; /* diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h index cee6066a9e..cbca693b2a 100644 --- a/openair2/LAYER2/MAC/mac_extern.h +++ b/openair2/LAYER2/MAC/mac_extern.h @@ -65,6 +65,7 @@ extern const int cqi_to_mcs[16]; extern uint32_t RRC_CONNECTION_FLAG; extern uint8_t rb_table[34]; +extern rb_id_t mbms_rab_id; #if defined(PRE_SCD_THREAD) @@ -77,4 +78,8 @@ extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; extern mac_rlc_am_muilist_t rlc_am_mui; extern SCHEDULER_MODES global_scheduler_mode; + +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; +extern rb_id_t mbms_rab_id; #endif //DEF_H diff --git a/openair2/LAYER2/MAC/main.c b/openair2/LAYER2/MAC/main.c index 59554425cc..a4e924c68b 100644 --- a/openair2/LAYER2/MAC/main.c +++ b/openair2/LAYER2/MAC/main.c @@ -40,8 +40,84 @@ #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "common/ran_context.h" #include "intertask_interface.h" +#include extern RAN_CONTEXT_t RC; +extern int oai_exit; + +void *mac_stats_thread(void *param) { + eNB_MAC_INST *mac = (eNB_MAC_INST *)param; + FILE *fd; + UE_info_t *UE_info = &(mac->UE_info); + + while (!oai_exit) { + sleep(1); + fd=fopen("MAC_stats.log","w+"); + AssertFatal(fd!=NULL,"Cannot open MAC_stats.log\n"); + + for (int UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) { + if (UE_info->active[UE_id]) { + int rnti = UE_RNTI(mac->Mod_id, UE_id); + int CC_id = UE_PCCID(mac->Mod_id, UE_id); + UE_sched_ctrl_t *UE_scheduling_control = &(UE_info->UE_sched_ctrl[UE_id]); + + double total_bler; + if(UE_scheduling_control->pusch_rx_num[CC_id] == 0 && UE_scheduling_control->pusch_rx_error_num[CC_id] == 0) { + total_bler = 0; + } + else { + total_bler = (double)UE_scheduling_control->pusch_rx_error_num[CC_id] / (double)(UE_scheduling_control->pusch_rx_error_num[CC_id] + UE_scheduling_control->pusch_rx_num[CC_id]) * 100; + } + fprintf(fd,"MAC UE rnti %x : %s, PHR %d DLCQI %d PUSCH %d PUCCH %d RLC disc %d UL-stat rcv %lu err %lu bler %lf (%lf/%lf) total_bler %lf mcsoff %d pre_allocated nb_rb %d, mcs %d, bsr %u sched %u tbs %lu cnt %u , DL-stat tbs %lu cnt %u rb %u buf %u 1st %u ret %u ri %d\n", + rnti, + UE_scheduling_control->ul_out_of_sync == 0 ? "in synch" : "out of sync", + UE_info->UE_template[CC_id][UE_id].phr_info, + UE_scheduling_control->dl_cqi[CC_id], + UE_scheduling_control->pusch_snr/*_avg*/[CC_id], + UE_scheduling_control->pucch1_snr[CC_id], + UE_scheduling_control->rlc_out_of_resources_cnt, + UE_scheduling_control->pusch_rx_num[CC_id], + UE_scheduling_control->pusch_rx_error_num[CC_id], + UE_scheduling_control->pusch_bler[CC_id], + mac->bler_lower,mac->bler_upper,total_bler, + UE_scheduling_control->mcs_offset[CC_id], + UE_info->UE_template[CC_id][UE_id].pre_allocated_nb_rb_ul, + UE_info->UE_template[CC_id][UE_id].pre_assigned_mcs_ul, + UE_info->UE_template[CC_id][UE_id].estimated_ul_buffer, + UE_info->UE_template[CC_id][UE_id].scheduled_ul_bytes, + UE_info->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes_rx, + UE_info->eNB_UE_stats[CC_id][UE_id].total_num_pdus_rx, + UE_info->eNB_UE_stats[CC_id][UE_id].total_pdu_bytes, + UE_info->eNB_UE_stats[CC_id][UE_id].total_num_pdus, + UE_info->eNB_UE_stats[CC_id][UE_id].total_rbs_used, +#if defined(PRE_SCD_THREAD) + UE_info->UE_template[CC_id][UE_id].dl_buffer_total, +#else + 0, +#endif + UE_scheduling_control->first_cnt[CC_id], + UE_scheduling_control->ret_cnt[CC_id], + UE_scheduling_control->aperiodic_ri_received[CC_id] + ); + fprintf(fd," ULSCH rounds %d/%d/%d/%d, DLSCH rounds %d/%d/%d/%d, ULSCH errors %d, DLSCH errors %d\n", + UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[0], + UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[1], + UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[2], + UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_rounds[3], + UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[0], + UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[1], + UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[2], + UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_rounds[3], + UE_info->eNB_UE_stats[CC_id][UE_id].ulsch_errors, + UE_info->eNB_UE_stats[CC_id][UE_id].dlsch_errors); + + + } + } + fclose(fd); + } + return(NULL); +} void init_UE_info(UE_info_t *UE_info) { @@ -128,6 +204,9 @@ void mac_top_init_eNB(void) pdcp_layer_init(); rrc_init_global_param(); + + for (i=0;imac_stats_thread,NULL,mac_stats_thread,(void*)mac[i]); + } void mac_init_cell_params(int Mod_idP, int CC_idP) diff --git a/openair2/LAYER2/MAC/pre_processor.c b/openair2/LAYER2/MAC/pre_processor.c index bf8202f622..bb892c7efe 100644 --- a/openair2/LAYER2/MAC/pre_processor.c +++ b/openair2/LAYER2/MAC/pre_processor.c @@ -730,13 +730,13 @@ void calculate_max_mcs_min_rb(module_id_t mod_id, int tbs = get_TBS_UL(*mcs, rb_table[*rb_index]); // fixme: set use_srs flag - *tx_power = estimate_ue_tx_power(tbs * 8, rb_table[*rb_index], 0, Ncp, 0); + *tx_power = estimate_ue_tx_power(0,tbs * 8, rb_table[*rb_index], 0, Ncp, 0); /* find maximum MCS */ while ((phr - *tx_power < 0 || tbs > bytes) && *mcs > 3) { (*mcs)--; tbs = get_TBS_UL(*mcs, rb_table[*rb_index]); - *tx_power = estimate_ue_tx_power(tbs * 8, rb_table[*rb_index], 0, Ncp, 0); + *tx_power = estimate_ue_tx_power(0,tbs * 8, rb_table[*rb_index], 0, Ncp, 0); } /* find minimum necessary RBs */ @@ -746,7 +746,7 @@ void calculate_max_mcs_min_rb(module_id_t mod_id, && phr - *tx_power > 0) { (*rb_index)++; tbs = get_TBS_UL(*mcs, rb_table[*rb_index]); - *tx_power = estimate_ue_tx_power(tbs * 8, rb_table[*rb_index], 0, Ncp, 0); + *tx_power = estimate_ue_tx_power(0,tbs * 8, rb_table[*rb_index], 0, Ncp, 0); } /* Decrease if we went to far in last iteration */ @@ -801,7 +801,7 @@ int rr_ul_run(module_id_t Mod_id, AssertFatal(num_contig_rb <= 2, "cannot handle more than two contiguous RB regions\n"); UE_info_t *UE_info = &RC.mac[Mod_id]->UE_info; const int max_rb = num_contig_rb > 1 ? MAX(rbs[0].length, rbs[1].length) : rbs[0].length; - + eNB_MAC_INST *mac = RC.mac[Mod_id]; /* for every UE: check whether we have to handle a retransmission (and * allocate, if so). If not, compute how much RBs this UE would need */ int rb_idx_required[MAX_MOBILES_PER_ENB]; @@ -809,7 +809,7 @@ int rr_ul_run(module_id_t Mod_id, int num_ue_req = 0; for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { UE_TEMPLATE *UE_template = &UE_info->UE_template[CC_id][UE_id]; - uint8_t harq_pid = subframe2harqpid(&RC.mac[Mod_id]->common_channels[CC_id], + uint8_t harq_pid = subframe2harqpid(&mac->common_channels[CC_id], sched_frame, sched_subframe); if (UE_info->UE_sched_ctrl[UE_id].round_UL[CC_id][harq_pid] > 0) { /* this UE has a retransmission, allocate it right away */ @@ -845,11 +845,11 @@ int rr_ul_run(module_id_t Mod_id, } } else { LOG_W(MAC, - "cannot allocate UL retransmission for UE %d (nb_rb %d)\n", - UE_id, - nb_rb); + "%d.%d cannot allocate UL retransmission for UE %d (nb_rb %d, rbs0.length %d, rbs1.length %d,rbs0.start %d,rbs1.start %d)\n", + sched_frame,sched_subframe,UE_id, + nb_rb, rbs[0].length,rbs[1].length,rbs[0].start,rbs[1].start); UE_template->pre_dci_ul_pdu_idx = -1; // do not need CCE - RC.mac[Mod_id]->HI_DCI0_req[CC_id][subframe].hi_dci0_request_body.number_of_dci--; + mac->HI_DCI0_req[CC_id][subframe].hi_dci0_request_body.number_of_dci--; continue; } LOG_D(MAC, "%4d.%d UE %d retx %d RBs at start %d\n", @@ -895,10 +895,9 @@ int rr_ul_run(module_id_t Mod_id, &tx_power); UE_template->pre_assigned_mcs_ul = mcs; - /* rb_idx_given >= 22: apparently the PHY cannot support more than 48 - * RBs in the uplink. Hence, we limit every UE to 48 RBs, which is at - * index 22 */ - rb_idx_required[UE_id] = min(22, rb_table_index); + /* rb_idx_given >= MAX index: limit RBs to value in configuration file + * RBs in the uplink. */ + rb_idx_required[UE_id] = min(mac->max_ul_rb_index, rb_table_index); //UE_template->pre_allocated_nb_rb_ul = rb_table[rb_table_index]; /* only print log when PHR changed */ static int phr = 0; diff --git a/openair2/LAYER2/MAC/rar_tools.c b/openair2/LAYER2/MAC/rar_tools.c index 23ac209389..d48952318a 100644 --- a/openair2/LAYER2/MAC/rar_tools.c +++ b/openair2/LAYER2/MAC/rar_tools.c @@ -67,8 +67,10 @@ fill_rar(const module_id_t module_idP, rar[5] = (uint8_t) (ra->rnti & 0xff); //ra->timing_offset = 0; ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps - rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4 - rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4 + //rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4 + //rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4 + rar[0] = (uint8_t) (ra->timing_offset >> (4)); // 7 MSBs of timing advance + divide by 4 + rar[1] = (uint8_t) (ra->timing_offset << (4)) & 0xf0; // 4 LSBs of timing advance + divide by 4 COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id]; if(N_RB_UL == 25) { diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 0dedacb11f..9ae8f82a00 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -72,7 +72,7 @@ extern UL_IND_t *UL_INFO; extern int next_ra_frame; extern module_id_t next_Mod_id; -int mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; +rb_id_t mbms_rab_id=2047;//[8] = {2047,2047,2047,2047,2047,2047,2047,2047}; static int mbms_mch_i=0; //static int num_msi_per_CSA[28]; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h index 381dce11b2..6bb7970be6 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h @@ -36,6 +36,7 @@ #include #include #include +#include #define TABLE_38213_13_1_NUM_INDEXES 15 #define TABLE_38213_13_2_NUM_INDEXES 14 @@ -53,7 +54,7 @@ // Definitions for MAC control and data #define NR_BCCH_DL_SCH 3 // SI #define NR_BCCH_BCH 5 // MIB -#define CCCH_PAYLOAD_SIZE_MAX 128 +#define CCCH_PAYLOAD_SIZE_MAX 512 #define RAR_PAYLOAD_SIZE_MAX 128 #define MAX_BWP_SIZE 275 @@ -148,10 +149,10 @@ typedef struct { // single Entry PHR MAC CE // TS 38.321 ch. 6.1.3.8 typedef struct { - uint8_t PH: 6; - uint8_t R1: 2; - uint8_t PCMAX: 6; - uint8_t R2: 6; + uint8_t PH: 6; // octet 1 [5:0] + uint8_t R1: 2; // octet 1 [7:6] + uint8_t PCMAX: 6; // octet 2 [5:0] + uint8_t R2: 2; // octet 2 [7:6] } __attribute__ ((__packed__)) NR_SINGLE_ENTRY_PHR_MAC_CE; @@ -334,12 +335,12 @@ typedef struct { #define DL_SCH_LCID_CON_RES_ID 0x3E #define DL_SCH_LCID_PADDING 0x3F -#define UL_SCH_LCID_CCCH 0x00 +#define UL_SCH_LCID_CCCH1 0x00 #define UL_SCH_LCID_SRB1 0x01 #define UL_SCH_LCID_SRB2 0x02 #define UL_SCH_LCID_SRB3 0x03 #define UL_SCH_LCID_DTCH 0x04 -#define UL_SCH_LCID_CCCH_MSG3 0x21 +#define UL_SCH_LCID_CCCH 0x34 #define UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY 0x35 #define UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT 0x36 #define UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION 0x37 @@ -418,14 +419,6 @@ typedef enum { NR_RNTI_MCS_C, } nr_rnti_type_t; -typedef enum subcarrier_spacing_e { - scs_15kHz = 0x1, - scs_30kHz = 0x2, - scs_60kHz = 0x4, - scs_120kHz = 0x8, - scs_240kHz = 0x16 -} subcarrier_spacing_t; - typedef enum channel_bandwidth_e { bw_5MHz = 0x1, bw_10MHz = 0x2, @@ -462,6 +455,7 @@ typedef struct Type0_PDCCH_CSS_config_s { uint32_t ssb_length; uint32_t ssb_index; uint32_t cset_start_rb; + bool active; } NR_Type0_PDCCH_CSS_config_t; #endif /*__LAYER2_MAC_H__ */ diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index cdeb23c099..ef358f40fe 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -36,6 +36,13 @@ #define reserved 0xffff +// start symbols for SSB types A,B,C,D,E +uint16_t symbol_ssb_AC[8]={2,8,16,22,30,36,44,50}; +uint16_t symbol_ssb_BD[64]={4,8,16,20,32,36,44,48,60,64,72,76,88,92,100,104,144,148,156,160,172,176,184,188,200,204,212,216,228,232,240,244,284,288, + 296,300,312,316,324,328,340,344,352,356,368,372,380,384,424,428,436,440,452,456,464,468,480,484,492,496,508,512,520,524}; +uint16_t symbol_ssb_E[64]={8,12,16,20,32,36,40,44,64,68,72,76,88,92,96,100,120,124,128,132,144,148,152,156,176,180,184,188,200,204,208,212,288,292, + 296,300,312,316,320,324,344,348,352,356,368,372,376,380,400,404,408,412,424,428,432,436,456,460,464,468,480,484,488,492}; + const uint8_t nr_slots_per_frame[5] = {10, 20, 40, 80, 160}; // Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz @@ -118,6 +125,152 @@ const float table_38213_13_12_c3[16] = { 1, 0.5f, 1, 0.5f, 1, 0.5f, 0.5f, 0.5f const int32_t table_38213_10_1_1_c2[5] = { 0, 0, 4, 2, 1 }; +// for PDSCH from TS 38.214 subclause 5.1.2.1.1 +const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][3]={ + {0,2,12}, // row index 1 + {0,2,10}, // row index 2 + {0,2,9}, // row index 3 + {0,2,7}, // row index 4 + {0,2,5}, // row index 5 + {0,9,4}, // row index 6 + {0,4,4}, // row index 7 + {0,5,7}, // row index 8 + {0,5,2}, // row index 9 + {0,9,2}, // row index 10 + {0,12,2}, // row index 11 + {0,1,13}, // row index 12 + {0,1,6}, // row index 13 + {0,2,4}, // row index 14 + {0,4,7}, // row index 15 + {0,8,4} // row index 16 +}; +const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][3]={ + {0,3,11}, // row index 1 + {0,3,9}, // row index 2 + {0,3,8}, // row index 3 + {0,3,6}, // row index 4 + {0,3,4}, // row index 5 + {0,10,4}, // row index 6 + {0,6,4}, // row index 7 + {0,5,7}, // row index 8 + {0,5,2}, // row index 9 + {0,9,2}, // row index 10 + {0,12,2}, // row index 11 + {0,1,13}, // row index 12 + {0,1,6}, // row index 13 + {0,2,4}, // row index 14 + {0,4,7}, // row index 15 + {0,8,4} // row index 16 +}; +const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][3]={ + {0,2,6}, // row index 1 + {0,2,10}, // row index 2 + {0,2,9}, // row index 3 + {0,2,7}, // row index 4 + {0,2,5}, // row index 5 + {0,6,4}, // row index 6 + {0,4,4}, // row index 7 + {0,5,6}, // row index 8 + {0,5,2}, // row index 9 + {0,9,2}, // row index 10 + {0,10,2}, // row index 11 + {0,1,11}, // row index 12 + {0,1,6}, // row index 13 + {0,2,4}, // row index 14 + {0,4,6}, // row index 15 + {0,8,4} // row index 16 +}; +const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][3]={ + {0,3,5}, // row index 1 + {0,3,9}, // row index 2 + {0,3,8}, // row index 3 + {0,3,6}, // row index 4 + {0,3,4}, // row index 5 + {0,8,2}, // row index 6 + {0,6,4}, // row index 7 + {0,5,6}, // row index 8 + {0,5,2}, // row index 9 + {0,9,2}, // row index 10 + {0,10,2}, // row index 11 + {0,1,11}, // row index 12 + {0,1,6}, // row index 13 + {0,2,4}, // row index 14 + {0,4,6}, // row index 15 + {0,8,4} // row index 16 +}; +const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][3]={ + {0,2,2}, // row index 1 + {0,4,2}, // row index 2 + {0,6,2}, // row index 3 + {0,8,2}, // row index 4 + {0,10,2}, // row index 5 + {1,2,2}, // row index 6 + {1,4,2}, // row index 7 + {0,2,4}, // row index 8 + {0,4,4}, // row index 9 + {0,6,4}, // row index 10 + {0,8,4}, // row index 11 + {0,10,4}, // row index 12 + {0,2,7}, // row index 13 + {0,2,12}, // row index 14 + {1,2,4}, // row index 15 + {0,0,0} // row index 16 +}; +const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][3]={ + {0,2,2}, // row index 1 + {0,4,2}, // row index 2 + {0,6,2}, // row index 3 + {0,8,2}, // row index 4 + {0,10,2}, // row index 5 + {1,2,2}, // row index 6 + {1,4,2}, // row index 7 + {0,2,4}, // row index 8 + {0,4,4}, // row index 9 + {0,6,4}, // row index 10 + {0,8,4}, // row index 11 + {0,10,4}, // row index 12 + {0,2,7}, // row index 13 + {0,3,11}, // row index 14 + {1,2,4}, // row index 15 + {0,0,0} // row index 16 +}; +const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][3]={ + {0,2,2}, // row index 1 + {0,4,2}, // row index 2 + {0,6,2}, // row index 3 + {0,8,2}, // row index 4 + {0,10,2}, // row index 5 + {0,0,0}, // row index 6 + {0,0,0}, // row index 7 + {0,2,4}, // row index 8 + {0,4,4}, // row index 9 + {0,6,4}, // row index 10 + {0,8,4}, // row index 11 + {0,10,4}, // row index 12 + {0,2,7}, // row index 13 + {0,2,12}, // row index 14 + {0,0,6}, // row index 15 + {0,2,6} // row index 16 +}; +const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][3]={ + {0,2,2}, // row index 1 + {0,4,2}, // row index 2 + {0,6,2}, // row index 3 + {0,8,2}, // row index 4 + {0,10,2}, // row index 5 + {0,0,0}, // row index 6 + {0,0,0}, // row index 7 + {0,2,4}, // row index 8 + {0,4,4}, // row index 9 + {0,6,4}, // row index 10 + {0,8,4}, // row index 11 + {0,10,4}, // row index 12 + {0,2,7}, // row index 13 + {0,3,11}, // row index 14 + {0,0,6}, // row index 15 + {0,2,6} // row index 16 +}; + const char *prachfmt[]={"0","1","2","3", "A1","A2","A3","B1","B4","C0","C2","A1/B1","A2/B2","A3/B3"}; const char *duplex_mode[]={"FDD","TDD"}; @@ -1010,7 +1163,7 @@ int get_format0(uint8_t index, uint8_t unpaired, frequency_range_t frequency_range){ - uint16_t format; + uint16_t format=0; if (unpaired) { if (frequency_range==FR1) format = table_6_3_3_2_3_prachConfig_Index[index][0]; @@ -1576,6 +1729,47 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config, } } +// TS 38.211 Table 7.4.1.1.2-3: PDSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. +// The first 4 colomns are PDSCH mapping type A and the last 4 colomns are PDSCH mapping type B. +// When l' = l0, it is represented by 1 +// E.g. when symbol duration is 12 in colomn 7, value 1057 ('10000100001') which means l' = l0, 5, 10. + +int32_t table_7_4_1_1_2_3_pdsch_dmrs_positions_l [13][8] = { // Duration in symbols +{-1, -1, -1, -1, 1, 1, 1, 1}, //2 // (DMRS l' position) +{0, 0, 0, 0, 1, 1, 1, 1}, //3 // (DMRS l' position) +{0, 0, 0, 0, 1, 1, 1, 1}, //4 // (DMRS l' position) +{0, 0, 0, 0, 1, 17, 17, 17}, //5 // (DMRS l' position) +{0, 0, 0, 0, 1, 17, 17, 17}, //6 // (DMRS l' position) +{0, 0, 0, 0, 1, 17, 17, 17}, //7 // (DMRS l' position) +{0, 128, 128, 128, 1, 65, 73, 73}, //8 // (DMRS l' position) +{0, 128, 128, 128, 1, 129, 145, 145}, //9 // (DMRS l' position) +{0, 512, 576, 576, 1, 129, 145, 145}, //10 // (DMRS l' position) +{0, 512, 576, 576, 1, 257, 273, 585}, //11 // (DMRS l' position) +{0, 512, 576, 2336, 1, 513, 545, 585}, //12 // (DMRS l' position) +{0, 2048, 2176, 2336, 1, 513, 545, 585}, //13 // (DMRS l' position) +{0, 2048, 2176, 2336, -1, -1, -1, -1}, //14 // (DMRS l' position) +}; + + +// TS 38.211 Table 7.4.1.1.2-4: PDSCH DMRS positions l' within a slot for double-symbol DMRS and intra-slot frequency hopping disabled. +// The first 4 colomns are PDSCH mapping type A and the last 4 colomns are PDSCH mapping type B. +// When l' = l0, it is represented by 1 + +int32_t table_7_4_1_1_2_4_pdsch_dmrs_positions_l [12][8] = { // Duration in symbols +{-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position) +{0, 0, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position) +{0, 0, -1, -1, 3, 3, -1, -1}, //5 // (DMRS l' position) +{0, 0, -1, -1, 3, 3, -1, -1}, //6 // (DMRS l' position) +{0, 0, -1, -1, 3, 3, -1, -1}, //7 // (DMRS l' position) +{0, 0, -1, -1, 3, 99, -1, -1}, //8 // (DMRS l' position) +{0, 0, -1, -1, 3, 99, -1, -1}, //9 // (DMRS l' position) +{0, 768, -1, -1, 3, 387, -1, -1}, //10 // (DMRS l' position) +{0, 768, -1, -1, 3, 387, -1, -1}, //11 // (DMRS l' position) +{0, 768, -1, -1, 3, 771, -1, -1}, //12 // (DMRS l' position) +{0, 3072, -1, -1, 3, 771, -1, -1}, //13 // (DMRS l' position) +{0, 3072, -1, -1, -1, -1, -1, -1}, //14 // (DMRS l' position) +}; + // TS 38.211 Table 6.4.1.1.3-3: PUSCH DMRS positions l' within a slot for single-symbol DMRS and intra-slot frequency hopping disabled. // The first 4 colomns are PUSCH mapping type A and the last 4 colomns are PUSCH mapping type B. // When l' = l0, it is represented by 1 @@ -1583,17 +1777,17 @@ uint8_t compute_nr_root_seq(NR_RACH_ConfigCommon_t *rach_config, int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { // Duration in symbols {-1, -1, -1, -1, 1, 1, 1, 1}, //<4 // (DMRS l' position) -{1, 1, 1, 1, 1, 1, 1, 1}, //4 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //5 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //6 // (DMRS l' position) -{1, 1, 1, 1, 1, 5, 5, 5}, //7 // (DMRS l' position) -{1, 129, 129, 129, 1, 65, 73, 73}, //8 // (DMRS l' position) -{1, 129, 129, 129, 1, 65, 73, 73}, //9 // (DMRS l' position) -{1, 513, 577, 577, 1, 257, 273, 585}, //10 // (DMRS l' position) -{1, 513, 577, 577, 1, 257, 273, 585}, //11 // (DMRS l' position) -{1, 513, 577, 2337, 1, 1025, 1057, 585}, //12 // (DMRS l' position) -{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //13 // (DMRS l' position) -{1, 2049, 2177, 2337, 1, 1025, 1057, 585}, //14 // (DMRS l' position) +{0, 0, 0, 0, 1, 1, 1, 1}, //4 // (DMRS l' position) +{0, 0, 0, 0, 1, 17, 17, 17}, //5 // (DMRS l' position) +{0, 0, 0, 0, 1, 17, 17, 17}, //6 // (DMRS l' position) +{0, 0, 0, 0, 1, 17, 17, 17}, //7 // (DMRS l' position) +{0, 128, 128, 128, 1, 65, 73, 73}, //8 // (DMRS l' position) +{0, 128, 128, 128, 1, 65, 73, 73}, //9 // (DMRS l' position) +{0, 512, 576, 576, 1, 257, 273, 585}, //10 // (DMRS l' position) +{0, 512, 576, 576, 1, 257, 273, 585}, //11 // (DMRS l' position) +{0, 512, 576, 2336, 1, 1025, 1057, 585}, //12 // (DMRS l' position) +{0, 2048, 2176, 2336, 1, 1025, 1057, 585}, //13 // (DMRS l' position) +{0, 2048, 2176, 2336, 1, 1025, 1057, 585}, //14 // (DMRS l' position) }; @@ -1603,17 +1797,17 @@ int32_t table_6_4_1_1_3_3_pusch_dmrs_positions_l [12][8] = { int32_t table_6_4_1_1_3_4_pusch_dmrs_positions_l [12][8] = { // Duration in symbols {-1, -1, -1, -1, -1, -1, -1, -1}, //<4 // (DMRS l' position) -{1, 1, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //5 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //6 // (DMRS l' position) -{1, 1, -1, -1, 1, 1, -1, -1}, //7 // (DMRS l' position) -{1, 1, -1, -1, 1, 33, -1, -1}, //8 // (DMRS l' position) -{1, 1, -1, -1, 1, 33, -1, -1}, //9 // (DMRS l' position) -{1, 257, -1, -1, 1, 129, -1, -1}, //10 // (DMRS l' position) -{1, 257, -1, -1, 1, 129, -1, -1}, //11 // (DMRS l' position) -{1, 257, -1, -1, 1, 513, -1, -1}, //12 // (DMRS l' position) -{1, 1025, -1, -1, 1, 513, -1, -1}, //13 // (DMRS l' position) -{1, 1025, -1, -1, 1, 513, -1, -1}, //14 // (DMRS l' position) +{0, 0, -1, -1, -1, -1, -1, -1}, //4 // (DMRS l' position) +{0, 0, -1, -1, 3, 3, -1, -1}, //5 // (DMRS l' position) +{0, 0, -1, -1, 3, 3, -1, -1}, //6 // (DMRS l' position) +{0, 0, -1, -1, 3, 3, -1, -1}, //7 // (DMRS l' position) +{0, 0, -1, -1, 3, 99, -1, -1}, //8 // (DMRS l' position) +{0, 0, -1, -1, 3, 99, -1, -1}, //9 // (DMRS l' position) +{0, 768, -1, -1, 3, 387, -1, -1}, //10 // (DMRS l' position) +{0, 768, -1, -1, 3, 387, -1, -1}, //11 // (DMRS l' position) +{0, 768, -1, -1, 3, 1539, -1, -1}, //12 // (DMRS l' position) +{0, 3072, -1, -1, 3, 1539, -1, -1}, //13 // (DMRS l' position) +{0, 3072, -1, -1, 3, 1539, -1, -1}, //14 // (DMRS l' position) }; // Returns the corresponding row index of the NR table @@ -2159,8 +2353,8 @@ int get_num_dmrs(uint16_t dmrs_mask ) { return(num_dmrs); } /* returns the total DMRS symbols in a slot*/ -uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols){ - return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols)); +uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype){ + return get_num_dmrs(fill_dmrs_mask(pdsch_Config,dmrs_TypeA_Position,NrOfSymbols, startSymbol, mappingtype)); } // Table 5.1.2.2.1-1 38.214 @@ -2224,29 +2418,46 @@ uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position) { } -int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength) { +int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength, uint8_t start_symbol, uint8_t dmrs_typeA_position) { uint8_t row, colomn; int32_t l_prime; + LOG_D(MAC, "PUSCH: NrofSymbols:%d, startSymbol:%d, mappingtype:%d, dmrs_TypeA_Position:%d\n", duration_in_symbols, start_symbol, mapping_type, dmrs_typeA_position); + + // Section 6.4.1.1.3 in Spec 38.211 + // For PDSCH Mapping TypeA, ld is duration between first OFDM of the slot and last OFDM symbol of the scheduled PUSCH resources + // For TypeB, ld is the duration of the scheduled PUSCH resources + uint8_t ld = (mapping_type == typeA) ? (duration_in_symbols + start_symbol) : duration_in_symbols; + uint8_t l0 = (dmrs_typeA_position == NR_MIB__dmrs_TypeA_Position_pos2) ? 2 : 3 ; + colomn = additional_pos; if (mapping_type == typeB) colomn += 4; - if (duration_in_symbols < 4) + if (ld < 4) row = 0; else - row = duration_in_symbols - 3; + row = ld - 3; - if (pusch_maxLength == pusch_len1) + if (pusch_maxLength == pusch_len1) { l_prime = table_6_4_1_1_3_3_pusch_dmrs_positions_l[row][colomn]; - else + l0 = 1 << l0; + } + else { l_prime = table_6_4_1_1_3_4_pusch_dmrs_positions_l[row][colomn]; + l0 = 1<0,"invalid l_prime < 0\n"); + LOG_D(MAC, "PUSCH - l0:%d, ld:%d,row:%d, column:%d, addpos:%d, maxlen:%d\n", l0, ld, row, colomn, additional_pos, pusch_maxLength); + AssertFatal(l_prime>=0,"invalid l_prime < 0\n"); + + l_prime = (mapping_type == typeA) ? (l_prime | l0) : (l_prime << start_symbol); + LOG_D(MAC, " PUSCH DMRS MASK in HEX:%x\n", l_prime); return l_prime; + } /******************************************************************* @@ -2273,7 +2484,7 @@ uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint mcs4 = 28; if (I_mcs < mcs1) { - LOG_I(PHY, "PUSH PT-RS is not present.\n"); + LOG_D(PHY, "PUSH PT-RS is not present.\n"); return -1; } else if (I_mcs >= mcs1 && I_mcs < mcs2) return 2; @@ -2303,7 +2514,7 @@ uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) { if (N_RB < nrb0) { - LOG_I(PHY,"PUSH PT-RS is not present.\n"); + LOG_D(PHY,"PUSH PT-RS is not present.\n"); return -1; } else if (N_RB >= nrb0 && N_RB < nrb1) return 2; @@ -2764,7 +2975,7 @@ int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slot) { int slots1=period1*(1<tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0); - else return(slot_in_period <= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); + else return(slot_in_period <= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); } int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slot, lte_frame_type_t frame_type) { @@ -2796,91 +3007,93 @@ int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slot, lte_frame_type int slots1=period1*(1<= scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots ? 1 : 0); - else return(slot_in_period >= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); + else return(slot_in_period >= slots1+scc->tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); } -int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols) { +int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype_fromDCI) { + + int l0;int dmrs_AdditionalPosition = 0;int maxLength = 0; + NR_DMRS_DownlinkConfig_t *dmrs_config = NULL; + + LOG_D(MAC, "NrofSymbols:%d, startSymbol:%d, mappingtype:%d, dmrs_TypeA_Position:%d\n", NrOfSymbols, startSymbol, mappingtype_fromDCI, dmrs_TypeA_Position); - int l0; if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos2) l0=2; else if (dmrs_TypeA_Position == NR_ServingCellConfigCommon__dmrs_TypeA_Position_pos3) l0=3; else AssertFatal(1==0,"Illegal dmrs_TypeA_Position %d\n",(int)dmrs_TypeA_Position); - if (pdsch_Config == NULL) { // Initial BWP - return(1<dmrs_DownlinkForPDSCH_MappingTypeA && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) + dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; + } else if (mappingtype_fromDCI == typeB) { + if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB && pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) + dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup; + } else { + AssertFatal(1==0,"Incorrect Mappingtype\n"); + } + + AssertFatal(dmrs_config != NULL," DMRS configs not present in PDSCH DMRS Downlink config\n"); + + // default values of maxlength = len2, additionalposition is pos2 + if (dmrs_config->maxLength != NULL) maxLength = 2; + if (dmrs_config->dmrs_AdditionalPosition != NULL) dmrs_AdditionalPosition = *dmrs_config->dmrs_AdditionalPosition; + } + + uint8_t ld, row, column; + int32_t l_prime = -1; + + // columns 0-3 for TypeA, 4-7 for TypeB + column = (mappingtype_fromDCI == typeA) ? dmrs_AdditionalPosition : (dmrs_AdditionalPosition + 4); + + // Section 7.4.1.1.2 in Spec 38.211 + // For PDSCH Mapping TypeA, ld is duration between first OFDM of the slot and last OFDM symbol of the scheduled PDSCH resources + // For TypeB, ld is the duration of the scheduled PDSCH resources + ld = (mappingtype_fromDCI == typeA) ? (NrOfSymbols + startSymbol) : NrOfSymbols; + + // Section 7.4.1.1.2 in Spec 38.211 + //For PDSCH Mapping typeB, if PDSCH duration ld <=4, only single symbol DMRS is supported + if (mappingtype_fromDCI == typeB && ld <= 4) + maxLength = 1; + + AssertFatal(ld > 2 && ld < 15,"Illegal NrOfSymbols according to Table 5.1.2.1-1 Spec 38.214 %d\n",ld); + AssertFatal((NrOfSymbols + startSymbol) < 15,"Illegal S+L according to Table 5.1.2.1-1 Spec 38.214 S:%d L:%d\n",startSymbol, NrOfSymbols); + + if (mappingtype_fromDCI == typeA) { + + // Section 7.4.1.1.2 in Spec 38.211 + AssertFatal((l0 == 2) || (l0 == 3 && dmrs_AdditionalPosition != 3),"Wrong config, If dmrs_TypeA_Position POS3, ADD POS cannot be POS3 \n"); + + // Table 5.1.2.1-1 in Spec 38.214 + AssertFatal(startSymbol <= l0, "Wrong config, Start symbol %d cannot be later than dmrs_TypeA_Position %d \n", startSymbol, l0); + + // Section 7.4.1.1.2 in Spec 38.211 + AssertFatal(l0 == 2 || (l0 == 3 && (ld != 3 || ld != 4)), "ld 3 or 4 symbols only possible with dmrs_TypeA_Position POS2 \n"); + + } + + if (maxLength == 1) { + row = ld - 2; + l_prime = table_7_4_1_1_2_3_pdsch_dmrs_positions_l[row][column]; + l0 = 1 << l0; } else { - if (pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA && - pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) { - // Relative to start of slot - NR_DMRS_DownlinkConfig_t *dmrs_config = (NR_DMRS_DownlinkConfig_t *)pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup; - AssertFatal(NrOfSymbols>1 && NrOfSymbols < 15,"Illegal NrOfSymbols %d\n",NrOfSymbols); - int pos2=0; - if (dmrs_config->maxLength == NULL) { - // this is Table 7.4.1.1.2-3: PDSCH DM-RS positions l for single-symbol DM-RS - if (dmrs_config->dmrs_AdditionalPosition == NULL) pos2=1; - else if (dmrs_config->dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition == NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0 ) - return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) - return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) - return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3) - return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) - return(1<dmrs_AdditionalPosition && *dmrs_config->dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos3) - return(1<3,"Illegal NrOfSymbols %d for len2 DMRS\n",NrOfSymbols); - if (NrOfSymbols < 10) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<dmrs_AdditionalPosition!=NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0) return(1<dmrs_AdditionalPosition==NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1) return(1<dmrs_DownlinkForPDSCH_MappingTypeB && - pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->present == NR_SetupRelease_DMRS_DownlinkConfig_PR_setup) { - // Relative to start of PDSCH resource - AssertFatal(1==0,"TypeB DMRS not supported yet\n"); - } + row = (ld < 4) ? 0 : (ld - 3); + l_prime = table_7_4_1_1_2_4_pdsch_dmrs_positions_l[row][column]; + l0 = 1<=0,"ERROR in configuration.Check Time Domain allocation of this Grant. l_prime < 1. row:%d, column:%d\n", row, column); + + l_prime = (mappingtype_fromDCI == typeA) ? (l_prime | l0) : (l_prime << startSymbol); + LOG_D(MAC, " PDSCH DMRS MASK in HEX:%x\n", l_prime); + + return l_prime; } uint8_t get_pusch_mcs_table(long *mcs_Table, @@ -3008,56 +3221,58 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, return valid; } -uint32_t get_ssb_slot(uint32_t ssb_index){ - // this function now only support f <= 3GHz - return ssb_index & 0x3 ; +uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb) { - // return first_symbol(case, freq, ssb_index) / 14 + switch (scs) { + case NR_SubcarrierSpacing_kHz15: + return symbol_ssb_AC[i_ssb]; //type A + case NR_SubcarrierSpacing_kHz30: + if (band == 5 || band == 66) + return symbol_ssb_BD[i_ssb]; //type B + else + return symbol_ssb_AC[i_ssb]; //type C + case NR_SubcarrierSpacing_kHz120: + return symbol_ssb_BD[i_ssb]; //type D + case NR_SubcarrierSpacing_kHz240: + return symbol_ssb_E[i_ssb]; + default: + AssertFatal(1 == 0, "SCS %ld not allowed for SSB \n",scs); + } } -int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, - NR_MIB_t *mib, - uint8_t extra_bits, - uint32_t ssb_length, - uint32_t ssb_index, - uint32_t ssb_offset_point_a) { +void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + frame_t frameP, + NR_MIB_t *mib, + uint8_t num_slot_per_frame, + uint8_t ssb_subcarrier_offset, + uint16_t ssb_start_symbol, + NR_SubcarrierSpacing_t scs_ssb, + frequency_range_t frequency_range, + uint32_t ssb_index, + uint32_t ssb_offset_point_a) { - // deafult for testing - subcarrier_spacing_t scs_ssb = scs_30kHz; - channel_bandwidth_t min_channel_bw = bw_10MHz; - frequency_range_t frequency_range = FR1; - const uint32_t num_slot_per_frame = 20; + NR_SubcarrierSpacing_t scs_pdcch; + + channel_bandwidth_t min_channel_bw = bw_10MHz; // TODO remove hardcoding and implement Table 5.3.5-1 in 38.104 + + if (frequency_range == FR2) { + if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60) + scs_pdcch = NR_SubcarrierSpacing_kHz60; + else + scs_pdcch = NR_SubcarrierSpacing_kHz120; + } + else { + frequency_range = FR1; + if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60) + scs_pdcch = NR_SubcarrierSpacing_kHz15; + else + scs_pdcch = NR_SubcarrierSpacing_kHz30; + } - type0_PDCCH_CSS_config->ssb_length = ssb_length; type0_PDCCH_CSS_config->ssb_index = ssb_index; - type0_PDCCH_CSS_config->frame = (mib->systemFrameNumber.buf[0] >> mib->systemFrameNumber.bits_unused); + type0_PDCCH_CSS_config->frame = frameP; - uint16_t frame_number_4lsb = 0; - for (int i=0; i<4; i++) { - frame_number_4lsb |= ((extra_bits>>i)&1)<<(3-i); - } - - uint8_t ssb_subcarrier_offset_msb = ( extra_bits >> 5 ) & 0x1; // extra bits[5] - uint8_t ssb_subcarrier_offset = (uint8_t)mib->ssb_SubcarrierOffset; - - type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame << 4; - type0_PDCCH_CSS_config->frame = type0_PDCCH_CSS_config->frame | frame_number_4lsb; - - if(type0_PDCCH_CSS_config->ssb_length == 64){ - type0_PDCCH_CSS_config->ssb_index = type0_PDCCH_CSS_config->ssb_index & (( extra_bits >> 2 ) & 0x1C ); // { extra_bits[5:7], ssb_index[2:0] } - }else{ - if(ssb_subcarrier_offset_msb){ - ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; - } - } - - // assume carrier frequency < 6GHz - subcarrier_spacing_t scs_pdcch; - if(mib->subCarrierSpacingCommon == NR_MIB__subCarrierSpacingCommon_scs15or60){ - scs_pdcch = scs_15kHz; - }else{ //NR_MIB__subCarrierSpacingCommon_scs30or120 - scs_pdcch = scs_30kHz; - } + uint8_t ssb_slot = ssb_start_symbol/14; uint32_t is_condition_A = (ssb_subcarrier_offset == 0); // 38.213 ch.13 uint32_t index_4msb = (mib->pdcch_ConfigSIB1.controlResourceSetZero); @@ -3068,8 +3283,8 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->rb_offset = -1; // type0-pdcch coreset - switch( (scs_ssb << 5) | scs_pdcch ){ - case (scs_15kHz << 5) | scs_15kHz : + switch( (scs_ssb << 3) | scs_pdcch ){ + case (NR_SubcarrierSpacing_kHz15 << 5) | NR_SubcarrierSpacing_kHz15: AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; type0_PDCCH_CSS_config->num_rbs = table_38213_13_1_c2[index_4msb]; @@ -3077,7 +3292,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->rb_offset = table_38213_13_1_c4[index_4msb]; break; - case (scs_15kHz << 5) | scs_30kHz: + case (NR_SubcarrierSpacing_kHz15 << 3) | NR_SubcarrierSpacing_kHz30: AssertFatal(index_4msb < 14, "38.213 Table 13-2 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; type0_PDCCH_CSS_config->num_rbs = table_38213_13_2_c2[index_4msb]; @@ -3085,7 +3300,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->rb_offset = table_38213_13_2_c4[index_4msb]; break; - case (scs_30kHz << 5) | scs_15kHz: + case (NR_SubcarrierSpacing_kHz30 << 3) | NR_SubcarrierSpacing_kHz15: if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ AssertFatal(index_4msb < 9, "38.213 Table 13-3 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; @@ -3102,7 +3317,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC break; - case (scs_30kHz << 5) | scs_30kHz: + case (NR_SubcarrierSpacing_kHz30 << 3) | NR_SubcarrierSpacing_kHz30: if((min_channel_bw & bw_5MHz) | (min_channel_bw & bw_10MHz)){ type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; type0_PDCCH_CSS_config->num_rbs = table_38213_13_4_c2[index_4msb]; @@ -3118,7 +3333,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC }else{ ; } break; - case (scs_120kHz << 5) | scs_60kHz: + case (NR_SubcarrierSpacing_kHz120 << 3) | NR_SubcarrierSpacing_kHz60: AssertFatal(index_4msb < 12, "38.213 Table 13-7 4 MSB out of range\n"); if(index_4msb & 0x7){ type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; @@ -3135,7 +3350,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC } break; - case (scs_120kHz << 5) | scs_120kHz: + case (NR_SubcarrierSpacing_kHz120 << 3) | NR_SubcarrierSpacing_kHz120: AssertFatal(index_4msb < 8, "38.213 Table 13-8 4 MSB out of range\n"); if(index_4msb & 0x3){ type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; @@ -3152,7 +3367,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC } break; - case (scs_240kHz << 5) | scs_60kHz: + case (NR_SubcarrierSpacing_kHz240 << 3) | NR_SubcarrierSpacing_kHz60: AssertFatal(index_4msb < 4, "38.213 Table 13-9 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; type0_PDCCH_CSS_config->num_rbs = table_38213_13_9_c2[index_4msb]; @@ -3160,7 +3375,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->rb_offset = table_38213_13_9_c4[index_4msb]; break; - case (scs_240kHz << 5) | scs_120kHz: + case (NR_SubcarrierSpacing_kHz240 << 3) | NR_SubcarrierSpacing_kHz120: AssertFatal(index_4msb < 8, "38.213 Table 13-10 4 MSB out of range\n"); if(index_4msb & 0x3){ type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; @@ -3231,7 +3446,7 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC type0_PDCCH_CSS_config->number_of_search_space_per_slot = table_38213_13_11_c2[index_4lsb]; big_m = table_38213_13_11_c3[index_4lsb]; - uint32_t temp = (uint32_t)(big_o*scs_pdcch) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m); + uint32_t temp = (uint32_t)(big_o*(1<ssb_index*big_m); type0_PDCCH_CSS_config->n_c = temp / num_slot_per_frame; if((temp/num_slot_per_frame) & 0x1){ type0_PDCCH_CSS_config->sfn_c = SFN_C_MOD_2_EQ_1; @@ -3267,12 +3482,12 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC /// MUX PATTERN 2 if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 2){ - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_60kHz)){ + if((scs_ssb == NR_SubcarrierSpacing_kHz120) && (scs_pdcch == NR_SubcarrierSpacing_kHz60)){ // 38.213 Table 13-13 AssertFatal(index_4lsb == 0, "38.213 Table 13-13 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot // sfn_c = SFN_C_EQ_SFN_SSB; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + type0_PDCCH_CSS_config->n_c = ssb_slot; switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 case 0: type0_PDCCH_CSS_config->first_symbol_index = 0; @@ -3289,12 +3504,12 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC default: break; } - }else if((scs_ssb == scs_240kHz) && (scs_pdcch == scs_120kHz)){ + }else if((scs_ssb == NR_SubcarrierSpacing_kHz240) && (scs_pdcch == NR_SubcarrierSpacing_kHz120)){ // 38.213 Table 13-14 AssertFatal(index_4lsb == 0, "38.213 Table 13-14 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot // sfn_c = SFN_C_EQ_SFN_SSB; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + type0_PDCCH_CSS_config->n_c = ssb_slot; switch(type0_PDCCH_CSS_config->ssb_index & 0x7){ // ssb_index(i) mod 8 case 0: type0_PDCCH_CSS_config->first_symbol_index = 0; @@ -3310,11 +3525,11 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC break; case 4: type0_PDCCH_CSS_config->first_symbol_index = 12; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; + type0_PDCCH_CSS_config->n_c = ssb_slot - 1; break; case 5: type0_PDCCH_CSS_config->first_symbol_index = 13; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index) - 1; + type0_PDCCH_CSS_config->n_c = ssb_slot - 1; break; case 6: type0_PDCCH_CSS_config->first_symbol_index = 0; @@ -3331,12 +3546,12 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC /// MUX PATTERN 3 if(type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern == 3){ - if((scs_ssb == scs_120kHz) && (scs_pdcch == scs_120kHz)){ + if((scs_ssb == NR_SubcarrierSpacing_kHz120) && (scs_pdcch == NR_SubcarrierSpacing_kHz120)){ // 38.213 Table 13-15 AssertFatal(index_4lsb == 0, "38.213 Table 13-15 4 LSB out of range\n"); // PDCCH monitoring occasions (SFN and slot number) same as SSB frame-slot // sfn_c = SFN_C_EQ_SFN_SSB; - type0_PDCCH_CSS_config->n_c = get_ssb_slot(type0_PDCCH_CSS_config->ssb_index); + type0_PDCCH_CSS_config->n_c = ssb_slot; switch(type0_PDCCH_CSS_config->ssb_index & 0x3){ // ssb_index(i) mod 4 case 0: type0_PDCCH_CSS_config->first_symbol_index = 4; @@ -3373,10 +3588,9 @@ int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDC AssertFatal(type0_PDCCH_CSS_config->sfn_c!=SFN_C_IMPOSSIBLE,""); AssertFatal(type0_PDCCH_CSS_config->n_c!=UINT_MAX,""); - type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*scs_pdcch) + (uint32_t)(type0_PDCCH_CSS_config->ssb_index*big_m))%num_slot_per_frame; + type0_PDCCH_CSS_config->n_0 = ((uint32_t)(big_o*(1<ssb_index*big_m))%num_slot_per_frame; type0_PDCCH_CSS_config->cset_start_rb = ssb_offset_point_a - type0_PDCCH_CSS_config->rb_offset; - return 0; } /* extract UL PTRS values from RRC and validate it based upon 38.214 6.2.3 */ diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 3e21131b69..9c24eea772 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -47,7 +47,7 @@ uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw); -int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols); +int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype_fromDCI); int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP); @@ -121,17 +121,23 @@ uint16_t get_NCS(uint8_t index, uint16_t format, uint8_t restricted_set_config); int get_num_dmrs(uint16_t dmrs_mask ); uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position); -int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength); +int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength, uint8_t start_symbolt, uint8_t dmrs_typeA_position); uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table); uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB); -int get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, - NR_MIB_t *mib, - uint8_t extra_bits, - uint32_t ssb_length, - uint32_t ssb_index, - uint32_t ssb_offset_point_a); +void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, + frame_t frameP, + NR_MIB_t *mib, + uint8_t num_slot_per_frame, + uint8_t ssb_subcarrier_offset, + uint16_t ssb_start_symbol, + NR_SubcarrierSpacing_t scs_ssb, + frequency_range_t frequency_range, + uint32_t ssb_index, + uint32_t ssb_offset_point_a); + +uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb); int16_t get_N_RA_RB (int delta_f_RA_PRACH,int delta_f_PUSCH); @@ -146,7 +152,8 @@ bool set_ul_ptrs_values(NR_PTRS_UplinkConfig_t *ul_ptrs_config, uint8_t *K_ptrs, uint8_t *L_ptrs, uint8_t *reOffset, uint8_t *maxNumPorts, uint8_t *ulPower, uint8_t NrOfSymbols); -uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols); + +uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype); /* \brief Set the transform precoding according to 6.1.3 of 3GPP TS 38.214 version 16.3.0 Release 16 @param *pusch_config, pointer to pusch config diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h index 8f7a726bb8..1e0ab98d4c 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_extern.h @@ -139,4 +139,13 @@ extern const float table_38213_13_12_c3[16]; extern const int32_t table_38213_10_1_1_c2[5]; +extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][3]; +extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][3]; +extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][3]; +extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][3]; +extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][3]; +extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][3]; +extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][3]; +extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][3]; + #endif //DEF_H diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index fee2efc4a8..79e6eca300 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -31,9 +31,11 @@ */ //#include "mac_defs.h" +#include #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC-CellGroupConfig.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" +#include "executables/softmodem-common.h" int set_tdd_config_nr_ue(fapi_nr_config_request_t *cfg, int mu, @@ -309,8 +311,11 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l139; else cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; - - cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; + if (get_softmodem_params()->sa) { + cfg->prach_config.num_prach_fd_occasions_list[i].k1 = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + } else { + cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + } cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range); //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? @@ -528,11 +533,13 @@ int nr_rrc_mac_config_req_ue( mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex; config_control_ue(mac); if (cell_group_config->spCellConfig->reconfigurationWithSync) { - ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink; - mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon; - config_common_ue(mac,module_id,cc_idP); - mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity; - LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti); + if (cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) { + ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink; + } + mac->scc = cell_group_config->spCellConfig->reconfigurationWithSync->spCellConfigCommon; + config_common_ue(mac,module_id,cc_idP); + mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity; + LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti); } // Setup the SSB to Rach Occasions mapping according to the config diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 3e299d291e..332cd600d3 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -234,9 +234,12 @@ typedef struct { typedef enum { RA_UE_IDLE = 0, - WAIT_RAR = 1, - WAIT_CONTENTION_RESOLUTION = 2, - RA_SUCCEEDED = 3 + GENERATE_IDLE = 0, + GENERATE_PREAMBLE = 1, + WAIT_RAR = 2, + WAIT_CONTENTION_RESOLUTION = 3, + RA_SUCCEEDED = 4, + RA_FAILED = 5 } RA_state_t; typedef struct { @@ -257,8 +260,10 @@ typedef struct { uint8_t RA_attempt_number; /// Random-access procedure flag uint8_t RA_active; + /// Random-access preamble index + int ra_PreambleIndex; /// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot - uint8_t generate_nr_prach; + RA_state_t generate_nr_prach; /// Random-access window counter int16_t RA_window_cnt; @@ -289,6 +294,8 @@ typedef struct { uint8_t RA_contention_resolution_timer_active; /// Random-access Contention Resolution Timer count value uint8_t RA_contention_resolution_cnt; + /// Transmitted UE Contention Resolution Identifier + uint8_t cont_res_id[6]; /// BeamfailurerecoveryConfig NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig; @@ -318,7 +325,7 @@ typedef struct { NR_TAG_Config_t *tag_Config; NR_PHR_Config_t *phr_Config; NR_RNTI_Value_t *cs_RNTI; - NR_MIB_t *mib; + NR_MIB_t *mib; NR_BWP_Downlink_t *DLbwp[MAX_NUM_BWP]; NR_BWP_Uplink_t *ULbwp[MAX_NUM_BWP]; @@ -374,6 +381,8 @@ typedef struct { NR_SearchSpace_t *search_space_zero; NR_ControlResourceSet_t *coreset0; + dci_pdu_rel15_t def_dci_pdu_rel15[8]; + } NR_UE_MAC_INST_t; typedef enum seach_space_mask_e { diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 14d1ea63fb..394ab58fc7 100755 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -178,7 +178,8 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu, - uint8_t time_domain_ind); + uint8_t time_domain_ind, + bool use_default); uint8_t nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c index 27623fe5be..2f4697c25d 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_l1_helpers.c @@ -146,17 +146,11 @@ int nr_get_Po_NOMINAL_PUSCH(NR_PRACH_RESOURCES_t *prach_resources, module_id_t m NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); NR_ServingCellConfigCommon_t *scc = mac->scc; - int8_t receivedTargerPower, delta_preamble; - long preambleReceivedTargetPower = 0; - - if (prach_resources->RA_TYPE == RA_4STEP){ - NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; - preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower; - } else if (prach_resources->RA_TYPE == RA_2STEP){ - // msgA-PreambleReceivedTargetPower - LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__); - } + int8_t receivedTargerPower; + int8_t delta_preamble; + NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + long preambleReceivedTargetPower = nr_rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower; delta_preamble = nr_get_DELTA_PREAMBLE(mod_id, CC_id, prach_resources->prach_format); receivedTargerPower = preambleReceivedTargetPower + delta_preamble + (prach_resources->RA_PREAMBLE_POWER_RAMPING_COUNTER - 1) * prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP + prach_resources->POWER_OFFSET_2STEP_RA; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 8f234cb585..7f4d536e3f 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -48,6 +48,8 @@ #include "NR_MAC_COMMON/nr_mac.h" #include "LAYER2/NR_MAC_UE/mac_proto.h" +#include + void nr_get_RA_window(NR_UE_MAC_INST_t *mac); // Random Access procedure initialization as per 5.1.1 and initialization of variables specific @@ -64,6 +66,8 @@ void init_RA(module_id_t mod_id, RA_config_t *ra = &mac->ra; ra->RA_active = 1; + ra->ra_PreambleIndex = -1; + ra->RA_usedGroupA = 1; ra->RA_RAPID_found = 0; ra->preambleTransMax = 0; ra->first_Msg3 = 1; @@ -79,8 +83,8 @@ void init_RA(module_id_t mod_id, if (rach_ConfigDedicated) { if (rach_ConfigDedicated->cfra){ - LOG_I(MAC, "Initialization of 4-step contention-free random access procedure\n"); - prach_resources->RA_TYPE = RA_4STEP; + LOG_I(MAC, "Initialization of 2-step contention-free random access procedure\n"); + prach_resources->RA_TYPE = RA_2STEP; ra->cfra = 1; } else if (rach_ConfigDedicated->ext1){ if (rach_ConfigDedicated->ext1->cfra_TwoStep_r16){ @@ -93,161 +97,152 @@ void init_RA(module_id_t mod_id, } else { LOG_E(MAC, "In %s: config not handled\n", __FUNCTION__); } + } else if (nr_rach_ConfigCommon){ + LOG_I(MAC, "Initialization of 4-step contention-based random access procedure\n"); + prach_resources->RA_TYPE = RA_4STEP; + ra->cfra = 0; } else { LOG_E(MAC, "In %s: config not handled\n", __FUNCTION__); } - if (prach_resources->RA_TYPE == RA_2STEP){ - LOG_E(MAC, "Missing implementation of initialization of 2-step RA specific variables...\n"); - } else if (prach_resources->RA_TYPE == RA_4STEP){ - LOG_D(MAC, "Initialization of 4-step RA specific variables...\n"); - switch (rach_ConfigGeneric->powerRampingStep){ // in dB - case 0: + switch (rach_ConfigGeneric->powerRampingStep){ // in dB + case 0: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 0; break; - case 1: + case 1: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 2; break; - case 2: + case 2: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 4; break; - case 3: + case 3: prach_resources->RA_PREAMBLE_POWER_RAMPING_STEP = 6; break; - } - - switch (rach_ConfigGeneric->preambleTransMax) { - case 0: - ra->preambleTransMax = 3; - break; - case 1: - ra->preambleTransMax = 4; - break; - case 2: - ra->preambleTransMax = 5; - break; - case 3: - ra->preambleTransMax = 6; - break; - case 4: - ra->preambleTransMax = 7; - break; - case 5: - ra->preambleTransMax = 8; - break; - case 6: - ra->preambleTransMax = 10; - break; - case 7: - ra->preambleTransMax = 20; - break; - case 8: - ra->preambleTransMax = 50; - break; - case 9: - ra->preambleTransMax = 100; - break; - case 10: - ra->preambleTransMax = 200; - break; - } - if (nr_rach_ConfigCommon->ext1) { - if (nr_rach_ConfigCommon->ext1->ra_PrioritizationForAccessIdentity){ - LOG_D(MAC, "In %s:%d: Missing implementation for Access Identity initialization procedures\n", __FUNCTION__, __LINE__); - } - } } - return; + switch (rach_ConfigGeneric->preambleTransMax) { + case 0: + ra->preambleTransMax = 3; + break; + case 1: + ra->preambleTransMax = 4; + break; + case 2: + ra->preambleTransMax = 5; + break; + case 3: + ra->preambleTransMax = 6; + break; + case 4: + ra->preambleTransMax = 7; + break; + case 5: + ra->preambleTransMax = 8; + break; + case 6: + ra->preambleTransMax = 10; + break; + case 7: + ra->preambleTransMax = 20; + break; + case 8: + ra->preambleTransMax = 50; + break; + case 9: + ra->preambleTransMax = 100; + break; + case 10: + ra->preambleTransMax = 200; + break; + } + if (nr_rach_ConfigCommon->ext1) { + if (nr_rach_ConfigCommon->ext1->ra_PrioritizationForAccessIdentity){ + LOG_D(MAC, "In %s:%d: Missing implementation for Access Identity initialization procedures\n", __FUNCTION__, __LINE__); + } + } } void ssb_rach_config(RA_config_t *ra, NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon, fapi_nr_ul_config_prach_pdu *prach_pdu){ // Determine the SSB to RACH mapping ratio // ======================================= - if (prach_resources->RA_TYPE == RA_4STEP){ - NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; - boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB - uint8_t ssb_rach_ratio; // Nb of SSBs per RACH or RACHs per SSB - int total_preambles_per_ssb; - uint8_t ssb_nb_in_ro; - int numberOfRA_Preambles = 64; - switch (ssb_perRACH_config){ - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth: - multiple_ssb_per_ro = false; - ssb_rach_ratio = 8; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth: - multiple_ssb_per_ro = false; - ssb_rach_ratio = 4; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf: - multiple_ssb_per_ro = false; - ssb_rach_ratio = 2; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 1; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 2; - ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two + 1); - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 4; - ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four; - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 8; - ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight; - break; - case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen: - multiple_ssb_per_ro = true; - ssb_rach_ratio = 16; - ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen; - break; - default: - AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config); - break; - } + NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR ssb_perRACH_config = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; + boolean_t multiple_ssb_per_ro; // true if more than one or exactly one SSB per RACH occasion, false if more than one RO per SSB + uint8_t ssb_rach_ratio; // Nb of SSBs per RACH or RACHs per SSB + int total_preambles_per_ssb; + uint8_t ssb_nb_in_ro; + int numberOfRA_Preambles = 64; - if (nr_rach_ConfigCommon->totalNumberOfRA_Preambles) - numberOfRA_Preambles = *(nr_rach_ConfigCommon->totalNumberOfRA_Preambles); + switch (ssb_perRACH_config){ + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth: + multiple_ssb_per_ro = false; + ssb_rach_ratio = 8; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth: + multiple_ssb_per_ro = false; + ssb_rach_ratio = 4; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf: + multiple_ssb_per_ro = false; + ssb_rach_ratio = 2; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 1; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 2; + ra->cb_preambles_per_ssb = 4 * (nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two + 1); + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 4; + ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four; + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 8; + ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight; + break; + case NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen: + multiple_ssb_per_ro = true; + ssb_rach_ratio = 16; + ra->cb_preambles_per_ssb = nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen; + break; + default: + AssertFatal(1 == 0, "Unsupported ssb_perRACH_config %d\n", ssb_perRACH_config); + } - // Compute the proper Preamble selection params according to the selected SSB and the ssb_perRACH_OccasionAndCB_PreamblesPerSSB configuration - if ((true == multiple_ssb_per_ro) && - (ssb_rach_ratio > 1)) { - total_preambles_per_ssb = numberOfRA_Preambles / ssb_rach_ratio; + if (nr_rach_ConfigCommon->totalNumberOfRA_Preambles) + numberOfRA_Preambles = *(nr_rach_ConfigCommon->totalNumberOfRA_Preambles); - ssb_nb_in_ro = prach_pdu->ssb_nb_in_ro; - ra->starting_preamble_nb = total_preambles_per_ssb * ssb_nb_in_ro; - } - else { - total_preambles_per_ssb = numberOfRA_Preambles; - ra->starting_preamble_nb = 0; - } + // Compute the proper Preamble selection params according to the selected SSB and the ssb_perRACH_OccasionAndCB_PreamblesPerSSB configuration + if ((true == multiple_ssb_per_ro) && (ssb_rach_ratio > 1)) { + total_preambles_per_ssb = numberOfRA_Preambles / ssb_rach_ratio; + + ssb_nb_in_ro = prach_pdu->ssb_nb_in_ro; + ra->starting_preamble_nb = total_preambles_per_ssb * ssb_nb_in_ro; } else { - LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__); + total_preambles_per_ssb = numberOfRA_Preambles; + ra->starting_preamble_nb = 0; } } -// This routine implements RA premable configuration according to +// This routine implements RA preamble configuration according to // section 5.1 (Random Access procedure) of 3GPP TS 38.321 version 16.2.1 Release 16 void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac, int16_t dl_pathloss){ int messageSizeGroupA = 0; int sizeOfRA_PreamblesGroupA = 0; int messagePowerOffsetGroupB = 0; - int PLThreshold; + int PLThreshold = 0; long deltaPreamble_Msg3 = 0; uint8_t noGroupB = 0; RA_config_t *ra = &mac->ra; @@ -255,23 +250,21 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &nr_rach_ConfigCommon->rach_ConfigGeneric; - if (prach_resources->RA_TYPE == RA_4STEP){ + if (scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){ + deltaPreamble_Msg3 = (*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB + LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3); + } - if (scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble){ - deltaPreamble_Msg3 = (*scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->msg3_DeltaPreamble) * 2; // dB - LOG_D(MAC, "In %s: deltaPreamble_Msg3 set to %ld\n", __FUNCTION__, deltaPreamble_Msg3); - } - - if (!nr_rach_ConfigCommon->groupBconfigured) { - noGroupB = 1; - LOG_D(MAC, "In %s:%d: preambles group B is not configured...\n", __FUNCTION__, __LINE__); - } else { - // RA preambles group B is configured - // - Random Access Preambles group B is configured for 4-step RA type - // - Defining the number of RA preambles in RA Preamble Group A for each SSB - LOG_D(MAC, "In %s:%d: preambles group B is configured...\n", __FUNCTION__, __LINE__); - sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA; - switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){ + if (!nr_rach_ConfigCommon->groupBconfigured) { + noGroupB = 1; + LOG_D(MAC, "In %s:%d: preambles group B is not configured...\n", __FUNCTION__, __LINE__); + } else { + // RA preambles group B is configured + // - Random Access Preambles group B is configured for 4-step RA type + // - Defining the number of RA preambles in RA Preamble Group A for each SSB + LOG_D(MAC, "In %s:%d: preambles group B is configured...\n", __FUNCTION__, __LINE__); + sizeOfRA_PreamblesGroupA = nr_rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA; + switch (nr_rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA){ /* - Threshold to determine the groups of RA preambles */ case 0: messageSizeGroupA = 56; @@ -337,44 +330,42 @@ void ra_preambles_config(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t break; default: AssertFatal(1 == 0,"Unknown messagePowerOffsetGroupB %lu\n", nr_rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB); - } - - PLThreshold = prach_resources->RA_PCMAX - rach_ConfigGeneric->preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB; - } - } else { - // todo: - // - groupB-ConfiguredTwoStepRA - // - msgA-DeltaPreamble - LOG_E(MAC, "In %s:%d: missing implementation for 2-step RA...\n", __FUNCTION__, __LINE__); + + PLThreshold = prach_resources->RA_PCMAX - rach_ConfigGeneric->preambleReceivedTargetPower - deltaPreamble_Msg3 - messagePowerOffsetGroupB; + } + /* Msg3 has not been transmitted yet */ if (ra->first_Msg3) { - if (noGroupB) { - // use Group A preamble - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb); - ra->RA_usedGroupA = 1; - } else if ((ra->Msg3_size < messageSizeGroupA) && (dl_pathloss > PLThreshold)) { - // Group B is configured and RA preamble Group A is used - // - todo add condition on CCCH_sdu_size for initiation by CCCH - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA); - ra->RA_usedGroupA = 1; - } else { - // Group B preamble is configured and used - // the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A - // the remaining belong to RA Preambles Group B - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); - ra->RA_usedGroupA = 0; + if(ra->ra_PreambleIndex < 0 || ra->ra_PreambleIndex > 63) { + if (noGroupB) { + // use Group A preamble + ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb); + ra->RA_usedGroupA = 1; + } else if ((ra->Msg3_size < messageSizeGroupA) && (dl_pathloss > PLThreshold)) { + // Group B is configured and RA preamble Group A is used + // - todo add condition on CCCH_sdu_size for initiation by CCCH + ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA); + ra->RA_usedGroupA = 1; + } else { + // Group B preamble is configured and used + // the first sizeOfRA_PreamblesGroupA RA preambles belong to RA Preambles Group A + // the remaining belong to RA Preambles Group B + ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); + ra->RA_usedGroupA = 0; + } } } else { // Msg3 is being retransmitted if (ra->RA_usedGroupA && noGroupB) { - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb); + ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % ra->cb_preambles_per_ssb); } else if (ra->RA_usedGroupA && !noGroupB){ - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA); + ra->ra_PreambleIndex = ra->starting_preamble_nb + ((taus()) % sizeOfRA_PreamblesGroupA); } else { - prach_resources->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); + ra->ra_PreambleIndex = ra->starting_preamble_nb + sizeOfRA_PreamblesGroupA + ((taus()) % (ra->cb_preambles_per_ssb - sizeOfRA_PreamblesGroupA)); } } + prach_resources->ra_PreambleIndex = ra->ra_PreambleIndex; } // RA-RNTI computation (associated to PRACH occasion in which the RA Preamble is transmitted) @@ -472,6 +463,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint // start contention resolution timer ra->RA_contention_resolution_cnt = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) * 8; ra->RA_contention_resolution_timer_active = 1; + ra->ra_state = WAIT_CONTENTION_RESOLUTION; } @@ -503,7 +495,8 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES]; - uint8_t lcid = UL_SCH_LCID_CCCH_MSG3, *payload; + uint8_t lcid = UL_SCH_LCID_CCCH; + uint8_t *payload; uint16_t size_sdu = 0; unsigned short post_padding; NR_ServingCellConfigCommon_t *scc = mac->scc; @@ -527,7 +520,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, } } - if (prach_resources->init_msg1) { + if (prach_resources->init_msg1 && ra->ra_state != RA_SUCCEEDED) { if (ra->RA_active == 0) { /* RA not active - checking if RRC is ready to initiate the RA procedure */ @@ -557,6 +550,11 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, if (size_sdu > 0) { + // UE Contention Resolution Identity + // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the + // Random Access Procedure has been successful after reception of Msg4 + memcpy(ra->cont_res_id, mac_sdus, sizeof(uint8_t) * 6); + LOG_D(MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx); ra->Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); @@ -566,7 +564,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, nr_get_RA_window(mac); // Fill in preamble and PRACH resources - if (ra->generate_nr_prach == 1) + if (ra->generate_nr_prach == GENERATE_PREAMBLE) nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer @@ -614,9 +612,13 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, } if (ra->RA_window_cnt >= 0 && ra->RA_RAPID_found == 1) { - // Reset RA_active flag: it disables Msg3 retransmission (8.3 of TS 38.213) - nr_ra_succeeded(mod_id, frame, nr_slot_tx); + if(ra->cfra) { + // Reset RA_active flag: it disables Msg3 retransmission (8.3 of TS 38.213) + nr_ra_succeeded(mod_id, frame, nr_slot_tx); + } else { + ra->generate_nr_prach = GENERATE_IDLE; + } } else if (ra->RA_window_cnt == 0 && !ra->RA_RAPID_found) { @@ -638,7 +640,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ra->RA_backoff_cnt--; - if ((ra->RA_backoff_cnt > 0 && ra->generate_nr_prach == 1) || ra->RA_backoff_cnt == 0){ + if ((ra->RA_backoff_cnt > 0 && ra->generate_nr_prach == GENERATE_PREAMBLE) || ra->RA_backoff_cnt == 0){ nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); } @@ -650,7 +652,11 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, nr_ue_contention_resolution(mod_id, CC_id, frame, nr_slot_tx, prach_resources); } - return ra->generate_nr_prach; + if(ra->generate_nr_prach != GENERATE_IDLE) { + return ra->generate_nr_prach; + } else { + return ra->ra_state; + } } @@ -744,6 +750,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){ LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CF-RA: RAR successfully received.\n", mod_id, frame, slot); ra->RA_window_cnt = -1; + mac->crnti = ra->t_crnti; } else { @@ -751,6 +758,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){ ra->RA_contention_resolution_cnt = -1; ra->RA_contention_resolution_timer_active = 0; + mac->crnti = ra->t_crnti; ra->t_crnti = 0; LOG_D(MAC, "In %s: [UE %d][%d.%d] CB-RA: cleared contention resolution timer...\n", __FUNCTION__, mod_id, frame, slot); @@ -759,7 +767,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){ LOG_D(MAC, "In %s: [UE %d] clearing RA_active flag...\n", __FUNCTION__, mod_id); ra->RA_active = 0; - ra->generate_nr_prach = 2; + ra->generate_nr_prach = GENERATE_IDLE; ra->ra_state = RA_SUCCEEDED; } @@ -774,8 +782,9 @@ void nr_ra_failed(uint8_t mod_id, uint8_t CC_id, NR_PRACH_RESOURCES_t *prach_res NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; - ra->first_Msg3 = 0; - ra->generate_nr_prach = 3; + ra->first_Msg3 = 1; + ra->ra_PreambleIndex = -1; + ra->generate_nr_prach = RA_FAILED; ra->ra_state = RA_UE_IDLE; prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER++; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 11edc6c20d..f879599f7d 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -49,8 +49,6 @@ // #define DEBUG_DCI -dci_pdu_rel15_t *def_dci_pdu_rel15; - void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) { LOG_D(MAC,"Filling search candidates for DCI\n"); @@ -72,7 +70,6 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t uint16_t monitoringSymbolsWithinSlot = 0; uint8_t coreset_id = 1; int sps = 0; - def_dci_pdu_rel15 = calloc(1,2*sizeof(dci_pdu_rel15_t)); AssertFatal(mac->scc != NULL, "scc is null\n"); NR_BWP_Id_t bwp_id = mac->DL_BWP_Id; NR_ServingCellConfigCommon_t *scc = mac->scc; @@ -88,7 +85,11 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t } else { ss = mac->search_space_zero; coreset = mac->coreset0; - rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + if(rnti_type == NR_RNTI_SI) { + rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1; + } else { + rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG_CSET_0; + } } rel15->coreset.duration = coreset->duration; @@ -135,7 +136,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing; for (int i = 0; i < rel15->num_dci_options; i++) { - rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15+i, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id); + rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id); } break; case NR_RNTI_RA: @@ -144,15 +145,27 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); rel15->rnti = ra->ra_rnti; rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); //NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275); + if (get_softmodem_params()->sa) { + rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } else { // NSA mode is not using the Initial BWP + rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing; - rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id); + rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id); break; case NR_RNTI_P: break; case NR_RNTI_CS: break; case NR_RNTI_TC: + // we use the initial DL BWP + sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12; + monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + rel15->rnti = ra->t_crnti; + rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing; + rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[0]], rel15->dci_format_options[0], NR_RNTI_TC, rel15->BWPSize, bwp_id); break; case NR_RNTI_SP_CSI: break; @@ -169,7 +182,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; for (int i = 0; i < rel15->num_dci_options; i++) { - rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); + rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); } break; case NR_RNTI_SFI: @@ -245,14 +258,22 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){ switch(ra->ra_state){ case WAIT_RAR: - LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space\n"); - rel15->num_dci_options = 1; - rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; - config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id); - fill_dci_search_candidates(ss, rel15); - break; + LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg2)\n"); + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + if (get_softmodem_params()->sa) { + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, -1); + } else { + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id); + } + fill_dci_search_candidates(ss, rel15); + break; case WAIT_CONTENTION_RESOLUTION: - LOG_E(MAC, "In %s: CB-RA not implemented yet. Should not have fallen in this case.\n", __FUNCTION__); + LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg4)\n"); + rel15->num_dci_options = 1; + rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; + config_dci_pdu(mac, rel15, dl_config, NR_RNTI_TC, -1); + fill_dci_search_candidates(ss, rel15); break; default: break; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index cb104092f1..adbf7a5774 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -73,10 +73,10 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti){ if (rnti == ra->ra_rnti) { rnti_type = NR_RNTI_RA; + } else if (rnti == ra->t_crnti && (ra->ra_state == WAIT_RAR || ra->ra_state == WAIT_CONTENTION_RESOLUTION) ) { + rnti_type = NR_RNTI_TC; } else if (rnti == mac->crnti) { rnti_type = NR_RNTI_C; - } else if (rnti == ra->t_crnti) { - rnti_type = NR_RNTI_TC; } else if (rnti == 0xFFFE) { rnti_type = NR_RNTI_P; } else if (rnti == 0xFFFF) { @@ -101,11 +101,12 @@ int8_t nr_ue_decode_mib(module_id_t module_id, void *pduP, uint16_t cell_id) { - LOG_I(MAC,"[L2][MAC] decode mib\n"); + LOG_D(MAC,"[L2][MAC] decode mib\n"); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); - - nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU + NR_ServingCellConfigCommon_t *scc = mac->scc; + frequency_range_t frequency_range; + nr_mac_rrc_data_ind_ue( module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_BCH, (uint8_t *) pduP, 3 ); // fixed 3 bytes MIB PDU AssertFatal(mac->mib != NULL, "nr_ue_decode_mib() mac->mib == NULL\n"); //if(mac->mib != NULL){ @@ -120,9 +121,11 @@ int8_t nr_ue_decode_mib(module_id_t module_id, frame = frame << 4; frame = frame | frame_number_4lsb; if(ssb_length == 64){ + frequency_range = FR2; for (int i=0; i<3; i++) ssb_index += (((extra_bits>>(7-i))&0x01)<<(3+i)); }else{ + frequency_range = FR1; if(ssb_subcarrier_offset_msb){ ssb_subcarrier_offset = ssb_subcarrier_offset | 0x10; } @@ -141,13 +144,37 @@ int8_t nr_ue_decode_mib(module_id_t module_id, //storing ssb index in the mac structure mac->mib_ssb = ssb_index; - get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, mac->mib, extra_bits, ssb_length, ssb_index, - mac->phy_config.config_req.ssb_table.ssb_offset_point_a); + if (get_softmodem_params()->sa == 1) { + + // TODO these values shouldn't be taken from SCC in SA + uint8_t scs_ssb = *scc->ssbSubcarrierSpacing; + uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + int scs_scaling = 1<downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000) + scs_scaling = scs_scaling*3; + if (scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666) + scs_scaling = scs_scaling>>2; + uint32_t absolute_diff = (*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); + + uint16_t ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index); + + get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config, + frame, + mac->mib, + nr_slots_per_frame[scs_ssb], + ssb_subcarrier_offset, + ssb_start_symbol, + scs_ssb, + frequency_range, + ssb_index, + absolute_diff/(12*scs_scaling)-10); + + + mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; + mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c; + mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; + } - ssb_index = mac->type0_PDCCH_CSS_config.ssb_index; // TODO: ssb_index should obtain from L1 in case Lssb != 64 - mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern; - mac->type0_pdcch_ss_sfn_c = mac->type0_PDCCH_CSS_config.sfn_c; - mac->type0_pdcch_ss_n_c = mac->type0_PDCCH_CSS_config.n_c; mac->dl_config_request.sfn = mac->type0_PDCCH_CSS_config.frame; mac->dl_config_request.slot = (ssb_index>>1) + ((ssb_index>>4)<<1); // not valid for 240kHz SCS @@ -161,7 +188,7 @@ int8_t nr_ue_decode_BCCH_DL_SCH(module_id_t module_id, uint8_t *pduP, uint32_t pdu_len) { LOG_D(NR_MAC, "Decoding NR-BCCH-DL-SCH-Message (SIB1 or SI)\n"); - nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); + nr_mac_rrc_data_ind_ue(module_id, cc_id, gNB_index, 0, 0, 0, NR_BCCH_DL_SCH, (uint8_t *) pduP, pdu_len); return 0; } @@ -237,85 +264,15 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu, - uint8_t time_domain_ind - ){ + uint8_t time_domain_ind, + bool use_default){ + int dmrs_typeA_pos = mac->scc->dmrs_TypeA_Position; // uint8_t k_offset=0; uint8_t sliv_S=0; uint8_t sliv_L=0; - uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?12:11}, // row index 1 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?10:9}, // row index 2 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?9:8}, // row index 3 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?7:6}, // row index 4 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?5:4}, // row index 5 - {0,(dmrs_typeA_pos == 0)?9:10,(dmrs_typeA_pos == 0)?4:4}, // row index 6 - {0,(dmrs_typeA_pos == 0)?4:6, (dmrs_typeA_pos == 0)?4:4}, // row index 7 - {0,5,7}, // row index 8 - {0,5,2}, // row index 9 - {0,9,2}, // row index 10 - {0,12,2}, // row index 11 - {0,1,13}, // row index 12 - {0,1,6}, // row index 13 - {0,2,4}, // row index 14 - {0,4,7}, // row index 15 - {0,8,4} // row index 16 - }; - /*uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?6:5}, // row index 1 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?10:9}, // row index 2 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?9:8}, // row index 3 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?7:6}, // row index 4 - {0,(dmrs_typeA_pos == 0)?2:3, (dmrs_typeA_pos == 0)?5:4}, // row index 5 - {0,(dmrs_typeA_pos == 0)?6:8, (dmrs_typeA_pos == 0)?4:2}, // row index 6 - {0,(dmrs_typeA_pos == 0)?4:6, (dmrs_typeA_pos == 0)?4:4}, // row index 7 - {0,5,6}, // row index 8 - {0,5,2}, // row index 9 - {0,9,2}, // row index 10 - {0,10,2}, // row index 11 - {0,1,11}, // row index 12 - {0,1,6}, // row index 13 - {0,2,4}, // row index 14 - {0,4,6}, // row index 15 - {0,8,4} // row index 16 - };*/ - /*uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 - {0,2,2}, // row index 1 - {0,4,2}, // row index 2 - {0,6,2}, // row index 3 - {0,8,2}, // row index 4 - {0,10,2}, // row index 5 - {1,2,2}, // row index 6 - {1,4,2}, // row index 7 - {0,2,4}, // row index 8 - {0,4,4}, // row index 9 - {0,6,4}, // row index 10 - {0,8,4}, // row index 11 - {0,10,4}, // row index 12 - {0,2,7}, // row index 13 - {0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14 - {1,2,4}, // row index 15 - {0,0,0} // row index 16 - };*/ - /*uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C[16][3]={ // for PDSCH from TS 38.214 subclause 5.1.2.1.1 - {0,2,2}, // row index 1 - {0,4,2}, // row index 2 - {0,6,2}, // row index 3 - {0,8,2}, // row index 4 - {0,10,2}, // row index 5 - {0,0,0}, // row index 6 - {0,0,0}, // row index 7 - {0,2,4}, // row index 8 - {0,4,4}, // row index 9 - {0,6,4}, // row index 10 - {0,8,4}, // row index 11 - {0,10,4}, // row index 12 - {0,2,7}, // row index 13 - {0,(dmrs_typeA_pos == 0)?2:3,(dmrs_typeA_pos == 0)?12:11}, // row index 14 - {0,0,6}, // row index 15 - {0,2,6} // row index 16 - };*/ uint8_t mu_pusch = 1; + // definition table j Table 6.1.2.1.1-4 uint8_t j = (mu_pusch==3)?3:(mu_pusch==2)?2:1; uint8_t table_6_1_2_1_1_2_time_dom_res_alloc_A[16][3]={ // for PUSCH from TS 38.214 subclause 6.1.2.1.1 @@ -364,7 +321,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - if (pdsch_TimeDomainAllocationList) { + if (pdsch_TimeDomainAllocationList && use_default==false) { if (time_domain_ind >= pdsch_TimeDomainAllocationList->list.count) { LOG_E(MAC, "time_domain_ind %d >= pdsch->TimeDomainAllocationList->list.count %d\n", @@ -387,8 +344,15 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, } else {// Default configuration from tables // k_offset = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; - sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][1]; - sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][2]; + + if(dmrs_typeA_pos == 0) { + sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[time_domain_ind][1]; + sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[time_domain_ind][2]; + } else { + sliv_S = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[time_domain_ind][1]; + sliv_L = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[time_domain_ind][2]; + } + // k_offset = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0]; // sliv_S = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1]; // sliv_L = table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2]; @@ -413,7 +377,7 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; } - if (pusch_TimeDomainAllocationList) { + if (pusch_TimeDomainAllocationList && use_default==false) { if (time_domain_ind >= pusch_TimeDomainAllocationList->list.count) { LOG_E(MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n", time_domain_ind, pusch_TimeDomainAllocationList->list.count); @@ -430,8 +394,8 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, } else { // k_offset = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][0]; - sliv_S = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][1]; - sliv_L = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind-1][2]; + sliv_S = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind][1]; + sliv_L = table_6_1_2_1_1_2_time_dom_res_alloc_A[time_domain_ind][2]; // k_offset = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][0]; // sliv_S = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][1]; // sliv_L = table_6_1_2_1_1_3_time_dom_res_alloc_A_extCP[nr_pdci_info_extracted->time_dom_resource_assignment][2]; @@ -449,8 +413,9 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n", dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits); - uint32_t dci_format = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15); - return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci->rnti, dci_format)); + if (nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, &mac->def_dci_pdu_rel15[dci->dci_format])) + return -1; + return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, &mac->def_dci_pdu_rel15[dci->dci_format], dci->rnti, dci->dci_format)); } int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, uint16_t rnti, uint8_t dci_format){ @@ -469,7 +434,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr AssertFatal(mac->DLbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n"); AssertFatal(mac->ULbwp[0]!=NULL,"DLbwp[0] should not be zero here!\n"); - const uint16_t n_RB_DLBWP = (ra->ra_state == WAIT_RAR) ? NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) : NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const uint16_t n_RB_DLBWP = (ra->ra_state == WAIT_RAR || ra->ra_state == WAIT_CONTENTION_RESOLUTION) ? NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) : NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); LOG_D(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP); @@ -515,10 +480,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr // Config PUSCH PDU ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format); - if (ret != -1 && ra->RA_active && mac->crnti){ - nr_ra_succeeded(module_id, frame, slot); - } - } break; @@ -578,10 +539,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr // Config PUSCH PDU ret = nr_config_pusch_pdu(mac, pusch_config_pdu, dci, NULL, rnti, &dci_format); - if (ret != -1 && ra->RA_active && mac->crnti){ - nr_ra_succeeded(module_id, frame, slot); - } - } break; } @@ -640,7 +597,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; - NR_PDSCH_Config_t *pdsch_config=mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup; + NR_PDSCH_Config_t *pdsch_config = NULL; uint16_t BWPSize = 0; if(rnti == SI_RNTI) { @@ -648,7 +605,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; dlsch_config_pdu_1_0->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; dlsch_config_pdu_1_0->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; // For PDSCH with mapping type A, the UE shall assume dmrs-AdditionalPosition='pos2' BWPSize = dlsch_config_pdu_1_0->BWPSize; } else { if (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti){ @@ -656,9 +612,20 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr } else { dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; } - dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + if( (ra->RA_window_cnt >= 0 && rnti == ra->ra_rnti) || (rnti == ra->t_crnti) ) { + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + if (get_softmodem_params()->sa) { + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } else { // NSA mode is not using the Initial BWP + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + pdsch_config = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup; + } + } else { + dlsch_config_pdu_1_0->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + dlsch_config_pdu_1_0->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing; + pdsch_config = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup; + } BWPSize = n_RB_DLBWP; } @@ -669,15 +636,30 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr return -1; } /* TIME_DOM_RESOURCE_ASSIGNMENT */ - if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val) < 0) { + if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_0,dci->time_domain_assignment.val,rnti==SI_RNTI) < 0) { LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot); return -1; } + + NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL; + if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; + else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + + int mappingtype = pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType; + /* dmrs symbol positions*/ - dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config, + dlsch_config_pdu_1_0->dlDmrsSymbPos = fill_dmrs_mask(NULL, mac->scc->dmrs_TypeA_Position, - dlsch_config_pdu_1_0->start_symbol+dlsch_config_pdu_1_0->number_symbols); - dlsch_config_pdu_1_0->dmrsConfigType = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + dlsch_config_pdu_1_0->number_symbols, + dlsch_config_pdu_1_0->start_symbol, + mappingtype); + + // For DCI 1_0, dmrs type is type1. referred to section 5.1.6.2 of 3GPP TS 38.214 + dlsch_config_pdu_1_0->dmrsConfigType = 0; + LOG_D(MAC, "DCI 1_0 start_sym:%d NR Symb:%d, DMRS_symb_pos:%x\n", dlsch_config_pdu_1_0->start_symbol, dlsch_config_pdu_1_0->number_symbols, dlsch_config_pdu_1_0->dlDmrsSymbPos); + /* number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214 version 15.9.0 Release 15 */ if (dlsch_config_pdu_1_0->number_symbols == 2) dlsch_config_pdu_1_0->n_dmrs_cdm_groups = 1; @@ -686,7 +668,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr /* VRB_TO_PRB_MAPPING */ dlsch_config_pdu_1_0->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved; /* MCS TABLE INDEX */ - dlsch_config_pdu_1_0->mcs_table = (pdsch_config->mcs_Table) ? (*pdsch_config->mcs_Table + 1) : 0; + dlsch_config_pdu_1_0->mcs_table = (pdsch_config) ? ((pdsch_config->mcs_Table) ? (*pdsch_config->mcs_Table + 1) : 0) : 0; /* MCS */ dlsch_config_pdu_1_0->mcs = dci->mcs; // Basic sanity check for MCS value to check for a false or erroneous DCI @@ -739,7 +721,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr } /* PDSCH_TO_HARQ_FEEDBACK_TIME_IND (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI)*/ - dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = dci->pdsch_to_harq_feedback_timing_indicator.val; + dlsch_config_pdu_1_0->pdsch_to_harq_feedback_time_ind = mac->ULbwp[mac->UL_BWP_Id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0]; LOG_D(MAC,"(nr_ue_procedures.c) rnti = %x dl_config->number_pdus = %d\n", dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti, @@ -769,6 +751,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr LOG_D(MAC,"(nr_ue_procedures.c) pdu_type=%d\n\n",dl_config->dl_config_list[dl_config->number_pdus].pdu_type); dl_config->number_pdus = dl_config->number_pdus + 1; + break; } @@ -814,10 +797,6 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DLSCH; dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; - // FIXME: fix number of additional dmrs - if(pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition == NULL) - pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition=calloc(1,sizeof(*pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition)); - fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_1 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; dlsch_config_pdu_1_1->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -834,20 +813,31 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr return -1; } /* TIME_DOM_RESOURCE_ASSIGNMENT */ - if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val) < 0) { + if (nr_ue_process_dci_time_dom_resource_assignment(mac,NULL,dlsch_config_pdu_1_1,dci->time_domain_assignment.val,false) < 0) { LOG_W(MAC, "[%d.%d] Invalid time_domain_assignment. Possibly due to false DCI. Ignoring DCI!\n", frame, slot); return -1; } + + NR_PDSCH_TimeDomainResourceAllocationList_t *pdsch_TimeDomainAllocationList = NULL; + if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList->choice.setup; + else if (mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList) + pdsch_TimeDomainAllocationList = mac->DLbwp[0]->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + + int mappingtype = pdsch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType; + /* dmrs symbol positions*/ dlsch_config_pdu_1_1->dlDmrsSymbPos = fill_dmrs_mask(pdsch_config, mac->scc->dmrs_TypeA_Position, - dlsch_config_pdu_1_1->number_symbols); + dlsch_config_pdu_1_1->number_symbols, + dlsch_config_pdu_1_1->start_symbol, + mappingtype); dlsch_config_pdu_1_1->dmrsConfigType = mac->DLbwp[dl_bwp_id-1]->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; /* TODO: fix number of DM-RS CDM groups without data according to subclause 5.1.6.2 of 3GPP TS 38.214, using tables 7.3.1.2.2-1, 7.3.1.2.2-2, 7.3.1.2.2-3, 7.3.1.2.2-4 of 3GPP TS 38.212 */ dlsch_config_pdu_1_1->n_dmrs_cdm_groups = 1; /* VRB_TO_PRB_MAPPING */ - if (mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.resource_allocation != 0) + if ((pdsch_config->resourceAllocation == 1) && (pdsch_config->vrb_ToPRB_Interleaver != NULL)) dlsch_config_pdu_1_1->vrb_to_prb_mapping = (dci->vrb_to_prb_mapping.val == 0) ? vrb_to_prb_mapping_non_interleaved:vrb_to_prb_mapping_interleaved; /* PRB_BUNDLING_SIZE_IND */ dlsch_config_pdu_1_1->prb_bundling_size_ind = dci->prb_bundling_size_indicator.val; @@ -906,11 +896,22 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr /* PDSCH_TO_HARQ_FEEDBACK_TIME_IND */ // according to TS 38.213 Table 9.2.3-1 NR_BWP_Id_t ul_bwp_id = mac->UL_BWP_Id; - dlsch_config_pdu_1_1->pdsch_to_harq_feedback_time_ind = mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0]; + dlsch_config_pdu_1_1->pdsch_to_harq_feedback_time_ind = + mac->ULbwp[ul_bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->dl_DataToUL_ACK->list.array[dci->pdsch_to_harq_feedback_timing_indicator.val][0]; + /* ANTENNA_PORTS */ uint8_t n_codewords = 1; // FIXME!!! - if ((mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.dmrs_dl_for_pdsch_mapping_type_a.dmrs_type == 1) && - (mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.dmrs_dl_for_pdsch_mapping_type_a.max_length == 1)){ + long *max_length = NULL; + long *dmrs_type = NULL; + if (pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA) { + max_length = pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength; + dmrs_type = pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type; + } + if (pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeB) { + max_length = pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->maxLength; + dmrs_type = pdsch_config->dmrs_DownlinkForPDSCH_MappingTypeB->choice.setup->dmrs_Type; + } + if ((dmrs_type == NULL) && (max_length == NULL)){ // Table 7.3.1.2.2-1: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=1 dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_1[dci->antenna_ports.val][0]; dlsch_config_pdu_1_1->dmrs_ports[0] = table_7_3_2_3_3_1[dci->antenna_ports.val][1]; @@ -918,8 +919,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_1->dmrs_ports[2] = table_7_3_2_3_3_1[dci->antenna_ports.val][3]; dlsch_config_pdu_1_1->dmrs_ports[3] = table_7_3_2_3_3_1[dci->antenna_ports.val][4]; } - if ((mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.dmrs_dl_for_pdsch_mapping_type_a.dmrs_type == 1) && - (mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.dmrs_dl_for_pdsch_mapping_type_a.max_length == 2)){ + if ((dmrs_type == NULL) && (max_length != NULL)){ // Table 7.3.1.2.2-2: Antenna port(s) (1000 + DMRS port), dmrs-Type=1, maxLength=2 if (n_codewords == 1) { dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_2_oneCodeword[dci->antenna_ports.val][0]; @@ -942,8 +942,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_1->n_front_load_symb = table_7_3_2_3_3_2_twoCodeword[dci->antenna_ports.val][9]; } } - if ((mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.dmrs_dl_for_pdsch_mapping_type_a.dmrs_type == 2) && - (mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.dmrs_dl_for_pdsch_mapping_type_a.max_length == 1)){ + if ((dmrs_type != NULL) && (max_length == NULL)){ // Table 7.3.1.2.2-3: Antenna port(s) (1000 + DMRS port), dmrs-Type=2, maxLength=1 if (n_codewords == 1) { dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_3_oneCodeword[dci->antenna_ports.val][0]; @@ -962,8 +961,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dlsch_config_pdu_1_1->dmrs_ports[5] = table_7_3_2_3_3_3_twoCodeword[dci->antenna_ports.val][6]; } } - if ((mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.dmrs_dl_for_pdsch_mapping_type_a.dmrs_type == 2) && - (mac->phy_config.config_req.dl_bwp_dedicated.pdsch_config_dedicated.dmrs_dl_for_pdsch_mapping_type_a.max_length == 2)){ + if ((dmrs_type != NULL) && (max_length != NULL)){ // Table 7.3.1.2.2-4: Antenna port(s) (1000 + DMRS port), dmrs-Type=2, maxLength=2 if (n_codewords == 1) { dlsch_config_pdu_1_1->n_dmrs_cdm_groups = table_7_3_2_3_3_4_oneCodeword[dci->antenna_ports.val][0]; @@ -1129,11 +1127,11 @@ int get_n_rb(NR_UE_MAC_INST_t *mac, int rnti_type){ } uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, - uint8_t dci_format, - uint8_t dci_size, - uint16_t rnti, - uint64_t *dci_pdu, - dci_pdu_rel15_t *dci_pdu_rel15) { + uint8_t dci_format, + uint8_t dci_size, + uint16_t rnti, + uint64_t *dci_pdu, + dci_pdu_rel15_t *dci_pdu_rel15) { int rnti_type = get_rnti_type(mac, rnti); @@ -1147,32 +1145,6 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, int pos=0; int fsize=0; - if (rnti_type == NR_RNTI_C) { - // First find out the DCI format from the first bit (UE performed blind decoding) - pos++; - dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; -#ifdef DEBUG_EXTRACT_DCI - LOG_D(MAC,"Format indicator %d (%d bits) N_RB_BWP %d => %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,N_RB,dci_size-pos,*dci_pdu); -#endif - - if (dci_format == NR_UL_DCI_FORMAT_0_0 || dci_format == NR_DL_DCI_FORMAT_1_0) { - if (dci_pdu_rel15->format_indicator == 0) - dci_format = NR_UL_DCI_FORMAT_0_0; - else - dci_format = NR_DL_DCI_FORMAT_1_0; - } - else if (dci_format == NR_UL_DCI_FORMAT_0_1 || dci_format == NR_DL_DCI_FORMAT_1_1) { - // In case the sizes of formats 0_1 and 1_1 happen to be the same - if (dci_pdu_rel15->format_indicator == 0) - dci_format = NR_UL_DCI_FORMAT_0_1; - else - dci_format = NR_DL_DCI_FORMAT_1_1; - } - } -#ifdef DEBUG_EXTRACT_DCI - LOG_D(MAC, "DCI format is %d\n", dci_format); -#endif - switch(dci_format) { case NR_DL_DCI_FORMAT_1_0: @@ -1213,7 +1185,15 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; case NR_RNTI_C: - + + //Identifier for DCI formats + pos++; + dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; + if (dci_pdu_rel15->format_indicator == 0) + return 1; // discard dci, format indicator not corresponding to dci_format +#ifdef DEBUG_EXTRACT_DCI + LOG_D(MAC,"Format indicator %d (%d bits) N_RB_BWP %d => %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,N_RB,dci_size-pos,*dci_pdu); +#endif // Freq domain assignment (275rb >> fsize = 16) fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); pos+=fsize; @@ -1323,7 +1303,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, } //end else break; - + case NR_RNTI_P: /* // Short Messages Indicator  E2 bits @@ -1392,39 +1372,74 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; case NR_RNTI_TC: - // indicating a DL DCI format 1bit + + // indicating a DL DCI format - 1 bit pos++; dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; - // Freq domain assignment 0-16 bit + + if (dci_pdu_rel15->format_indicator == 0) + return 1; // discard dci, format indicator not corresponding to dci_format + + // Freq domain assignment 0-16 bit fsize = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) ); pos+=fsize; dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf; - // VRB to PRB mapping 1 bit + + // VRB to PRB mapping - 1 bit + pos++; dci_pdu_rel15->vrb_to_prb_mapping.val = (*dci_pdu>>(dci_size-pos))&1; + // MCS 5bit //bit over 32, so dci_pdu ++ pos+=5; dci_pdu_rel15->mcs = (*dci_pdu>>(dci_size-pos))&0x1f; - // New data indicator 1bit + + // New data indicator - 1 bit + pos++; dci_pdu_rel15->ndi = (*dci_pdu>>(dci_size-pos))&1; - // Redundancy version 2bit + + // Redundancy version - 2 bits pos+=2; dci_pdu_rel15->rv = (*dci_pdu>>(dci_size-pos))&3; - // HARQ process number 4bit + + // HARQ process number - 4 bits pos+=4; dci_pdu_rel15->harq_pid = (*dci_pdu>>(dci_size-pos))&0xf; - // Downlink assignment index  E2 bits + + // Downlink assignment index - 2 bits pos+=2; dci_pdu_rel15->dai[0].val = (*dci_pdu>>(dci_size-pos))&3; - // TPC command for scheduled PUCCH  E2 bits + + // TPC command for scheduled PUCCH - 2 bits pos+=2; dci_pdu_rel15->tpc = (*dci_pdu>>(dci_size-pos))&3; - // PDSCH-to-HARQ_feedback timing indicator  E3 bits + + // PUCCH resource indicator - 3 bits + pos+=3; + dci_pdu_rel15->pucch_resource_indicator = (*dci_pdu>>(dci_size-pos))&7; + + // PDSCH-to-HARQ_feedback timing indicator - 3 bits pos+=3; dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = (*dci_pdu>>(dci_size-pos))&7; - + + LOG_D(NR_MAC,"N_RB = %i\n", N_RB); + LOG_D(NR_MAC,"dci_size = %i\n", dci_size); + LOG_D(NR_MAC,"fsize = %i\n", fsize); + LOG_D(NR_MAC,"dci_pdu_rel15->format_indicator = %i\n", dci_pdu_rel15->format_indicator); + LOG_D(NR_MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + LOG_D(NR_MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + LOG_D(NR_MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + LOG_D(NR_MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + LOG_D(NR_MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + LOG_D(NR_MAC,"dci_pdu_rel15->harq_pid = %i\n", dci_pdu_rel15->harq_pid); + LOG_D(NR_MAC,"dci_pdu_rel15->dai[0].val = %i\n", dci_pdu_rel15->dai[0].val); + LOG_D(NR_MAC,"dci_pdu_rel15->tpc = %i\n", dci_pdu_rel15->tpc); + LOG_D(NR_MAC,"dci_pdu_rel15->pucch_resource_indicator = %i\n", dci_pdu_rel15->pucch_resource_indicator); + LOG_D(NR_MAC,"dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = %i\n", dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val); + break; } break; @@ -1433,6 +1448,11 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, switch(rnti_type) { case NR_RNTI_C: + //Identifier for DCI formats + pos++; + dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; + if (dci_pdu_rel15->format_indicator == 1) + return 1; // discard dci, format indicator not corresponding to dci_format fsize = (int)ceil( log2( (N_RB_UL*(N_RB_UL+1))>>1 ) ); pos+=fsize; dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<format_indicator = (*dci_pdu>>(dci_size-pos))&1; + if (dci_pdu_rel15->format_indicator == 0) + return 1; // discard dci, format indicator not corresponding to dci_format // Carrier indicator pos+=dci_pdu_rel15->carrier_indicator.nbits; dci_pdu_rel15->carrier_indicator.val = (*dci_pdu>>(dci_size-pos))&((1<carrier_indicator.nbits)-1); @@ -1593,6 +1618,11 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, switch(rnti_type) { case NR_RNTI_C: + //Identifier for DCI formats + pos++; + dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1; + if (dci_pdu_rel15->format_indicator == 1) + return 1; // discard dci, format indicator not corresponding to dci_format // Carrier indicator pos+=dci_pdu_rel15->carrier_indicator.nbits; dci_pdu_rel15->carrier_indicator.val = (*dci_pdu>>(dci_size-pos))&((1<carrier_indicator.nbits)-1); @@ -1701,7 +1731,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, break; } - return dci_format; + return 0; } /////////////////////////////////// @@ -1746,7 +1776,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, frame_t frameP = dl_info->frame; int slot = dl_info->slot; uint8_t *pduP = (dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu; - uint16_t pdu_len = (dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu_length; + int32_t pdu_len = (dl_info->rx_ind->rx_indication_body + pdu_id)->pdsch_pdu.pdu_length; uint8_t gNB_index = dl_info->gNB_index; uint8_t CC_id = dl_info->cc_id; uint8_t done = 0; @@ -1757,7 +1787,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, return; } - LOG_D(MAC, "In %s [%d.%d]: processing PDU %d of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, dl_info->rx_ind->number_pdus); + LOG_D(MAC, "In %s [%d.%d]: processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, pdu_len, dl_info->rx_ind->number_pdus); while (!done && pdu_len > 0){ mac_ce_len = 0x0000; @@ -1773,16 +1803,41 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, // MAC CE case DL_SCH_LCID_CCCH: - // MSG4 RRC Connection Setup 38.331 - // varialbe length - mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; + // MSG4 RRC Setup 38.331 + // variable length + if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ + mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8) + | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff); + mac_subheader_len = 3; + } else { + mac_sdu_len = ((NR_MAC_SUBHEADER_SHORT *) pduP)->L; mac_subheader_len = 2; - if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ - mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; - mac_subheader_len = 3; - } + } + // Check if it is a valid CCCH message, we get all 00's messages very often + int i = 0; + for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) { + if(pduP[i] != 0) { + break; + } + } + if (i == (mac_subheader_len+mac_sdu_len)) { + LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len); + done = 1; break; + } + + if ( mac_sdu_len > 0 ) { + LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_sdu_len); + for (int i = 0; i < mac_subheader_len; i++) { + LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]); + } + for (int i = 0; i < mac_sdu_len; i++) { + LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[mac_subheader_len + i]); + } + nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_sdu_len); + } + break; case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH: @@ -1889,17 +1944,34 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, break; case DL_SCH_LCID_CON_RES_ID: - // Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16 - // WIP todo: handle CCCH_pdu - mac_ce_len = 6; - - LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution msg: %x.%x.%x.%x.%x.%x, Terminating RA procedure\n", module_idP, frameP, pduP[0], pduP[1], pduP[2], pduP[3], pduP[4], pduP[5]); + // Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16 + // MAC Header: 1 byte (R/R/LCID) + // MAC SDU: 6 bytes (UE Contention Resolution Identity) + mac_ce_len = 6; - if (ra->RA_active == 1) { - nr_ra_succeeded(module_idP, frameP, slot); + if(ra->ra_state == WAIT_CONTENTION_RESOLUTION) { + LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution identity: 0x%02x%02x%02x%02x%02x%02x Terminating RA procedure\n", + module_idP, frameP, pduP[1], pduP[2], pduP[3], pduP[4], pduP[5], pduP[6]); + + bool ra_success = true; + for(int i = 0; icont_res_id[i] != pduP[i+1]) { + ra_success = false; + break; + } } - break; + if ( (ra->RA_active == 1) && ra_success) { + nr_ra_succeeded(module_idP, frameP, slot); + } else if (!ra_success){ + // TODO: Handle failure of RA procedure @ MAC layer + // nr_ra_failed(module_idP, CC_id, prach_resources, frameP, slot); // prach_resources is a PHY structure + ra->ra_state = RA_UE_IDLE; + ra->RA_active = 0; + } + } + + break; case DL_SCH_LCID_PADDING: done = 1; // end of MAC PDU, can ignore the rest. @@ -1961,7 +2033,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len ); pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len ); if (pdu_len < 0) - LOG_E(MAC, "[MAC] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!\n", pdu_len); + LOG_E(MAC, "[UE %d][%d.%d] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!\n", module_idP, frameP, slot, pdu_len); } } @@ -2017,8 +2089,9 @@ uint16_t nr_generate_ulsch_pdu(uint8_t *sdus_payload, last_size = 3; } } else { // UL CCCH SDU - mac_pdu_ptr->R = 0; - mac_pdu_ptr->LCID = sdu_lcids[i]; + ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->R = 0; + ((NR_MAC_SUBHEADER_FIXED *) mac_pdu_ptr)->LCID = sdu_lcids[i]; + last_size = 1; } mac_pdu_ptr += last_size; @@ -2194,27 +2267,32 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer uint8_t preamble_index = get_ra_PreambleIndex(mod_id, cc_id, gNB_id); //prach_resources->ra_PreambleIndex; - LOG_D(MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index); + LOG_D(NR_MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index); while (1) { n_subheaders++; if (rarh->T == 1) { n_subPDUs++; - LOG_D(MAC, "[UE %d][RAPROC] Got RAPID RAR subPDU\n", mod_id); + LOG_I(NR_MAC, "[UE %d][RAPROC] Got RAPID RAR subPDU\n", mod_id); } else { - n_subPDUs++; ra->RA_backoff_indicator = table_7_2_1[((NR_RA_HEADER_BI *)rarh)->BI]; ra->RA_BI_found = 1; - LOG_D(MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d\n", mod_id, ra->RA_backoff_indicator); + LOG_I(NR_MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d ms\n", mod_id, ra->RA_backoff_indicator); + if ( ((NR_RA_HEADER_BI *)rarh)->E == 1) { + rarh += sizeof(NR_RA_HEADER_BI); + continue; + } else { + break; + } } if (rarh->RAPID == preamble_index) { - LOG_I(MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID); + LOG_I(NR_MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID); rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR)); ra->RA_RAPID_found = 1; break; } if (rarh->E == 0) { - LOG_W(PHY,"[UE %d][RAPROC] Received RAR preamble (%d) doesn't match the intended RAPID...\n", mod_id, preamble_index); + LOG_W(NR_MAC,"[UE %d][RAPROC][%d.%d] Received RAR preamble (%d) doesn't match the intended RAPID (%d)\n", mod_id, frame, slot, rarh->RAPID, preamble_index); break; } else { rarh += sizeof(NR_MAC_RAR) + 1; @@ -2290,21 +2368,37 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t rnti = mac->crnti; } - #ifdef DEBUG_RAR - LOG_D(MAC, "In %s:[%d.%d]: [UE %d] Received RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n", - __FUNCTION__, - frame, - slot, - mod_id, - rar_grant.Msg3_t_alloc, - rar_grant.Msg3_f_alloc, - ul_time_alignment->ta_command, - rar_grant.mcs, - rar_grant.freq_hopping, - tpc_command, - csi_req, - ra->t_crnti); - #endif +#ifdef DEBUG_RAR + LOG_I(NR_MAC, "rarh->E = 0x%x\n", rarh->E); + LOG_I(NR_MAC, "rarh->T = 0x%x\n", rarh->T); + LOG_I(NR_MAC, "rarh->RAPID = 0x%x (%i)\n", rarh->RAPID, rarh->RAPID); + + LOG_I(NR_MAC, "rar->R = 0x%x\n", rar->R); + LOG_I(NR_MAC, "rar->TA1 = 0x%x\n", rar->TA1); + + LOG_I(NR_MAC, "rar->TA2 = 0x%x\n", rar->TA2); + LOG_I(NR_MAC, "rar->UL_GRANT_1 = 0x%x\n", rar->UL_GRANT_1); + + LOG_I(NR_MAC, "rar->UL_GRANT_2 = 0x%x\n", rar->UL_GRANT_2); + LOG_I(NR_MAC, "rar->UL_GRANT_3 = 0x%x\n", rar->UL_GRANT_3); + LOG_I(NR_MAC, "rar->UL_GRANT_4 = 0x%x\n", rar->UL_GRANT_4); + + LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1); + LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2); + + LOG_I(NR_MAC, "In %s:[%d.%d]: [UE %d] Received RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d t_crnti %x \n", + __FUNCTION__, + frame, + slot, + mod_id, + rar_grant.Msg3_t_alloc, + rar_grant.Msg3_f_alloc, + ul_time_alignment->ta_command, + rar_grant.mcs, + rar_grant.freq_hopping, + tpc_command, + ra->t_crnti); +#endif // Schedule Msg3 ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, rar_grant.Msg3_t_alloc); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index ad1958ef33..4932119a83 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -51,6 +51,8 @@ #include "asn1_conversions.h" #include "SIMULATION/TOOLS/sim.h" // for taus +#include + static prach_association_pattern_t prach_assoc_pattern; static ssb_list_info_t ssb_list; @@ -109,7 +111,11 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) { } k2 = *pusch_TimeDomainAllocationList->list.array[time_domain_ind]->k2; } - + + AssertFatal(k2 >= DURATION_RX_TO_TX, + "Slot offset K2 (%ld) cannot be less than DURATION_RX_TO_TX (%d)\n", + k2,DURATION_RX_TO_TX); + LOG_D(MAC, "get_k2(): k2 is %ld\n", k2); return k2; } @@ -145,14 +151,25 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, dci_pdu_rel15_t *dci) { - fapi_nr_pusch_config_dedicated_t *pusch_config_dedicated = &mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated; + NR_ServingCellConfigCommon_t *scc = mac->scc; NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup; + long transformPrecoder; + if (pusch_Config->transformPrecoder) + transformPrecoder = *pusch_Config->transformPrecoder; + else { + if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder) + transformPrecoder = NR_PUSCH_Config__transformPrecoder_enabled; + else + transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; + } + + /* PRECOD_NBR_LAYERS */ - if ((pusch_config_dedicated->tx_config == tx_config_nonCodebook)); + if ((*pusch_Config->txConfig == NR_PUSCH_Config__txConfig_nonCodebook)); // 0 bits if the higher layer parameter txConfig = nonCodeBook - if ((pusch_config_dedicated->tx_config == tx_config_codebook)){ + if ((*pusch_Config->txConfig == NR_PUSCH_Config__txConfig_codebook)){ uint8_t n_antenna_port = 0; //FIXME!!! @@ -161,43 +178,43 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con if (n_antenna_port == 4){ // 4 antenna port and the higher layer parameter txConfig = codebook // Table 7.3.1.1.2-2: transformPrecoder=disabled and maxRank = 2 or 3 or 4 - if ((pusch_config_dedicated->transform_precoder == transform_precoder_disabled) - && ((pusch_config_dedicated->max_rank == 2) || - (pusch_config_dedicated->max_rank == 3) || - (pusch_config_dedicated->max_rank == 4))){ + if ((transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) + && ((*pusch_Config->maxRank == 2) || + (*pusch_Config->maxRank == 3) || + (*pusch_Config->maxRank == 4))){ - if (pusch_config_dedicated->codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_fullyAndPartialAndNonCoherent) { pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][0]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][1]; } - if (pusch_config_dedicated->codebook_subset == codebook_subset_partialAndNonCoherent){ + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_partialAndNonCoherent){ pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][2]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][3]; } - if (pusch_config_dedicated->codebook_subset == codebook_subset_nonCoherent){ + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_nonCoherent){ pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][4]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][5]; } } // Table 7.3.1.1.2-3: transformPrecoder= enabled, or transformPrecoder=disabled and maxRank = 1 - if (((pusch_config_dedicated->transform_precoder == transform_precoder_enabled) - || (pusch_config_dedicated->transform_precoder == transform_precoder_disabled)) - && (pusch_config_dedicated->max_rank == 1)){ + if (((transformPrecoder == NR_PUSCH_Config__transformPrecoder_enabled) + || (transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled)) + && (*pusch_Config->maxRank == 1)){ - if (pusch_config_dedicated->codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_fullyAndPartialAndNonCoherent) { pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][6]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][7]; } - if (pusch_config_dedicated->codebook_subset == codebook_subset_partialAndNonCoherent){ + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_partialAndNonCoherent){ pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][8]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][9]; } - if (pusch_config_dedicated->codebook_subset == codebook_subset_nonCoherent){ + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_nonCoherent){ pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][10]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][11]; } @@ -206,14 +223,14 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con if (n_antenna_port == 4){ // 2 antenna port and the higher layer parameter txConfig = codebook // Table 7.3.1.1.2-4: transformPrecoder=disabled and maxRank = 2 - if ((pusch_config_dedicated->transform_precoder == transform_precoder_disabled) && (pusch_config_dedicated->max_rank == 2)){ + if ((transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) && (*pusch_Config->maxRank == 2)){ - if (pusch_config_dedicated->codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_fullyAndPartialAndNonCoherent) { pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][12]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][13]; } - if (pusch_config_dedicated->codebook_subset == codebook_subset_nonCoherent){ + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_nonCoherent){ pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][14]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][15]; } @@ -221,16 +238,16 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con } // Table 7.3.1.1.2-5: transformPrecoder= enabled, or transformPrecoder= disabled and maxRank = 1 - if (((pusch_config_dedicated->transform_precoder == transform_precoder_enabled) - || (pusch_config_dedicated->transform_precoder == transform_precoder_disabled)) - && (pusch_config_dedicated->max_rank == 1)){ + if (((transformPrecoder == NR_PUSCH_Config__transformPrecoder_enabled) + || (transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled)) + && (*pusch_Config->maxRank == 1)){ - if (pusch_config_dedicated->codebook_subset == codebook_subset_fullyAndPartialAndNonCoherent) { + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_fullyAndPartialAndNonCoherent) { pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][16]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][17]; } - if (pusch_config_dedicated->codebook_subset == codebook_subset_nonCoherent){ + if (*pusch_Config->codebookSubset == NR_PUSCH_Config__codebookSubset_nonCoherent){ pusch_config_pdu->nrOfLayers = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][18]; pusch_config_pdu->transform_precoding = table_7_3_1_1_2_2_3_4_5[dci->precoding_information.val][19]; } @@ -241,7 +258,7 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con /*-------------------- Changed to enable Transform precoding in RF SIM------------------------------------------------*/ - if (pusch_config_pdu->transform_precoding == transform_precoder_enabled) { + /*if (pusch_config_pdu->transform_precoding == transform_precoder_enabled) { pusch_config_dedicated->transform_precoder = transform_precoder_enabled; @@ -265,15 +282,7 @@ void ul_layers_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_con } } else - pusch_config_dedicated->transform_precoder = transform_precoder_disabled; - - // mapping type b configured from RRC. TBD: Mapping type b is not handled in this function. - if ((pusch_config_dedicated->transform_precoder == transform_precoder_enabled) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_b.dmrs_type == 1) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_b.max_length == 1)) { // tables 7.3.1.1.2-6 - pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; - pusch_config_pdu->dmrs_ports = dci->antenna_ports.val; - } + pusch_config_dedicated->transform_precoder = transform_precoder_disabled;*/ } // todo: this function shall be reviewed completely because of the many comments left by the author @@ -281,27 +290,47 @@ void ul_ports_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_conf /* ANTENNA_PORTS */ uint8_t rank = 0; // We need to initialize rank FIXME!!! - fapi_nr_pusch_config_dedicated_t *pusch_config_dedicated = &mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated; - if ((pusch_config_dedicated->transform_precoder == transform_precoder_enabled) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-6 + NR_ServingCellConfigCommon_t *scc = mac->scc; + NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup; + + long transformPrecoder; + if (pusch_Config->transformPrecoder) + transformPrecoder = *pusch_Config->transformPrecoder; + else { + if(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder) + transformPrecoder = NR_PUSCH_Config__transformPrecoder_enabled; + else + transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled; + } + long *max_length = NULL; + long *dmrs_type = NULL; + if (pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA) { + max_length = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup->maxLength; + dmrs_type = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup->dmrs_Type; + } + else { + max_length = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->maxLength; + dmrs_type = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->dmrs_Type; + } + + + if ((transformPrecoder == NR_PUSCH_Config__transformPrecoder_enabled) && + (dmrs_type == NULL) && (max_length == NULL)) { // tables 7.3.1.1.2-6 pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; //TBC pusch_config_pdu->dmrs_ports = dci->antenna_ports.val; //TBC } - if ((pusch_config_dedicated->transform_precoder == transform_precoder_enabled) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-7 + if ((transformPrecoder == NR_PUSCH_Config__transformPrecoder_enabled) && + (dmrs_type == NULL) && (max_length != NULL)) { // tables 7.3.1.1.2-7 pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; //TBC pusch_config_pdu->dmrs_ports = (dci->antenna_ports.val > 3)?(dci->antenna_ports.val-4):(dci->antenna_ports.val); //TBC //pusch_config_pdu->n_front_load_symb = (dci->antenna_ports > 3)?2:1; //FIXME } - if ((pusch_config_dedicated->transform_precoder == transform_precoder_disabled) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-8/9/10/11 + if ((transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) && + (dmrs_type == NULL) && (max_length == NULL)) { // tables 7.3.1.1.2-8/9/10/11 if (rank == 1) { pusch_config_pdu->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 1)?2:1; //TBC @@ -333,9 +362,8 @@ void ul_ports_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_conf } } - if ((pusch_config_dedicated->transform_precoder == transform_precoder_disabled) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 1) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-12/13/14/15 + if ((transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) && + (dmrs_type == NULL) && (max_length != NULL)) { // tables 7.3.1.1.2-12/13/14/15 if (rank == 1){ pusch_config_pdu->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 1)?2:1; //TBC @@ -371,9 +399,9 @@ void ul_ports_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_conf } } - if ((pusch_config_dedicated->transform_precoder == transform_precoder_disabled) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 2) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.max_length == 1)) { // tables 7.3.1.1.2-16/17/18/19 + if ((transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) && + (dmrs_type != NULL) && + (max_length == NULL)) { // tables 7.3.1.1.2-16/17/18/19 if (rank == 1){ pusch_config_pdu->num_dmrs_cdm_grps_no_data = (dci->antenna_ports.val > 1)?((dci->antenna_ports.val > 5)?3:2):1; //TBC @@ -405,9 +433,8 @@ void ul_ports_config(NR_UE_MAC_INST_t * mac, nfapi_nr_ue_pusch_pdu_t *pusch_conf } } - if ((pusch_config_dedicated->transform_precoder == transform_precoder_disabled) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.dmrs_type == 2) && - (pusch_config_dedicated->dmrs_ul_for_pusch_mapping_type_a.max_length == 2)) { // tables 7.3.1.1.2-20/21/22/23 + if ((transformPrecoder == NR_PUSCH_Config__transformPrecoder_disabled) && + (dmrs_type != NULL) && (max_length != NULL)) { // tables 7.3.1.1.2-20/21/22/23 if (rank == 1){ pusch_config_pdu->num_dmrs_cdm_grps_no_data = table_7_3_1_1_2_20[dci->antenna_ports.val][0]; //TBC @@ -465,7 +492,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, int NrOfSymbols; uint8_t nb_dmrs_re_per_rb; - uint16_t l_prime_mask = 1; + uint16_t l_prime_mask = 0; uint16_t number_dmrs_symbols = 0; int N_PRB_oh = 0; @@ -478,6 +505,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->nrOfLayers = 1; pusch_config_pdu->rnti = rnti; + pusch_dmrs_AdditionalPosition_t add_pos = pusch_dmrs_pos2; + pusch_maxLength_t dmrslength = pusch_len1; + if (rar_grant) { // Note: for Msg3 or MsgA PUSCH transmission the N_PRB_oh is always set to 0 @@ -486,6 +516,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, NR_BWP_UplinkDedicated_t *ibwp = mac->scg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP; NR_PUSCH_Config_t *pusch_Config = ibwp->pusch_Config->choice.setup; int startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength; + int mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->mappingType; + // active BWP start int abwp_start = NRRIV2PRBOFFSET(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -496,11 +528,13 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, int ibwp_size = NRRIV2BW(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); // BWP start selection according to 8.3 of TS 38.213 - pusch_config_pdu->bwp_size = ibwp_size; - if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size)) + if ((ibwp_start < abwp_start) || (ibwp_size > abwp_size)) { pusch_config_pdu->bwp_start = abwp_start; - else + pusch_config_pdu->bwp_size = abwp_size; + } else { pusch_config_pdu->bwp_start = ibwp_start; + pusch_config_pdu->bwp_size = ibwp_size; + } //// Resource assignment from RAR // Frequency domain allocation according to 8.3 of TS 38.213 @@ -514,13 +548,16 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, return -1; // virtual resource block to physical resource mapping for Msg3 PUSCH (6.3.1.7 in 38.211) - pusch_config_pdu->rb_start += ibwp_start - abwp_start; + //pusch_config_pdu->rb_start += ibwp_start - abwp_start; // Time domain allocation SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); pusch_config_pdu->start_symbol_index = StartSymbolIndex; pusch_config_pdu->nr_of_symbols = NrOfSymbols; + l_prime_mask = get_l_prime(NrOfSymbols, mappingtype, add_pos, dmrslength, StartSymbolIndex, scc->dmrs_TypeA_Position); + LOG_D(MAC, "MSG3 start_sym:%d NR Symb:%d mappingtype:%d , DMRS_MASK:%x\n", pusch_config_pdu->start_symbol_index, pusch_config_pdu->nr_of_symbols, mappingtype, l_prime_mask); + #ifdef DEBUG_MSG3 LOG_D(MAC, "In %s BWP assignment (BWP (start %d, size %d) \n", __FUNCTION__, pusch_config_pdu->bwp_start, pusch_config_pdu->bwp_size); #endif @@ -563,7 +600,6 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, int target_ss; bool valid_ptrs_setup = 0; uint16_t n_RB_ULBWP = NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - fapi_nr_pusch_config_dedicated_t *pusch_config_dedicated = &mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated; NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup; // Basic sanity check for MCS value to check for a false or erroneous DCI @@ -601,18 +637,26 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, } + NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL; + if (pusch_Config->pusch_TimeDomainAllocationList) { + pusch_TimeDomainAllocationList = pusch_Config->pusch_TimeDomainAllocationList->choice.setup; + } + else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) { + pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + } + + int mappingtype = pusch_TimeDomainAllocationList->list.array[dci->time_domain_assignment.val]->mappingType; + + NR_DMRS_UplinkConfig_t *NR_DMRS_ulconfig = NULL; + NR_DMRS_ulconfig = (mappingtype == NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeA) + ? pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup : pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; + /* TRANSFORM PRECODING ------------------------------------------------------------------------------------------*/ if (pusch_config_pdu->transform_precoding == transform_precoder_enabled) { pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; - NR_DMRS_UplinkConfig_t *NR_DMRS_ulconfig = NULL; - if(pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA != NULL) - NR_DMRS_ulconfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup; - else - NR_DMRS_ulconfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup; - uint32_t n_RS_Id = 0; if (NR_DMRS_ulconfig->transformPrecodingEnabled->nPUSCH_Identity != NULL) n_RS_Id = *NR_DMRS_ulconfig->transformPrecodingEnabled->nPUSCH_Identity; @@ -641,12 +685,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, return -1; } /* TIME_DOM_RESOURCE_ASSIGNMENT */ - if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_config_pdu, NULL, dci->time_domain_assignment.val) < 0) { + if (nr_ue_process_dci_time_dom_resource_assignment(mac, pusch_config_pdu, NULL, dci->time_domain_assignment.val,false) < 0) { return -1; } /* FREQ_HOPPING_FLAG */ - if ((pusch_config_dedicated->resource_allocation != 0) && (pusch_config_dedicated->frequency_hopping !=0)){ + if ((pusch_Config->frequencyHopping!=NULL) && (pusch_Config->resourceAllocation != NR_PUSCH_Config__resourceAllocation_resourceAllocationType0)){ pusch_config_pdu->frequency_hopping = dci->frequency_hopping_flag.val; } @@ -681,8 +725,13 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->absolute_delta_PUSCH = 4; } + if (NR_DMRS_ulconfig != NULL) { + add_pos = (NR_DMRS_ulconfig->dmrs_AdditionalPosition == NULL) ? 2 : *NR_DMRS_ulconfig->dmrs_AdditionalPosition; + dmrslength = NR_DMRS_ulconfig->maxLength == NULL ? pusch_len1 : pusch_len2; + } + /* DMRS */ - l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1); + l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, mappingtype, add_pos, dmrslength, pusch_config_pdu->start_symbol_index, scc->dmrs_TypeA_Position); if (pusch_config_pdu->transform_precoding == transform_precoder_disabled) pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1; @@ -720,7 +769,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, pusch_config_pdu->nr_of_symbols, rnti_types[rnti_type]); - pusch_config_pdu->ul_dmrs_symb_pos = l_prime_mask << pusch_config_pdu->start_symbol_index;; + pusch_config_pdu->ul_dmrs_symb_pos = l_prime_mask; pusch_config_pdu->target_code_rate = nr_get_code_rate_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table); pusch_config_pdu->qam_mod_order = nr_get_Qm_ul(pusch_config_pdu->mcs_index, pusch_config_pdu->mcs_table); @@ -883,7 +932,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in uint16_t TBS_bytes = ulcfg_pdu->pusch_config_pdu.pusch_data.tb_size; - if (ra->ra_state == WAIT_RAR){ + if (ra->ra_state == WAIT_RAR && !ra->cfra){ memcpy(ulsch_input_buffer, mac->ulsch_pdu.payload, TBS_bytes); LOG_D(NR_MAC,"[RAPROC] Msg3 to be transmitted:\n"); for (int k = 0; k < TBS_bytes; k++) { @@ -909,10 +958,9 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in //and block this traffic from being forwarded to the upper layers at the gNB LOG_D(PHY, "In %s: Random data to be transmitted: TBS_bytes %d \n", __FUNCTION__, TBS_bytes); - //Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2) - //in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should - //have a valid LCID (nr_process_mac_pdu function) - ulsch_input_buffer[0] = 0x31; + // Make the first byte padding so that gNB ignores the PHY random + // data in the TB for the PHY at the MAC layer + ulsch_input_buffer[0] = UL_SCH_LCID_PADDING; for (int i = 1; i < TBS_bytes; i++) { ulsch_input_buffer[i] = (unsigned char) rand(); @@ -937,7 +985,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in tx_req.tx_request_body[0].pdu_index = j; tx_req.tx_request_body[0].pdu = ulsch_input_buffer; - if (ra->ra_state != RA_SUCCEEDED && !ra->cfra){ + if (ra->ra_state == WAIT_RAR && !ra->cfra){ + LOG_I(NR_MAC,"[RAPROC] RA-Msg3 transmitted\n"); nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index); } @@ -977,7 +1026,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, struct NR_PUSCH_TimeDomainResourceAllocationList *pusch_TimeDomainAllocationList = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; // k2 as per 3GPP TS 38.214 version 15.9.0 Release 15 ch 6.1.2.1.1 // PUSCH time domain resource allocation is higher layer configured from uschTimeDomainAllocationList in either pusch-ConfigCommon - uint8_t k2; + int k2; if (is_Msg3) { k2 = *pusch_TimeDomainAllocationList->list.array[tda_id]->k2; @@ -997,6 +1046,10 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, break; } + AssertFatal((k2+delta) >= DURATION_RX_TO_TX, + "Slot offset (%d) for Msg3 cannot be less than DURATION_RX_TO_TX (%d)\n", + k2+delta,DURATION_RX_TO_TX); + *slot_tx = (current_slot + k2 + delta) % nr_slots_per_frame[mu]; if (current_slot + k2 + delta > nr_slots_per_frame[mu]){ *frame_tx = (current_frame + 1) % 1024; @@ -1660,7 +1713,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; ra->RA_offset = 2; // to compensate the rx frame offset at the gNB - ra->generate_nr_prach = 0; // Reset flag for PRACH generation + ra->generate_nr_prach = GENERATE_IDLE; // Reset flag for PRACH generation if (is_nr_UL_slot(scc, slotP, mac->frame_type)) { @@ -1677,7 +1730,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s if (is_nr_prach_slot && ra->ra_state == RA_UE_IDLE) { AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n"); - ra->generate_nr_prach = 1; + ra->generate_nr_prach = GENERATE_PREAMBLE; format = prach_occasion_info_p->format; format0 = format & 0xff; // single PRACH format diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 39bad35af7..98e9ce4351 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -54,7 +54,7 @@ extern RAN_CONTEXT_t RC; extern void mac_top_init_gNB(void); extern uint8_t nfapi_mode; -void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) { +void config_common(int Mod_idP, int ssb_SubcarrierOffset, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) { nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[Mod_idP]->config[0]; RC.nrmac[Mod_idP]->common_channels[0].ServingCellConfigCommon = scc; @@ -208,8 +208,12 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->prach_RootSequenceIndex.choice.l839; cfg->prach_config.num_prach_fd_occasions_list[i].prach_root_sequence_index.tl.tag = NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG; cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); -//k1= msg1_FrequencyStart + 12 (no. of FDM)(RB for PRACH occasion); + cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + if (get_softmodem_params()->sa) { + cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = NRRIV2PRBOFFSET(scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) + scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + } else { + cfg->prach_config.num_prach_fd_occasions_list[i].k1.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart + (get_N_RA_RB( cfg->prach_config.prach_sub_c_spacing.value, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing ) * i); + } cfg->prach_config.num_prach_fd_occasions_list[i].k1.tl.tag = NFAPI_NR_CONFIG_K1_TAG; cfg->num_tlv++; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf.value = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; @@ -240,6 +244,9 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell; cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG; cfg->num_tlv++; + cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset; + cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; + cfg->num_tlv++; switch (scc->ssb_PositionsInBurst->present) { case 1 : @@ -264,18 +271,32 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm cfg->ssb_table.ssb_mask_list[0].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; cfg->ssb_table.ssb_mask_list[1].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; - cfg->num_tlv++; + cfg->num_tlv+=2; cfg->carrier_config.num_tx_ant.value = pdsch_AntennaPorts; AssertFatal(pdsch_AntennaPorts > 0 && pdsch_AntennaPorts < 13, "pdsch_AntennaPorts in 1...12\n"); cfg->carrier_config.num_tx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_TX_ANT_TAG; + int num_ssb=0; for (int i=0;i<32;i++) { - num_ssb += (cfg->ssb_table.ssb_mask_list[0].ssb_mask.value>>i)&1; - num_ssb += (cfg->ssb_table.ssb_mask_list[1].ssb_mask.value>>i)&1; + cfg->ssb_table.ssb_beam_id_list[i].beam_id.tl.tag = NFAPI_NR_CONFIG_BEAM_ID_TAG; + if ((cfg->ssb_table.ssb_mask_list[0].ssb_mask.value>>(31-i))&1) { + cfg->ssb_table.ssb_beam_id_list[i].beam_id.value = num_ssb; + num_ssb++; + } + cfg->num_tlv++; + } + for (int i=0;i<32;i++) { + cfg->ssb_table.ssb_beam_id_list[32+i].beam_id.tl.tag = NFAPI_NR_CONFIG_BEAM_ID_TAG; + if ((cfg->ssb_table.ssb_mask_list[1].ssb_mask.value>>(31-i))&1) { + cfg->ssb_table.ssb_beam_id_list[32+i].beam_id.value = num_ssb; + num_ssb++; + } + cfg->num_tlv++; } - cfg->carrier_config.num_rx_ant.value = cfg->carrier_config.num_tx_ant.value; + cfg->carrier_config.num_rx_ant.value = pusch_AntennaPorts; + AssertFatal(pusch_AntennaPorts > 0 && pusch_AntennaPorts < 13, "pusch_AntennaPorts in 1...12\n"); cfg->carrier_config.num_rx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_RX_ANT_TAG; LOG_I(MAC,"Set TX/RX antenna number to %d (num ssb %d: %x,%x)\n",cfg->carrier_config.num_tx_ant.value,num_ssb,cfg->ssb_table.ssb_mask_list[0].ssb_mask.value,cfg->ssb_table.ssb_mask_list[1].ssb_mask.value); AssertFatal(cfg->carrier_config.num_tx_ant.value > 0,"carrier_config.num_tx_ant.value %d !\n",cfg->carrier_config.num_tx_ant.value ); @@ -295,25 +316,28 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm } if(cfg->cell_config.frame_duplex_type.value == TDD){ LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value); - int return_tdd = set_tdd_config_nr(cfg, - scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, - scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols); + int periods_per_frame = set_tdd_config_nr(cfg, + scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots, + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols); - if (return_tdd != 0) + if (periods_per_frame < 0) LOG_E(MAC,"TDD configuration can not be done\n"); - else - LOG_I(MAC,"TDD has been properly configurated\n"); + else { + LOG_I(MAC,"TDD has been properly configurated\n"); + RC.nrmac[Mod_idP]->tdd_beam_association = (int16_t *)malloc16(periods_per_frame*sizeof(int16_t)); + } } } extern uint16_t sl_ahead; -int rrc_mac_config_req_gNB(module_id_t Mod_idP, - int ssb_SubcarrierOffset, +int rrc_mac_config_req_gNB(module_id_t Mod_idP, + int ssb_SubcarrierOffset, int pdsch_AntennaPorts, + int pusch_AntennaPorts, int pusch_tgt_snrx10, int pucch_tgt_snrx10, NR_ServingCellConfigCommon_t *scc, @@ -348,18 +372,12 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, AssertFatal(RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL, "could not allocate memory for RC.nrmac[]->common_channels[0].vrb_map_UL\n"); - for (int i = 0; i < MAX_NUM_BWP; ++i) { - RC.nrmac[Mod_idP]->pucch_index_used[i] = - calloc(n, sizeof(*RC.nrmac[Mod_idP]->pucch_index_used)); - AssertFatal(RC.nrmac[Mod_idP]->pucch_index_used[i], - "could not allocate memory for RC.nrmac[]->pucch_index_used[%d]\n", - i); - } - LOG_I(MAC,"Configuring common parameters from NR ServingCellConfig\n"); config_common(Mod_idP, - pdsch_AntennaPorts, + ssb_SubcarrierOffset, + pdsch_AntennaPorts, + pusch_AntennaPorts, scc); LOG_E(MAC, "%s() %s:%d RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req:%p\n", __FUNCTION__, __FILE__, __LINE__, RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req); @@ -371,7 +389,8 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, printf("Waiting for PHY_config_req\n"); } } - + + RC.nrmac[Mod_idP]->ssb_SubcarrierOffset = ssb_SubcarrierOffset; RC.nrmac[Mod_idP]->pusch_target_snrx10 = pusch_tgt_snrx10; RC.nrmac[Mod_idP]->pucch_target_snrx10 = pucch_tgt_snrx10; NR_PHY_Config_t phycfg; @@ -379,20 +398,57 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, phycfg.CC_id = 0; phycfg.cfg = &RC.nrmac[Mod_idP]->config[0]; - phycfg.cfg->ssb_table.ssb_subcarrier_offset.value = ssb_SubcarrierOffset; - phycfg.cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; - phycfg.cfg->num_tlv++; - if (RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req) RC.nrmac[Mod_idP]->if_inst->NR_PHY_config_req(&phycfg); find_SSB_and_RO_available(Mod_idP); + const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; + const int nr_mix_slots = tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0; + const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots; + const int nr_dlmix_slots = tdd->nrofDownlinkSlots + (tdd->nrofDownlinkSymbols != 0); + const int nr_ulstart_slot = tdd->nrofDownlinkSlots + (tdd->nrofUplinkSymbols == 0); + for (int slot = 0; slot < n; ++slot) { + /* FIXME: it seems there is a problem with slot 0/10/slots right after UL: + * we just get retransmissions. Thus, do not schedule such slots in DL */ + if (slot % nr_slots_period != 0) + RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] |= ((slot % nr_slots_period) < nr_dlmix_slots) << (slot % 64); + RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] |= ((slot % nr_slots_period) >= nr_ulstart_slot) << (slot % 64); + LOG_D(MAC, + "slot %d DL %d UL %d\n", + slot, + (RC.nrmac[Mod_idP]->dlsch_slot_bitmap[slot / 64] & (1 << (slot % 64))) != 0, + (RC.nrmac[Mod_idP]->ulsch_slot_bitmap[slot / 64] & (1 << (slot % 64))) != 0); + } + + if (get_softmodem_params()->phy_test) { + RC.nrmac[Mod_idP]->pre_processor_dl = nr_preprocessor_phytest; + RC.nrmac[Mod_idP]->pre_processor_ul = nr_ul_preprocessor_phytest; + } else { + RC.nrmac[Mod_idP]->pre_processor_dl = nr_init_fr1_dlsch_preprocessor(Mod_idP, 0); + RC.nrmac[Mod_idP]->pre_processor_ul = nr_init_fr1_ulsch_preprocessor(Mod_idP, 0); + } } if (secondaryCellGroup) { RC.nrmac[Mod_idP]->secondaryCellGroupCommon = secondaryCellGroup; + const NR_ServingCellConfig_t *servingCellConfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated; + const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig->downlinkBWP_ToAddModList; + AssertFatal(bwpList->list.count > 0, "downlinkBWP_ToAddModList has no BWPs!\n"); + for (int i = 0; i < bwpList->list.count; ++i) { + const NR_BWP_Downlink_t *bwp = bwpList->list.array[i]; + calculate_preferred_dl_tda(Mod_idP, bwp); + } + + const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = + servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList; + AssertFatal(ubwpList->list.count > 0, "downlinkBWP_ToAddModList no BWPs!\n"); + for (int i = 0; i < ubwpList->list.count; ++i) { + const NR_BWP_Uplink_t *ubwp = ubwpList->list.array[i]; + calculate_preferred_ul_tda(Mod_idP, ubwp); + } + NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; if (add_ue == 1 && get_softmodem_params()->phy_test) { const int UE_id = add_new_nr_ue(Mod_idP, rnti, secondaryCellGroup); @@ -430,6 +486,13 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, } } } + } else { + ra->cfra = false; + ra->rnti = 0; + ra->preambles.num_preambles = MAX_NUM_NR_PRACH_PREAMBLES; + ra->preambles.preamble_list = (uint8_t *) malloc(MAX_NUM_NR_PRACH_PREAMBLES*sizeof(uint8_t)); + for (int i = 0; i < MAX_NUM_NR_PRACH_PREAMBLES; i++) + ra->preambles.preamble_list[i] = i; } LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti); } else { // secondaryCellGroup has been updated diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index de9c64cd46..94f3931424 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -53,6 +53,7 @@ #include "executables/softmodem-common.h" #include "nfapi/oai_integration/vendor_ext.h" +#include "executables/nr-softmodem.h" uint16_t nr_pdcch_order_table[6] = { 31, 31, 511, 2047, 2047, 8191 }; @@ -65,7 +66,13 @@ void dump_mac_stats(gNB_MAC_INST *gNB) NR_UE_info_t *UE_info = &gNB->UE_info; int num = 1; for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { - LOG_I(MAC, "UE ID %d RNTI %04x (%d/%d)\n", UE_id, UE_info->rnti[UE_id], num++, UE_info->num_UEs); + LOG_I(MAC, "UE ID %d RNTI %04x (%d/%d) PH %d dB PCMAX %d dBm\n", + UE_id, + UE_info->rnti[UE_id], + num++, + UE_info->num_UEs, + UE_info->UE_sched_ctrl[UE_id].ph, + UE_info->UE_sched_ctrl[UE_id].pcmax); NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id]; const int avg_rsrp = stats->num_rsrp_meas > 0 ? stats->cumul_rsrp / stats->num_rsrp_meas : 0; LOG_I(MAC, "UE %d: dlsch_rounds %d/%d/%d/%d, dlsch_errors %d, average RSRP %d (%d meas)\n", @@ -76,10 +83,15 @@ void dump_mac_stats(gNB_MAC_INST *gNB) stats->num_rsrp_meas = 0; stats->cumul_rsrp = 0 ; LOG_I(MAC, "UE %d: dlsch_total_bytes %d\n", UE_id, stats->dlsch_total_bytes); - LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d\n", + const NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + LOG_I(MAC, "UE %d: ulsch_rounds %d/%d/%d/%d, ulsch_errors %d, PUSCH SNR %2.1f dB, PUCCH SNR %2.1f dB, noise rssi %2.1f dB\n", UE_id, stats->ulsch_rounds[0], stats->ulsch_rounds[1], - stats->ulsch_rounds[2], stats->ulsch_rounds[3], stats->ulsch_errors); + stats->ulsch_rounds[2], stats->ulsch_rounds[3], + stats->ulsch_errors, + (float) sched_ctrl->pusch_snrx10 / 10, + (float) sched_ctrl->pucch_snrx10 / 10, + (float) (sched_ctrl->raw_rssi - 1280) / 10); LOG_I(MAC, "UE %d: ulsch_total_bytes_scheduled %d, ulsch_total_bytes_received %d\n", UE_id, @@ -91,6 +103,7 @@ void dump_mac_stats(gNB_MAC_INST *gNB) LOG_I(MAC, "UE %d: LCID %d: %d bytes RX\n", UE_id, lc_id, stats->lc_bytes_rx[lc_id]); } } + print_meas(&gNB->eNB_scheduler, "DL & UL scheduling timing stats", NULL, NULL); } void clear_nr_nfapi_information(gNB_MAC_INST * gNB, @@ -304,6 +317,7 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot) { + if (slot>64) return false; //quickfix for FR2 where there are more than 64 slots (bitmap to be removed) return (bitmap >> slot) & 0x01; } @@ -314,54 +328,23 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nfapi_nr_config_request_scf_t *cfg = &mac->config[0]; protocol_ctxt_t ctxt; PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, NOT_A_RNTI, frame, slot,module_idP); - int nb_periods_per_frame; - + const int bwp_id = 1; gNB_MAC_INST *gNB = RC.nrmac[module_idP]; NR_COMMON_channels_t *cc = gNB->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - NR_TDD_UL_DL_Pattern_t *tdd_pattern = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; - switch(scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity) { - case 0: - nb_periods_per_frame = 20; // 10ms/0p5ms - break; - - case 1: - nb_periods_per_frame = 16; // 10ms/0p625ms - break; - - case 2: - nb_periods_per_frame = 10; // 10ms/1ms - break; - - case 3: - nb_periods_per_frame = 8; // 10ms/1p25ms - break; - - case 4: - nb_periods_per_frame = 5; // 10ms/2ms - break; - - case 5: - nb_periods_per_frame = 4; // 10ms/2p5ms - break; - - case 6: - nb_periods_per_frame = 2; // 10ms/5ms - break; - - case 7: - nb_periods_per_frame = 1; // 10ms/10ms - break; - - default: - AssertFatal(1==0,"Undefined tdd period %ld\n", scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity); + if (slot==0 && (*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]>=257)) { + const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; + const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + const int nr_mix_slots = tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0; + const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots; + const int nb_periods_per_frame = n / nr_slots_period; + // re-initialization of tdd_beam_association at beginning of frame (only for FR2) + for (int i=0; itdd_beam_association[i] = -1; } - int num_slots_per_tdd = (nr_slots_per_frame[*scc->ssbSubcarrierSpacing])/nb_periods_per_frame; - - const int nr_ulmix_slots = tdd_pattern->nrofUplinkSlots + (tdd_pattern->nrofUplinkSymbols!=0); start_meas(&RC.nrmac[module_idP]->eNB_scheduler); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN); @@ -375,17 +358,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, nr_rrc_trigger(&ctxt, 0 /*CC_id*/, frame, slot >> *scc->ssbSubcarrierSpacing); } -#define BIT(x) (1 << (x)) - const uint64_t dlsch_in_slot_bitmap = BIT( 1) | BIT( 2) | BIT( 3) | BIT( 4) | BIT( 5) | BIT( 6) - | BIT(11) | BIT(12) | BIT(13) | BIT(14) | BIT(15) | BIT(16); - - uint8_t prach_config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; - uint64_t ulsch_in_slot_bitmap; - if (prach_config_index==4) //this is the PRACH config used in the Benetel RRU. TODO: make this generic for any PRACH config. - ulsch_in_slot_bitmap = BIT( 8) | BIT( 9); - else - ulsch_in_slot_bitmap = BIT( 8) | BIT(18); - memset(RC.nrmac[module_idP]->cce_list[bwp_id][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0 memset(RC.nrmac[module_idP]->cce_list[bwp_id][1],0,MAX_NUM_CCE*sizeof(int)); // coresetid 1 NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; @@ -410,7 +382,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, // This schedules MIB - schedule_nr_mib(module_idP, frame, slot, nr_slots_per_frame[*scc->ssbSubcarrierSpacing]); + schedule_nr_mib(module_idP, frame, slot); // This schedules SIB1 if ( get_softmodem_params()->sa == 1 ) @@ -432,7 +404,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, } // This schedule SR - // TODO + nr_sr_reporting(module_idP, frame, slot); // Schedule CSI measurement reporting: check in slot 0 for the whole frame if (slot == 0) @@ -445,18 +417,18 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, } // This schedules the DCI for Uplink and subsequently PUSCH - { - if(NFAPI_MODE == NFAPI_MODE_VNF){ - gNB->UL_tti_req_ahead[0][7].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 7 - gNB->UL_tti_req_ahead[0][8].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 8 - gNB->UL_tti_req_ahead[0][9].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 9 - gNB->UL_tti_req[0] = &gNB->UL_tti_req_ahead[0][slot]; - } - nr_schedule_ulsch(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, ulsch_in_slot_bitmap); + + if(NFAPI_MODE == NFAPI_MODE_VNF){ + gNB->UL_tti_req_ahead[0][7].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 7 + gNB->UL_tti_req_ahead[0][8].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 8 + gNB->UL_tti_req_ahead[0][9].SFN = frame;//Added to set the UL_tti_req_ahead SFN in VNF mode for slot 9 + gNB->UL_tti_req[0] = &gNB->UL_tti_req_ahead[0][slot]; } + + nr_schedule_ulsch(module_idP, frame, slot); + // This schedules the DCI for Downlink and PDSCH - if (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot)) - nr_schedule_ue_spec(module_idP, frame, slot); + nr_schedule_ue_spec(module_idP, frame, slot); nr_schedule_pucch(module_idP, frame, slot); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 64867c5be5..7c1cbea9b6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -41,6 +41,7 @@ #include "UTIL/OPT/opt.h" #include "SIMULATION/TOOLS/sim.h" // for taus +#include extern RAN_CONTEXT_t RC; extern const uint8_t nr_slots_per_frame[5]; extern uint16_t sl_ahead; @@ -65,7 +66,7 @@ int16_t ssb_index_from_prach(module_id_t module_idP, uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; uint8_t fdm = cfg->prach_config.num_prach_fd_occasions.value; - uint8_t total_RApreambles = 64; + uint8_t total_RApreambles = MAX_NUM_NR_PRACH_PREAMBLES; if( scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) total_RApreambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; @@ -130,7 +131,7 @@ int16_t ssb_index_from_prach(module_id_t module_idP, } } - LOG_D(MAC, "Frame %d, Slot %d: Prach Occasion id = %d ssb per RO = %f number of active SSB %u index = %d fdm %u symbol index %u freq_index %u total_RApreambles %u\n", + LOG_D(NR_MAC, "Frame %d, Slot %d: Prach Occasion id = %d ssb per RO = %f number of active SSB %u index = %d fdm %u symbol index %u freq_index %u total_RApreambles %u\n", frameP, slotP, prach_occasion_id, num_ssb_per_RO, num_active_ssb, index, fdm, start_symbol_index, freq_index, total_RApreambles); return index; @@ -227,7 +228,7 @@ void find_SSB_and_RO_available(module_id_t module_idP) { cc->total_prach_occasions = total_RA_occasions - unused_RA_occasion; cc->num_active_ssb = num_active_ssb; - LOG_I(MAC, + LOG_I(NR_MAC, "Total available RO %d, num of active SSB %d: unused RO = %d association_period %u N_RA_sfn %u total_prach_occasions_per_config_period %u\n", cc->total_prach_occasions, cc->num_active_ssb, @@ -313,7 +314,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP format0, scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->restrictedSetConfig); - LOG_D(MAC, "Frame %d, Slot %d: Prach Occasion id = %u fdm index = %u start symbol = %u slot index = %u subframe index = %u \n", + LOG_D(NR_MAC, "Frame %d, Slot %d: Prach Occasion id = %u fdm index = %u start symbol = %u slot index = %u subframe index = %u \n", frameP, slotP, prach_occasion_id, prach_pdu->num_ra, prach_pdu->prach_start_symbol, @@ -377,6 +378,16 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP } } } + + // block resources in vrb_map_UL + const NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = + &scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric; + const uint8_t mu_pusch = + scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + const int16_t N_RA_RB = get_N_RA_RB(cfg->prach_config.prach_sub_c_spacing.value, mu_pusch); + uint16_t *vrb_map_UL = &cc->vrb_map_UL[slotP * MAX_BWP_SIZE]; + for (int i = 0; i < N_RA_RB * fdm; ++i) + vrb_map_UL[rach_ConfigGeneric->msg1_FrequencyStart + i] = 0xff; // all symbols } } } @@ -385,7 +396,9 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, uint16_t *msg2_frame, uint16_t *msg2_slot, NR_ServingCellConfigCommon_t *scc, uint16_t monitoring_slot_period, - uint16_t monitoring_offset,uint8_t index,uint8_t num_active_ssb){ + uint16_t monitoring_offset,uint8_t beam_index, + uint8_t num_active_ssb, + int16_t *tdd_beam_association){ // preferentially we schedule the msg2 in the mixed slot or in the last dl slot // if they are allowed by search space configuration @@ -402,18 +415,6 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, if ((scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols > 0) || (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols > 0)) tdd_period_slot++; - // computing start of next period - uint8_t start_next_period = (rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot)%nr_slots_per_frame[mu]; - *msg2_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot - *msg2_frame = (*msg2_slot>(rach_slot))? rach_frame : (rach_frame +1); - - // we can't schedule msg2 before sl_ahead since prach - int eff_slot = *msg2_slot+(*msg2_frame-rach_frame)*nr_slots_per_frame[mu]; - if ((eff_slot-rach_slot)<=sl_ahead) { - *msg2_slot = (*msg2_slot+tdd_period_slot)%nr_slots_per_frame[mu]; - *msg2_frame = (*msg2_slot>(rach_slot))? rach_frame : (rach_frame +1); - } - switch(response_window){ case NR_RACH_ConfigGeneric__ra_ResponseWindow_sl1: slot_window = 1; @@ -448,6 +449,31 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, uint8_t slot_limit = (rach_slot + slot_window)%nr_slots_per_frame[mu]; uint8_t frame_limit = (slot_limit>(rach_slot))? rach_frame : (rach_frame +1); + // computing start of next period + + int FR = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0] >= 257 ? nr_FR2 : nr_FR1; + + uint8_t start_next_period = (rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot)%nr_slots_per_frame[mu]; + *msg2_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot + *msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024; + + // we can't schedule msg2 before sl_ahead since prach + int eff_slot = *msg2_slot+(*msg2_frame-rach_frame)*nr_slots_per_frame[mu]; + if ((eff_slot-rach_slot)<=sl_ahead) { + *msg2_slot = (*msg2_slot+tdd_period_slot)%nr_slots_per_frame[mu]; + *msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024; + } + if (FR==nr_FR2) { + int num_tdd_period = *msg2_slot/tdd_period_slot; + while((tdd_beam_association[num_tdd_period]!=-1)&&(tdd_beam_association[num_tdd_period]!=beam_index)) { + *msg2_slot = (*msg2_slot+tdd_period_slot)%nr_slots_per_frame[mu]; + *msg2_frame = ((*msg2_slot>(rach_slot))? rach_frame : (rach_frame+1))%1024; + num_tdd_period = *msg2_slot/tdd_period_slot; + } + if(tdd_beam_association[num_tdd_period] == -1) + tdd_beam_association[num_tdd_period] = beam_index; + } + // go to previous slot if the current scheduled slot is beyond the response window // and if the slot is not among the PDCCH monitored ones (38.213 10.1) while (((*msg2_slot>slot_limit)&&(*msg2_frame>frame_limit)) || ((*msg2_frame*nr_slots_per_frame[mu]+*msg2_slot-monitoring_offset)%monitoring_slot_period !=0)) { @@ -476,13 +502,13 @@ void nr_initiate_ra_proc(module_id_t module_idP, NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - uint8_t total_RApreambles = 64; - uint8_t num_ssb_per_RO = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; + uint8_t total_RApreambles = MAX_NUM_NR_PRACH_PREAMBLES; + uint8_t num_ssb_per_RO = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present; int pr_found; if( scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles != NULL) - total_RApreambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; - + total_RApreambles = *scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->totalNumberOfRA_Preambles; + if(num_ssb_per_RO > 3) { /*num of ssb per RO >= 1*/ num_ssb_per_RO -= 3; total_RApreambles = total_RApreambles/num_ssb_per_RO ; @@ -499,7 +525,6 @@ void nr_initiate_ra_proc(module_id_t module_idP, break; } } - if (pr_found == 0) { continue; } @@ -514,14 +539,15 @@ void nr_initiate_ra_proc(module_id_t module_idP, else ra_rnti = 1 + symbol + (slotP * 14) + (freq_index * 14 * 80) + (ul_carrier_id * 14 * 80 * 8); - // This should be handled differently when we use the initialBWP for RA ra->bwp_id = 1; - NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ->list.array[ra->bwp_id - 1]; + NR_BWP_Downlink_t *bwp = NULL; // For SA we use InitialBWP + if(get_softmodem_params()->sa != 1) { + bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]; + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1); - LOG_I(MAC, + LOG_D(NR_MAC, "[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d\n", module_idP, CC_id, @@ -536,26 +562,33 @@ void nr_initiate_ra_proc(module_id_t module_idP, // if the preamble received correspond to one of the listed if (!(preamble_index == ra->preambles.preamble_list[beam_index])) { LOG_E( - MAC, + NR_MAC, "[gNB %d][RAPROC] FAILURE: preamble %d does not correspond to any of the ones in rach_ConfigDedicated\n", module_idP, preamble_index); continue; // if the PRACH preamble does not correspond to any of the ones sent through RRC abort RA proc } } - int loop = 0; - LOG_D(MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP); + LOG_D(NR_MAC, "Frame %d, Slot %d: Activating RA process \n", frameP, slotP); ra->state = Msg2; ra->timing_offset = timing_offset; ra->preamble_slot = slotP; - struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = - bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + NR_SearchSpaceId_t ra_SearchSpace = 0; + struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList = NULL; + if(bwp) { + commonSearchSpaceList = bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + ra_SearchSpace = *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace; + } else { + commonSearchSpaceList = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList; + ra_SearchSpace = *scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace; + } AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n"); + // Common searchspace list for (int i = 0; i < commonSearchSpaceList->list.count; i++) { ss = commonSearchSpaceList->list.array[i]; - if (ss->searchSpaceId == *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace) + if (ss->searchSpaceId == ra_SearchSpace) ra->ra_ss = ss; } @@ -570,13 +603,17 @@ void nr_initiate_ra_proc(module_id_t module_idP, monitoring_slot_period, monitoring_offset, beam_index, - cc->num_active_ssb); + cc->num_active_ssb, + nr_mac->tdd_beam_association); ra->Msg2_frame = msg2_frame; ra->Msg2_slot = msg2_slot; - LOG_I(MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP); - if (!ra->cfra) { + LOG_D(NR_MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP); + + int loop = 0; + // This condition allows for the usage of a preconfigured rnti for the first UE + if (!ra->cfra || ra->rnti == 0) { do { ra->rnti = (taus() % 65518) + 1; loop++; @@ -584,15 +621,16 @@ void nr_initiate_ra_proc(module_id_t module_idP, && !((find_nr_UE_id(module_idP, ra->rnti) == -1) && (find_nr_RA_id(module_idP, CC_id, ra->rnti) == -1) && ra->rnti >= 1 && ra->rnti <= 65519)); if (loop == 100) { - LOG_E(MAC, "%s:%d:%s: [RAPROC] initialisation random access aborted\n", __FILE__, __LINE__, __FUNCTION__); + LOG_E(NR_MAC, "%s:%d:%s: [RAPROC] initialisation random access aborted\n", __FILE__, __LINE__, __FUNCTION__); abort(); } } + ra->RA_rnti = ra_rnti; ra->preamble_index = preamble_index; ra->beam_id = beam_index; - LOG_I(MAC, + LOG_D(NR_MAC, "[gNB %d][RAPROC] CC_id %d Frame %d Activating Msg2 generation in frame %d, slot %d using RA rnti %x SSB " "index %u\n", module_idP, @@ -606,38 +644,38 @@ void nr_initiate_ra_proc(module_id_t module_idP, return; } } - LOG_E(MAC, "[gNB %d][RAPROC] FAILURE: CC_id %d Frame %d initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, preamble_index); + LOG_E(NR_MAC, "[gNB %d][RAPROC] FAILURE: CC_id %d Frame %d initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, preamble_index); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0); } -void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) -{ - gNB_MAC_INST *mac = RC.nrmac[module_idP]; + void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) + { + gNB_MAC_INST *mac = RC.nrmac[module_idP]; - start_meas(&mac->schedule_ra); - for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; - for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { - NR_RA_t *ra = &cc->ra[i]; - LOG_D(MAC, "RA[state:%d]\n", ra->state); - switch (ra->state) { - case Msg2: - nr_generate_Msg2(module_idP, CC_id, frameP, slotP, ra); - break; - case Msg4: - // generate_Msg4(module_idP, CC_id, frameP, slotP); - break; - case WAIT_Msg4_ACK: - // check_Msg4_retransmission(module_idP, CC_id, frameP, slotP); - break; - default: - break; + start_meas(&mac->schedule_ra); + for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; + for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { + NR_RA_t *ra = &cc->ra[i]; + LOG_D(NR_MAC, "RA[state:%d]\n", ra->state); + switch (ra->state) { + case Msg2: + nr_generate_Msg2(module_idP, CC_id, frameP, slotP, ra); + break; + case Msg4: + nr_generate_Msg4(module_idP, CC_id, frameP, slotP, ra); + break; + case WAIT_Msg4_ACK: + nr_check_Msg4_Ack(module_idP, CC_id, frameP, slotP, ra); + break; + default: + break; + } } } + stop_meas(&mac->schedule_ra); } - stop_meas(&mac->schedule_ra); -} void nr_get_Msg3alloc(module_id_t module_id, int CC_id, @@ -645,42 +683,55 @@ void nr_get_Msg3alloc(module_id_t module_id, NR_BWP_Uplink_t *ubwp, sub_frame_t current_slot, frame_t current_frame, - NR_RA_t *ra) { + NR_RA_t *ra, + int16_t *tdd_beam_association) { - // msg3 is schedulend in mixed slot in the following TDD period + // msg3 is schedulend in mixed slot in the following TDD period - uint16_t msg3_nb_rb = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); // sdu has 6 or 8 bytes + uint16_t msg3_nb_rb = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); // sdu has 6 or 8 bytes - int mu = ubwp->bwp_Common->genericParameters.subcarrierSpacing; - int StartSymbolIndex, NrOfSymbols, startSymbolAndLength, temp_slot; - ra->Msg3_tda_id = 16; // initialization to a value above limit + int mu = ubwp->bwp_Common->genericParameters.subcarrierSpacing; + int StartSymbolIndex, NrOfSymbols, startSymbolAndLength, temp_slot; + ra->Msg3_tda_id = 16; // initialization to a value above limit - for (int i=0; ibwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.count; i++) { - startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; - SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); - // we want to transmit in the uplink symbols of mixed slot - if (NrOfSymbols == scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols) { - ra->Msg3_tda_id = i; - break; + for (int i=0; ibwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.count; i++) { + startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols); + // we want to transmit in the uplink symbols of mixed slot + if (NrOfSymbols == scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols) { + ra->Msg3_tda_id = i; + break; + } } + AssertFatal(ra->Msg3_tda_id<16,"Unable to find Msg3 time domain allocation in list\n"); + + uint8_t k2 = *ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2; + + temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213 + ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu]; + if (nr_slots_per_frame[mu]>temp_slot) + ra->Msg3_frame = current_frame; + else + ra->Msg3_frame = (current_frame + (temp_slot/nr_slots_per_frame[mu]))%1024; + + // beam association for FR2 + if (*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0] >= 257) { + uint8_t tdd_period_slot = scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSlots + scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; + if ((scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofDownlinkSymbols > 0) || (scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols > 0)) + tdd_period_slot++; + int num_tdd_period = ra->Msg3_slot/tdd_period_slot; + if((tdd_beam_association[num_tdd_period]!=-1)&&(tdd_beam_association[num_tdd_period]!=ra->beam_id)) + AssertFatal(1==0,"Cannot schedule MSG3\n"); + else + tdd_beam_association[num_tdd_period] = ra->beam_id; } - AssertFatal(ra->Msg3_tda_id<16,"Unable to find Msg3 time domain allocation in list\n"); - uint8_t k2 = *ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->k2; - - temp_slot = current_slot + k2 + DELTA[mu]; // msg3 slot according to 8.3 in 38.213 - ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu]; - if (nr_slots_per_frame[mu]>temp_slot) - ra->Msg3_frame = current_frame; - else - ra->Msg3_frame = current_frame + (temp_slot/nr_slots_per_frame[mu]); - - LOG_I(MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u start symbol index %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id, StartSymbolIndex); + LOG_D(NR_MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u start symbol index %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id, StartSymbolIndex); uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * MAX_BWP_SIZE]; const uint16_t bwpSize = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - /* search msg3_nb_rb free RBs */ + /* search msg3_nb_rb free RBs */ int rbSize = 0; int rbStart = 0; while (rbSize < msg3_nb_rb) { @@ -705,7 +756,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; if (ra->state == RA_IDLE) { - LOG_W(MAC,"RA is not active for RA %X. skipping msg3 scheduling\n", ra->rnti); + LOG_W(NR_MAC,"RA is not active for RA %X. skipping msg3 scheduling\n", ra->rnti); return; } @@ -720,7 +771,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t vrb_map_UL[i + ra->msg3_first_rb] = 1; } - LOG_I(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot); + LOG_D(NR_MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot); nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[CC_id][ra->Msg3_slot]; AssertFatal(future_ul_tti_req->SFN == ra->Msg3_frame @@ -742,7 +793,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1, "downlinkBWP_ToAddModList has %d BWP!\n", ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); NR_BWP_Uplink_t *ubwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; - LOG_D(MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n", + LOG_D(NR_MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n", frameP, slotP, ra->Msg3_frame, @@ -755,6 +806,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t int startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength; int start_symbol_index,nr_of_symbols; SLIV2SL(startSymbolAndLength, &start_symbol_index, &nr_of_symbols); + int mappingtype = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->mappingType; pusch_pdu->pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; pusch_pdu->rnti = ra->rnti; @@ -780,14 +832,18 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t pusch_pdu->transform_precoding = 0; pusch_pdu->data_scrambling_id = *scc->physCellId; pusch_pdu->nrOfLayers = 1; - pusch_pdu->ul_dmrs_symb_pos = 1<ul_dmrs_symb_pos = get_l_prime(nr_of_symbols,mappingtype,pusch_dmrs_pos2,pusch_len1,start_symbol_index, scc->dmrs_TypeA_Position); + LOG_D(MAC, "MSG3 start_sym:%d NR Symb:%d mappingtype:%d , ul_dmrs_symb_pos:%x\n", start_symbol_index, nr_of_symbols, mappingtype, pusch_pdu->ul_dmrs_symb_pos); + pusch_pdu->dmrs_config_type = 0; pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId; //If provided and the PUSCH is not a msg3 PUSCH, otherwise, L2 should set this to physical cell id. pusch_pdu->scid = 0; //DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]. Should match what is sent in DCI 0_1, otherwise set to 0. pusch_pdu->dmrs_ports = 1; // 6.2.2 in 38.214 only port 0 to be used pusch_pdu->num_dmrs_cdm_grps_no_data = 2; // no data in dmrs symbols as in 6.2.2 in 38.214 pusch_pdu->resource_alloc = 1; //type 1 - pusch_pdu->rb_start = ra->msg3_first_rb + ibwp_start - abwp_start; // as for 6.3.1.7 in 38.211 + //pusch_pdu->rb_start = ra->msg3_first_rb + ibwp_start - abwp_start; // as for 6.3.1.7 in 38.211 + pusch_pdu->rb_start = ra->msg3_first_rb; if (ra->msg3_nb_rb > pusch_pdu->bwp_size) AssertFatal(1==0,"MSG3 allocated number of RBs exceed the BWP size\n"); else @@ -822,85 +878,91 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra) { - int mcsIndex; - int startSymbolAndLength = 0, StartSymbolIndex = -1, NrOfSymbols = 14, StartSymbolIndex_tmp, NrOfSymbols_tmp, x_Overhead, time_domain_assignment = 0; - gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; - NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; - NR_SearchSpace_t *ss = ra->ra_ss; - // This code from this point on will not work on initialBWP or CORESET0 - AssertFatal(ra->bwp_id > 0, "cannot work on initialBWP for now\n"); - - AssertFatal(ra->secondaryCellGroup, "no secondaryCellGroup for RNTI %04x\n", ra->crnti); - AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1, - "downlinkBWP_ToAddModList has %d BWP!\n", - ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); - - uint16_t RA_rnti = ra->RA_rnti; - long locationAndBandwidth; - - // check if UE is doing RA on CORESET0 , InitialBWP or configured BWP from SCD - // get the BW of the PDCCH for PDCCH size and RAR PDSCH size - - NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; - int dci10_bw = 0; - - if (ra->coreset0_configured == 1) { - AssertFatal(1==0,"This is a standalone condition\n"); - } - else { // on configured BWP or initial LDBWP, bandwidth parameters in DCI correspond size of initialBWP - locationAndBandwidth = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; - dci10_bw = NRRIV2BW(locationAndBandwidth, MAX_BWP_SIZE); - } + gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; + NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) { + uint8_t time_domain_assignment = 1; + uint8_t mcsIndex = 0; + int rbStart = 0; + int rbSize = 8; + + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_SearchSpace_t *ss = ra->ra_ss; + + long BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + + NR_BWP_Downlink_t *bwp = NULL; // For SA we use InitialBWP + if(get_softmodem_params()->sa != 1) { + bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]; + } + + NR_ControlResourceSet_t *coreset = NULL; + if(bwp) { + coreset = get_coreset(bwp, ss, 0); + } else { + coreset = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet; + } + + long BWPStart = 0; + if (get_softmodem_params()->sa != 1) { + BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } else { + BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + } + uint16_t *vrb_map = cc[CC_id].vrb_map; - int rbStart = 0, rbSize = 6; - for (int i = 0; (i < rbSize) && (rbStart <= (dci10_bw - rbSize)); i++) { + for (int i = 0; (i < rbSize) && (rbStart <= (BWPSize - rbSize)); i++) { if (vrb_map[rbStart + i]) { rbStart += i; i = 0; } } - if (rbStart > (dci10_bw - rbSize)) { - LOG_E(MAC, "%s(): cannot find free vrb_map for RA RNTI %04x!\n", __func__, ra->RA_rnti); + + if (rbStart > (BWPSize - rbSize)) { + LOG_E(NR_MAC, "%s(): cannot find free vrb_map for RA RNTI %04x!\n", __func__, ra->RA_rnti); return; } + // Checking if the DCI allocation is feasible in current subframe nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body; - // Checking if the DCI allocation is feasible in current subframe: we might - // need to need up to two (PDCCH + PDSCH) messages, so check that we can - // always allocate both (this might be an overestimation, since the PDCCH - // message might already exist) if (dl_req->nPDUs > NFAPI_NR_MAX_DL_TTI_PDUS - 2) { - LOG_I(MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, RA_rnti); + LOG_I(NR_MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, ra->RA_rnti); return; } - uint8_t nr_of_candidates, aggregation_level; + uint8_t aggregation_level; + uint8_t nr_of_candidates; find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss); - NR_BWP_Downlink_t *bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; - NR_ControlResourceSet_t *coreset = get_coreset(bwp, ss, 0 /* common */); - int CCEIndex = allocate_nr_CCEs(nr_mac, - bwp, - coreset, - aggregation_level, - 0, // Y - 0, // m - nr_of_candidates); - + int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates); if (CCEIndex < 0) { - LOG_E(MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti); + LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti); return; } - /* look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not - * exist, create it. This is especially important if we have multiple RAs, - * and the DLSCH has to reuse them, so we need to mark them */ - const int bwpid = bwp->bwp_Id; + // Calculate number of symbols + int startSymbolIndex, nrOfSymbols; + const int startSymbolAndLength = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated-> + downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup-> + pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n"); + + int mappingtype = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated-> + downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup-> + pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType; + + uint8_t numDmrsCdmGrpsNoData = 2; + if (nrOfSymbols == 2) { + numDmrsCdmGrpsNoData = 1; + } + + // look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially + // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them const int coresetid = coreset->controlResourceSetId; - nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid]; if (!pdcch_pdu_rel15) { nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); @@ -909,7 +971,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_req->nPDUs += 1; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp); - nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15; + nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15; } nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; @@ -919,81 +981,75 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_req->nPDUs+=1; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; - LOG_I(MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RAR DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state); + LOG_I(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d\n", + module_idP, CC_id, frameP, slotP, ra->RA_rnti, ra->state); - NR_BWP_Uplink_t *ubwp=ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1]; + AssertFatal(ra->secondaryCellGroup, "no secondaryCellGroup for RNTI %04x\n", ra->RA_rnti); - LOG_I(MAC, "[RAPROC] Scheduling common search space DCI type 1 dlBWP BW %d\n", dci10_bw); + AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1, + "downlinkBWP_ToAddModList has %d BWP!\n", + ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); - // Qm>2 not allowed for RAR - if (get_softmodem_params()->do_ra) - mcsIndex = 9; - else - mcsIndex = 0; - - pdsch_pdu_rel15->pduBitmap = 0; - pdsch_pdu_rel15->rnti = RA_rnti; - /* SCF222: PDU index incremented for each PDSCH PDU sent in TX control - * message. This is used to associate control information to data and is - * reset every slot. */ + // SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control + // information to data and is reset every slot. const int pduindex = nr_mac->pdu_index[CC_id]++; - pdsch_pdu_rel15->pduIndex = pduindex; - - pdsch_pdu_rel15->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdsch_pdu_rel15->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; - pdsch_pdu_rel15->CyclicPrefix = 0; - pdsch_pdu_rel15->NrOfCodewords = 1; - pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,0); - pdsch_pdu_rel15->qamModOrder[0] = 2; - pdsch_pdu_rel15->mcsIndex[0] = mcsIndex; - if (bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) - pdsch_pdu_rel15->mcsTable[0] = 0; + uint8_t mcsTableIdx = 0; + if (bwp==NULL || bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) + mcsTableIdx = 0; else{ if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0) - pdsch_pdu_rel15->mcsTable[0] = 1; + mcsTableIdx = 1; else - pdsch_pdu_rel15->mcsTable[0] = 2; + mcsTableIdx = 2; } + + AssertFatal(numDmrsCdmGrpsNoData == 1 || numDmrsCdmGrpsNoData == 2, + "nr_mac->schedCtrlCommon->numDmrsCdmGrpsNoData %d is not possible", + numDmrsCdmGrpsNoData); + + pdsch_pdu_rel15->pduBitmap = 0; + pdsch_pdu_rel15->rnti = ra->RA_rnti; + pdsch_pdu_rel15->pduIndex = pduindex; + pdsch_pdu_rel15->BWPSize = BWPSize; + pdsch_pdu_rel15->BWPStart = BWPStart; + pdsch_pdu_rel15->SubcarrierSpacing = bwp!=NULL ? bwp->bwp_Common->genericParameters.subcarrierSpacing : scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing; + pdsch_pdu_rel15->CyclicPrefix = 0; + pdsch_pdu_rel15->NrOfCodewords = 1; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,mcsTableIdx); + pdsch_pdu_rel15->qamModOrder[0] = 2; + pdsch_pdu_rel15->mcsIndex[0] = mcsIndex; + pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; pdsch_pdu_rel15->rvIndex[0] = 0; pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; pdsch_pdu_rel15->nrOfLayers = 1; pdsch_pdu_rel15->transmissionScheme = 0; pdsch_pdu_rel15->refPoint = 0; - pdsch_pdu_rel15->dmrsConfigType = 0; + pdsch_pdu_rel15->dmrsConfigType = bwp!=NULL ? (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu_rel15->SCID = 0; - pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = numDmrsCdmGrpsNoData; pdsch_pdu_rel15->dmrsPorts = 1; pdsch_pdu_rel15->resourceAlloc = 1; pdsch_pdu_rel15->rbStart = rbStart; pdsch_pdu_rel15->rbSize = rbSize; - pdsch_pdu_rel15->VRBtoPRBMapping = 0; // non interleaved + pdsch_pdu_rel15->VRBtoPRBMapping = 0; + pdsch_pdu_rel15->StartSymbolIndex = startSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = nrOfSymbols; + pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, + nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, + nrOfSymbols, + startSymbolIndex, + mappingtype); - for (int i=0; ibwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count; i++) { - startSymbolAndLength = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; - SLIV2SL(startSymbolAndLength, &StartSymbolIndex_tmp, &NrOfSymbols_tmp); - if (NrOfSymbols_tmp < NrOfSymbols) { - NrOfSymbols = NrOfSymbols_tmp; - StartSymbolIndex = StartSymbolIndex_tmp; - time_domain_assignment = i; // this is short PDSCH added to the config to fit mixed slot - } - } + int x_Overhead = 0; + uint8_t tb_scaling = 0; + nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, tb_scaling); - AssertFatal(StartSymbolIndex >= 0, "StartSymbolIndex is negative\n"); - - pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; - pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; - pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, NrOfSymbols); - - /* Fill PDCCH DL DCI PDU */ + // Fill PDCCH DL DCI PDU nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; pdcch_pdu_rel15->numDlDci++; - dci_pdu->RNTI = RA_rnti; - /* TODO: remove next line */ - AssertFatal(ss->searchSpaceType->present != NR_SearchSpace__searchSpaceType_PR_ue_Specific, - "shouldn't the RA SS be common?\n"); + dci_pdu->RNTI = ra->RA_rnti; dci_pdu->ScramblingId = *scc->physCellId; dci_pdu->ScramblingRNTI = 0; dci_pdu->AggregationLevel = aggregation_level; @@ -1003,81 +1059,434 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dci_pdu_rel15_t dci_payload; dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, - pdsch_pdu_rel15->rbStart,dci10_bw); + pdsch_pdu_rel15->rbStart, + pdsch_pdu_rel15->BWPSize); + dci_payload.time_domain_assignment.val = time_domain_assignment; dci_payload.vrb_to_prb_mapping.val = 0; dci_payload.mcs = pdsch_pdu_rel15->mcsIndex[0]; - dci_payload.tb_scaling = 0; + dci_payload.tb_scaling = tb_scaling; - LOG_I(MAC, + LOG_D(NR_MAC, "[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n", dci_payload.frequency_domain_assignment.val, pdsch_pdu_rel15->rbStart, pdsch_pdu_rel15->rbSize, - dci10_bw, + pdsch_pdu_rel15->BWPSize, dci_payload.time_domain_assignment.val, dci_payload.vrb_to_prb_mapping.val, dci_payload.mcs, dci_payload.tb_scaling); - LOG_I(MAC, "Frame %d: Subframe %d : Adding common DL DCI for RA_RNTI %x\n", frameP, slotP, RA_rnti); - - const int dci_format = NR_DL_DCI_FORMAT_1_0; - const int rnti_type = NR_RNTI_RA; - - LOG_I(MAC, - "[RAPROC] DCI params: rnti %d, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", + LOG_D(NR_MAC, + "[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", pdcch_pdu_rel15->dci_pdu[0].RNTI, - rnti_type, - dci_format, + NR_RNTI_RA, + NR_DL_DCI_FORMAT_1_0, (unsigned long long)pdcch_pdu_rel15->FreqDomainResource, pdcch_pdu_rel15->StartSymbolIndex, pdcch_pdu_rel15->DurationSymbols); fill_dci_pdu_rel15(scc, - ra->secondaryCellGroup, - dci_pdu, + nr_mac->secondaryCellGroupCommon, + &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1], &dci_payload, - dci_format, - rnti_type, - dci10_bw, + NR_DL_DCI_FORMAT_1_0, + NR_RNTI_RA, + pdsch_pdu_rel15->BWPSize, ra->bwp_id); // DL TX request nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; + + // Program UL processing for Msg3 + NR_BWP_Uplink_t *ubwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1]; + nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra, nr_mac->tdd_beam_association); + nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]); + + if(ra->cfra) { + LOG_I(NR_MAC, "Frame %d, Subframe %d: Setting RA-Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); + } + + T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->RA_rnti), T_INT(frameP), + T_INT(slotP), T_INT(0), T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length)); + tx_req->PDU_length = pdsch_pdu_rel15->TBSize[0]; tx_req->PDU_index = pduindex; tx_req->num_TLV = 1; - tx_req->TLVs[0].length = 8; + tx_req->TLVs[0].length = tx_req->PDU_length + 2; nr_mac->TX_req[CC_id].SFN = frameP; nr_mac->TX_req[CC_id].Number_of_PDUs++; nr_mac->TX_req[CC_id].Slot = slotP; - // Program UL processing for Msg3 - nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra); - LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); - nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]); - ra->state = WAIT_Msg3; - LOG_I(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); - - x_Overhead = 0; - nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, dci_payload.tb_scaling); - - T(T_GNB_MAC_DL_RAR_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), - T_INT(RA_rnti), T_INT(frameP), T_INT(slotP), T_INT(0) /* harq pid, meaningful? */, - T_BUFFER(&tx_req->TLVs[0].value.direct[0], tx_req->TLVs[0].length)); - - /* mark the corresponding RBs as used */ - for (int rb = 0; rb < rbSize; rb++) + // Mark the corresponding RBs as used + for (int rb = 0; rb < rbSize; rb++) { vrb_map[rb + rbStart] = 1; + } + + ra->state = WAIT_Msg3; + LOG_I(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); } } -void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP){ - - NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[0]; - LOG_D(MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra->rnti); - ra->state = IDLE; +void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra) { + + gNB_MAC_INST *nr_mac = RC.nrmac[module_idP]; + NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id]; + + if (ra->Msg4_frame == frameP && ra->Msg4_slot == slotP ) { + + uint8_t time_domain_assignment = 0; + uint8_t mcsIndex = 0; + + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_SearchSpace_t *ss = ra->ra_ss; + + NR_BWP_Downlink_t *bwp = NULL; // For SA we use InitialBWP + if(get_softmodem_params()->sa != 1) { + bwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]; + } + + NR_ControlResourceSet_t *coreset = NULL; + if(bwp) { + coreset = get_coreset(bwp, ss, 0); + } else { + coreset = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonControlResourceSet; + } + + int UE_id = find_nr_UE_id(module_idP, ra->rnti); + NR_UE_info_t *UE_info = &nr_mac->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + + long BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + long BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + + // HARQ management + AssertFatal(sched_ctrl->available_dl_harq.head >= 0, + "UE context not initialized: no HARQ processes found\n"); + int current_harq_pid = sched_ctrl->available_dl_harq.head; + remove_front_nr_list(&sched_ctrl->available_dl_harq); + NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid]; + DevAssert(!harq->is_waiting); + add_tail_nr_list(&sched_ctrl->feedback_dl_harq, current_harq_pid); + harq->is_waiting = true; + ra->harq_pid = current_harq_pid; + + int alloc = nr_acknack_scheduling(module_idP, UE_id, frameP, slotP); + AssertFatal(alloc>=0,"Couldn't find a pucch allocation for ack nack (msg4)\n"); + NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[alloc]; + harq->feedback_slot = pucch->ul_slot; + harq->feedback_frame = pucch->frame; + + // Bytes to be transmitted + uint8_t *buf = (uint8_t *) harq->tb; + uint16_t mac_pdu_length = nr_write_ce_dlsch_pdu(module_idP, nr_mac->sched_ctrlCommon, buf, 255, ra->cont_res_id); + LOG_D(NR_MAC,"Encoded contention resolution mac_pdu_length %d\n",mac_pdu_length); + uint16_t mac_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, CCCH, ra->rnti, 1, &buf[mac_pdu_length+2]); + ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->R = 0; + ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->F = 0; + ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->LCID = DL_SCH_LCID_CCCH; + ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->L = mac_sdu_length; + mac_pdu_length = mac_pdu_length + mac_sdu_length + sizeof(NR_MAC_SUBHEADER_SHORT); + + LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + 2 bytes), mac_pdu_length %d\n",mac_sdu_length,mac_pdu_length); + + // Calculate number of symbols + int startSymbolIndex, nrOfSymbols; + const int startSymbolAndLength = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated-> + downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup-> + pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + AssertFatal(startSymbolIndex >= 0, "StartSymbolIndex is negative\n"); + + int mappingtype = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated-> + downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]->bwp_Common->pdsch_ConfigCommon->choice.setup-> + pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->mappingType; + + uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, + nr_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, + nrOfSymbols, + startSymbolIndex, + mappingtype); + + uint16_t N_DMRS_SLOT = get_num_dmrs(dlDmrsSymbPos); + + long dmrsConfigType = bwp!=NULL ? (bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1) : 0; + + nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData = 2; + if (nrOfSymbols == 2) { + nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData = 1; + } + + AssertFatal(nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData == 1 + || nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData == 2, + "nr_mac->schedCtrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData %d is not possible", + nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData); + + uint8_t N_PRB_DMRS = 0; + if (dmrsConfigType==NFAPI_NR_DMRS_TYPE1) { + N_PRB_DMRS = nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 6; + } + else { + N_PRB_DMRS = nr_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 4; + } + + uint8_t mcsTableIdx = 0; + if (bwp==NULL || bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == NULL) + mcsTableIdx = 0; + else{ + if (*bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table == 0) + mcsTableIdx = 1; + else + mcsTableIdx = 2; + } + + int rbStart = 0; + int rbSize = 0; + uint8_t tb_scaling = 0; + uint16_t *vrb_map = cc[CC_id].vrb_map; + do { + rbSize++; + LOG_D(NR_MAC,"Calling nr_compute_tbs with N_PRB_DMRS %d, N_DMRS_SLOT %d\n",N_PRB_DMRS,N_DMRS_SLOT); + harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx), + nr_get_code_rate_dl(mcsIndex, mcsTableIdx), + rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3; + } while (rbStart + rbSize < BWPSize && !vrb_map[rbStart + rbSize] && harq->tb_size < mac_pdu_length); + + for (int i = 0; (i < rbSize) && (rbStart <= (BWPSize - rbSize)); i++) { + if (vrb_map[rbStart + i]) { + rbStart += i; + i = 0; + } + } + + if (rbStart > (BWPSize - rbSize)) { + LOG_E(NR_MAC, "%s(): cannot find free vrb_map for RNTI %04x!\n", __func__, ra->rnti); + return; + } + + // Checking if the DCI allocation is feasible in current subframe + nfapi_nr_dl_tti_request_body_t *dl_req = &nr_mac->DL_req[CC_id].dl_tti_request_body; + if (dl_req->nPDUs > NFAPI_NR_MAX_DL_TTI_PDUS - 2) { + LOG_I(NR_MAC, "[RAPROC] Subframe %d: FAPI DL structure is full, skip scheduling UE %d\n", slotP, ra->rnti); + return; + } + + uint8_t aggregation_level; + uint8_t nr_of_candidates; + find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss); + int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates); + if (CCEIndex < 0) { + LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti); + return; + } + + // look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially + // important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them + const int coresetid = coreset->controlResourceSetId; + nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid]; + if (!pdcch_pdu_rel15) { + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset(dl_tti_pdcch_pdu, 0, sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdcch_pdu->PDUType = NFAPI_NR_DL_TTI_PDCCH_PDU_TYPE; + dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu)); + dl_req->nPDUs += 1; + pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; + nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp); + nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15; + } + + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void *)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; + dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu)); + dl_req->nPDUs+=1; + nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; + + LOG_I(NR_MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg4 DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state); + + AssertFatal(ra->secondaryCellGroup, "no secondaryCellGroup for RNTI %04x\n", ra->rnti); + + AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1, + "downlinkBWP_ToAddModList has %d BWP!\n", + ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); + + // SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control + // information to data and is reset every slot. + const int pduindex = nr_mac->pdu_index[CC_id]++; + + pdsch_pdu_rel15->pduBitmap = 0; + pdsch_pdu_rel15->rnti = ra->rnti; + pdsch_pdu_rel15->pduIndex = pduindex; + pdsch_pdu_rel15->BWPSize = BWPSize; + pdsch_pdu_rel15->BWPStart = BWPStart; + pdsch_pdu_rel15->SubcarrierSpacing = bwp!=NULL ? bwp->bwp_Common->genericParameters.subcarrierSpacing : scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing; + pdsch_pdu_rel15->CyclicPrefix = 0; + pdsch_pdu_rel15->NrOfCodewords = 1; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(mcsIndex,mcsTableIdx); + pdsch_pdu_rel15->qamModOrder[0] = 2; + pdsch_pdu_rel15->mcsIndex[0] = mcsIndex; + pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; + pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[harq->round]; + pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; + pdsch_pdu_rel15->nrOfLayers = 1; + pdsch_pdu_rel15->transmissionScheme = 0; + pdsch_pdu_rel15->refPoint = 0; + pdsch_pdu_rel15->dmrsConfigType = dmrsConfigType; + pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; + pdsch_pdu_rel15->SCID = 0; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = 2; + pdsch_pdu_rel15->dmrsPorts = 1; + pdsch_pdu_rel15->resourceAlloc = 1; + pdsch_pdu_rel15->rbStart = rbStart; + pdsch_pdu_rel15->rbSize = rbSize; + pdsch_pdu_rel15->VRBtoPRBMapping = 0; + pdsch_pdu_rel15->StartSymbolIndex = startSymbolIndex; + pdsch_pdu_rel15->NrOfSymbols = nrOfSymbols; + pdsch_pdu_rel15->dlDmrsSymbPos = dlDmrsSymbPos; + + int x_Overhead = 0; + nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, tb_scaling); + + pdsch_pdu_rel15->precodingAndBeamforming.num_prgs=1; + pdsch_pdu_rel15->precodingAndBeamforming.prg_size=275; + pdsch_pdu_rel15->precodingAndBeamforming.dig_bf_interfaces=1; + pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].pm_idx = 0; + pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = ra->beam_id; + + /* Fill PDCCH DL DCI PDU */ + nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; + pdcch_pdu_rel15->numDlDci++; + dci_pdu->RNTI = ra->rnti; + dci_pdu->ScramblingId = *scc->physCellId; + dci_pdu->ScramblingRNTI = 0; + dci_pdu->AggregationLevel = aggregation_level; + dci_pdu->CceIndex = CCEIndex; + dci_pdu->beta_PDCCH_1_0 = 0; + dci_pdu->powerControlOffsetSS = 1; + + dci_pdu_rel15_t dci_payload; + dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->rbStart, + pdsch_pdu_rel15->BWPSize); + + dci_payload.format_indicator = 1; + dci_payload.time_domain_assignment.val = time_domain_assignment; + dci_payload.vrb_to_prb_mapping.val = 0; + dci_payload.mcs = pdsch_pdu_rel15->mcsIndex[0]; + dci_payload.tb_scaling = tb_scaling; + dci_payload.rv = pdsch_pdu_rel15->rvIndex[0]; + dci_payload.harq_pid = current_harq_pid; + dci_payload.ndi = harq->ndi; + dci_payload.dai[0].val = (pucch->dai_c-1)&3; + dci_payload.tpc = sched_ctrl->tpc1; // TPC for PUCCH: table 7.2.1-1 in 38.213 + dci_payload.pucch_resource_indicator = pucch->resource_indicator; + dci_payload.pdsch_to_harq_feedback_timing_indicator.val = pucch->timing_indicator; + + LOG_D(NR_MAC, + "[RAPROC] DCI type 1 payload: freq_alloc %d (%d,%d,%d), time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d \n", + dci_payload.frequency_domain_assignment.val, + pdsch_pdu_rel15->rbStart, + pdsch_pdu_rel15->rbSize, + pdsch_pdu_rel15->BWPSize, + dci_payload.time_domain_assignment.val, + dci_payload.vrb_to_prb_mapping.val, + dci_payload.mcs, + dci_payload.tb_scaling); + + LOG_D(NR_MAC, + "[RAPROC] DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", + pdcch_pdu_rel15->dci_pdu[0].RNTI, + NR_RNTI_TC, + NR_DL_DCI_FORMAT_1_0, + (unsigned long long)pdcch_pdu_rel15->FreqDomainResource, + pdcch_pdu_rel15->StartSymbolIndex, + pdcch_pdu_rel15->DurationSymbols); + + fill_dci_pdu_rel15(scc, + nr_mac->secondaryCellGroupCommon, + &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1], + &dci_payload, + NR_DL_DCI_FORMAT_1_0, + NR_RNTI_TC, + pdsch_pdu_rel15->BWPSize, + ra->bwp_id); + + // Add padding header and zero rest out if there is space left + if (mac_pdu_length < harq->tb_size) { + NR_MAC_SUBHEADER_FIXED *padding = (NR_MAC_SUBHEADER_FIXED *) &buf[mac_pdu_length]; + padding->R = 0; + padding->LCID = DL_SCH_LCID_PADDING; + for(int k = mac_pdu_length+1; ktb_size; k++) { + buf[k] = 0; + } + } + + // DL TX request + nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs]; + memcpy(tx_req->TLVs[0].value.direct, harq->tb, sizeof(uint8_t) * harq->tb_size); + tx_req->PDU_length = harq->tb_size; + tx_req->PDU_index = pduindex; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = harq->tb_size + 2; + nr_mac->TX_req[CC_id].SFN = frameP; + nr_mac->TX_req[CC_id].Number_of_PDUs++; + nr_mac->TX_req[CC_id].Slot = slotP; + + // Mark the corresponding RBs as used + for (int rb = 0; rb < pdsch_pdu_rel15->rbSize; rb++) { + vrb_map[rb + pdsch_pdu_rel15->rbStart] = 1; + } + + LOG_D(NR_MAC,"BWPSize: %i\n", pdcch_pdu_rel15->BWPSize); + LOG_D(NR_MAC,"BWPStart: %i\n", pdcch_pdu_rel15->BWPStart); + LOG_D(NR_MAC,"SubcarrierSpacing: %i\n", pdcch_pdu_rel15->SubcarrierSpacing); + LOG_D(NR_MAC,"CyclicPrefix: %i\n", pdcch_pdu_rel15->CyclicPrefix); + LOG_D(NR_MAC,"StartSymbolIndex: %i\n", pdcch_pdu_rel15->StartSymbolIndex); + LOG_D(NR_MAC,"DurationSymbols: %i\n", pdcch_pdu_rel15->DurationSymbols); + for(int n=0;n<6;n++) LOG_D(NR_MAC,"FreqDomainResource[%i]: %x\n",n, pdcch_pdu_rel15->FreqDomainResource[n]); + LOG_D(NR_MAC,"CceRegMappingType: %i\n", pdcch_pdu_rel15->CceRegMappingType); + LOG_D(NR_MAC,"RegBundleSize: %i\n", pdcch_pdu_rel15->RegBundleSize); + LOG_D(NR_MAC,"InterleaverSize: %i\n", pdcch_pdu_rel15->InterleaverSize); + LOG_D(NR_MAC,"CoreSetType: %i\n", pdcch_pdu_rel15->CoreSetType); + LOG_D(NR_MAC,"ShiftIndex: %i\n", pdcch_pdu_rel15->ShiftIndex); + LOG_D(NR_MAC,"precoderGranularity: %i\n", pdcch_pdu_rel15->precoderGranularity); + LOG_D(NR_MAC,"numDlDci: %i\n", pdcch_pdu_rel15->numDlDci); + + ra->state = WAIT_Msg4_ACK; + LOG_I(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); + } +} + +void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t slot, NR_RA_t *ra) { + + int UE_id = find_nr_UE_id(module_id, ra->rnti); + const int current_harq_pid = ra->harq_pid; + + NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid]; + + LOG_D(NR_MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid); + + if (harq->is_waiting == 0) + { + if (harq->round == 0) + { + LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti); + nr_clear_ra_proc(module_id, CC_id, frame, ra); + UE_info->active[UE_id] = true; + } + else + { + ra->state = Msg4; + } + } + +} + +void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra){ + LOG_D(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra->rnti); + ra->state = RA_IDLE; ra->timing_offset = 0; ra->RRC_timer = 20; ra->rnti = 0; @@ -1120,9 +1529,10 @@ void nr_fill_rar(uint8_t Mod_idP, uint8_t * dlsch_buffer, nfapi_nr_pusch_pdu_t *pusch_pdu){ - LOG_I(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset); - NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; - NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); + LOG_I(NR_MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d \n", ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset); + NR_RA_HEADER_BI *rarbi = (NR_RA_HEADER_BI *) dlsch_buffer; + NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) (dlsch_buffer + 1); + NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 2); unsigned char csi_req = 0, tpc_command; //uint8_t N_UL_Hop; uint8_t valid_bits; @@ -1131,6 +1541,16 @@ void nr_fill_rar(uint8_t Mod_idP, tpc_command = 3; // this is 0 dB + /// E/T/R/R/BI subheader /// + // E = 1, MAC PDU includes another MAC sub-PDU (RAPID) + // T = 0, Back-off indicator subheader + // R = 2, Reserved + // BI = 0, 5ms + rarbi->E = 1; + rarbi->T = 0; + rarbi->R = 0; + rarbi->BI = 0; + /// E/T/RAPID subheader /// // E = 0, one only RAR, first and last // T = 1, RAPID @@ -1177,4 +1597,50 @@ void nr_fill_rar(uint8_t Mod_idP, rar->UL_GRANT_3 = (uint8_t) (ul_grant >> 8) & 0xff; rar->UL_GRANT_4 = (uint8_t) ul_grant & 0xff; +#ifdef DEBUG_RAR + //LOG_I(NR_MAC, "rarbi->E = 0x%x\n", rarbi->E); + //LOG_I(NR_MAC, "rarbi->T = 0x%x\n", rarbi->T); + //LOG_I(NR_MAC, "rarbi->R = 0x%x\n", rarbi->R); + //LOG_I(NR_MAC, "rarbi->BI = 0x%x\n", rarbi->BI); + + LOG_I(NR_MAC, "rarh->E = 0x%x\n", rarh->E); + LOG_I(NR_MAC, "rarh->T = 0x%x\n", rarh->T); + LOG_I(NR_MAC, "rarh->RAPID = 0x%x (%i)\n", rarh->RAPID, rarh->RAPID); + + LOG_I(NR_MAC, "rar->R = 0x%x\n", rar->R); + LOG_I(NR_MAC, "rar->TA1 = 0x%x\n", rar->TA1); + + LOG_I(NR_MAC, "rar->TA2 = 0x%x\n", rar->TA2); + LOG_I(NR_MAC, "rar->UL_GRANT_1 = 0x%x\n", rar->UL_GRANT_1); + + LOG_I(NR_MAC, "rar->UL_GRANT_2 = 0x%x\n", rar->UL_GRANT_2); + LOG_I(NR_MAC, "rar->UL_GRANT_3 = 0x%x\n", rar->UL_GRANT_3); + LOG_I(NR_MAC, "rar->UL_GRANT_4 = 0x%x\n", rar->UL_GRANT_4); + + LOG_I(NR_MAC, "rar->TCRNTI_1 = 0x%x\n", rar->TCRNTI_1); + LOG_I(NR_MAC, "rar->TCRNTI_2 = 0x%x\n", rar->TCRNTI_2); +#endif + + int mcs = (unsigned char) (rar->UL_GRANT_4 >> 4); + // time alloc + int Msg3_t_alloc = (unsigned char) (rar->UL_GRANT_3 & 0x07); + // frequency alloc + int Msg3_f_alloc = (uint16_t) ((rar->UL_GRANT_3 >> 4) | (rar->UL_GRANT_2 << 4) | ((rar->UL_GRANT_1 & 0x03) << 12)); + // frequency hopping + int freq_hopping = (unsigned char) (rar->UL_GRANT_1 >> 2); + // TA command + int ta_command = rar->TA2 + (rar->TA1 << 5); + // TC-RNTI + int t_crnti = rar->TCRNTI_2 + (rar->TCRNTI_1 << 8); + + LOG_I(NR_MAC, "In %s: Transmitted RAR with t_alloc %d f_alloc %d ta_command %d mcs %d freq_hopping %d tpc_command %d csi_req %d t_crnti %x \n", + __FUNCTION__, + Msg3_t_alloc, + Msg3_f_alloc, + ta_command, + mcs, + freq_hopping, + tpc_command, + csi_req, + t_crnti); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 3f69cfbe74..f93ad92a13 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -53,26 +53,12 @@ #include "executables/softmodem-common.h" extern RAN_CONTEXT_t RC; -extern uint8_t SSB_Table[38]; -void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, uint8_t slots_per_frame){ - gNB_MAC_INST *gNB = RC.nrmac[module_idP]; - NR_COMMON_channels_t *cc; - - nfapi_nr_dl_tti_request_t *dl_tti_request; - nfapi_nr_dl_tti_request_body_t *dl_req; - nfapi_nr_dl_tti_request_pdu_t *dl_config_pdu; +uint16_t get_ssboffset_pointa(NR_ServingCellConfigCommon_t *scc,const long band) { - int mib_sdu_length; - int CC_id; - - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - cc = &gNB->common_channels[CC_id]; - const long band = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - const uint32_t ssb_offset0 = *cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - int ratio; - switch (*cc->ServingCellConfigCommon->ssbSubcarrierSpacing) { + int ratio; + switch (*scc->ssbSubcarrierSpacing) { case NR_SubcarrierSpacing_kHz15: AssertFatal(band <= 79, "Band %ld is not possible for SSB with 15 kHz SCS\n", @@ -105,116 +91,203 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, break; default: AssertFatal(1 == 0, "SCS %ld not allowed for SSB \n", - *cc->ServingCellConfigCommon->ssbSubcarrierSpacing); - } + *scc->ssbSubcarrierSpacing); + } - // scheduling MIB every 8 frames, PHY repeats it in between + const uint32_t ssb_offset0 = *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + + return (ssb_offset0/(ratio*12) - 10); // absoluteFrequencySSB is the center of SSB + +} + + +void schedule_ssb(frame_t frame, sub_frame_t slot, + NR_ServingCellConfigCommon_t *scc, + nfapi_nr_dl_tti_request_body_t *dl_req, + int i_ssb, uint8_t scoffset, uint16_t offset_pointa, uint32_t payload) { + + uint8_t beam_index = 0; + nfapi_nr_dl_tti_request_pdu_t *dl_config_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; + memset((void *) dl_config_pdu, 0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); + dl_config_pdu->PDUType = NFAPI_NR_DL_TTI_SSB_PDU_TYPE; + dl_config_pdu->PDUSize =2 + sizeof(nfapi_nr_dl_tti_ssb_pdu_rel15_t); + + AssertFatal(scc->physCellId!=NULL,"ServingCellConfigCommon->physCellId is null\n"); + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.PhysCellId = *scc->physCellId; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.BetaPss = 0; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = i_ssb; + AssertFatal(scc->downlinkConfigCommon!=NULL,"scc->downlinkConfigCommonL is null\n"); + AssertFatal(scc->downlinkConfigCommon->frequencyInfoDL!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL is null\n"); + AssertFatal(scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB is null\n"); + AssertFatal(scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count==1,"Frequency Band list does not have 1 element (%d)\n", + scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count); + AssertFatal(scc->ssbSubcarrierSpacing,"ssbSubcarrierSpacing is null\n"); + AssertFatal(scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],"band is null\n"); + + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = scoffset; //kSSB + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = offset_pointa; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag = 1; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = payload; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.num_prgs=1; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.prg_size=275; //1 PRG of max size for analogue beamforming + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.dig_bf_interfaces=1; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.prgs_list[0].pm_idx = 0; + dl_config_pdu->ssb_pdu.ssb_pdu_rel15.precoding_and_beamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = beam_index; + dl_req->nPDUs++; + + LOG_D(MAC,"Scheduling ssb %d at frame %d and slot %d\n",i_ssb,frame,slot); + +} + +void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) +{ + gNB_MAC_INST *gNB = RC.nrmac[module_idP]; + NR_COMMON_channels_t *cc; + nfapi_nr_dl_tti_request_t *dl_tti_request; + nfapi_nr_dl_tti_request_body_t *dl_req; + NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib.message.choice.mib; + uint8_t num_tdd_period,num_ssb; + int mib_sdu_length; + int CC_id; + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + cc = &gNB->common_channels[CC_id]; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + const int slots_per_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + dl_tti_request = &gNB->DL_req[CC_id]; + dl_req = &dl_tti_request->dl_tti_request_body; + + // get MIB every 8 frames if((slotP == 0) && (frameP & 7) == 0) { - dl_tti_request = &gNB->DL_req[CC_id]; - dl_req = &dl_tti_request->dl_tti_request_body; - mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0]); - - LOG_D(MAC, "Frame %d, slot %d: BCH PDU length %d\n", frameP, slotP, mib_sdu_length); - - if (mib_sdu_length > 0) { - LOG_D(MAC, - "Frame %d, slot %d: Adding BCH PDU in position %d (length %d)\n", - frameP, - slotP, - dl_req->nPDUs, - mib_sdu_length); - - if ((frameP & 1023) < 80){ - LOG_D(MAC, - "[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n", - module_idP, - frameP, - CC_id, - mib_sdu_length); - } - - dl_config_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; - memset((void *) dl_config_pdu, 0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); - dl_config_pdu->PDUType = NFAPI_NR_DL_TTI_SSB_PDU_TYPE; - dl_config_pdu->PDUSize =2 + sizeof(nfapi_nr_dl_tti_ssb_pdu_rel15_t); - - AssertFatal(cc->ServingCellConfigCommon->physCellId!=NULL,"cc->ServingCellConfigCommon->physCellId is null\n"); - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.PhysCellId = *cc->ServingCellConfigCommon->physCellId; - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.BetaPss = 0; - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbBlockIndex = 0; - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon!=NULL,"scc->downlinkConfigCommonL is null\n"); - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL is null\n"); - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB!=NULL,"scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB is null\n"); - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count==1,"Frequency Band list does not have 1 element (%d)\n",cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count); - AssertFatal(cc->ServingCellConfigCommon->ssbSubcarrierSpacing,"ssbSubcarrierSpacing is null\n"); - AssertFatal(cc->ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0],"band is null\n"); - - const nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0]; - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset = cfg->ssb_table.ssb_subcarrier_offset.value; //kSSB - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA = ssb_offset0/(ratio*12) - 10; // absoluteFrequencySSB is the center of SSB - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayloadFlag = 1; - dl_config_pdu->ssb_pdu.ssb_pdu_rel15.bchPayload = (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1); - dl_req->nPDUs++; - } - - // Get type0_PDCCH_CSS_config parameters - NR_DL_FRAME_PARMS *frame_parms = &RC.gNB[module_idP]->frame_parms; - NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib.message.choice.mib; - uint8_t gNB_xtra_byte = 0; - for (int i = 0; i < 8; i++) { - gNB_xtra_byte |= ((RC.gNB[module_idP]->pbch.pbch_a >> (31 - i)) & 1) << (7 - i); - } - get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config, mib, gNB_xtra_byte, frame_parms->Lmax, - frame_parms->ssb_index, frame_parms->ssb_start_subcarrier/NR_NB_SC_PER_RB); + mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 0, 1, &cc->MIB_pdu.payload[0]); + LOG_D(MAC, + "[gNB %d] Frame %d : MIB->BCH CC_id %d, Received %d bytes\n", + module_idP, + frameP, + CC_id, + mib_sdu_length); } - // checking if there is any SSB in slot - const int abs_slot = (slots_per_frame * frameP) + slotP; - const int slot_per_period = (slots_per_frame>>1)<<(*cc->ServingCellConfigCommon->ssb_periodicityServingCell); - int eff_120_slot; - const BIT_STRING_t *shortBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.shortBitmap; - const BIT_STRING_t *mediumBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.mediumBitmap; - const BIT_STRING_t *longBitmap = &cc->ServingCellConfigCommon->ssb_PositionsInBurst->choice.longBitmap; - uint8_t buf = 0; - switch (cc->ServingCellConfigCommon->ssb_PositionsInBurst->present) { - case 1: - // presence of ssbs possible in the first 2 slots of ssb period - if ((abs_slot % slot_per_period) < 2 && - (((shortBitmap->buf[0]) >> (6 - (slotP << 1))) & 3) != 0) - fill_ssb_vrb_map(cc, (ssb_offset0 / (ratio * 12) - 10), CC_id); - break; - case 2: - // presence of ssbs possible in the first 4 slots of ssb period - if ((abs_slot % slot_per_period) < 4 && - (((mediumBitmap->buf[0]) >> (6 - (slotP << 1))) & 3) != 0) - fill_ssb_vrb_map(cc, (ssb_offset0 / (ratio * 12) - 10), CC_id); - break; - case 3: - AssertFatal(*cc->ServingCellConfigCommon->ssbSubcarrierSpacing == - NR_SubcarrierSpacing_kHz120, - "240kHZ subcarrier spacing currently not supported for SSBs\n"); - if ((abs_slot % slot_per_period) < 8) { - eff_120_slot = slotP; - buf = longBitmap->buf[0]; - } else if ((abs_slot % slot_per_period) < 17) { - eff_120_slot = slotP - 9; - buf = longBitmap->buf[1]; - } else if ((abs_slot % slot_per_period) < 26) { - eff_120_slot = slotP - 18; - buf = longBitmap->buf[2]; - } else if ((abs_slot % slot_per_period) < 35) { - eff_120_slot = slotP - 27; - buf = longBitmap->buf[3]; - } - if (((buf >> (6 - (eff_120_slot << 1))) & 3) != 0) - fill_ssb_vrb_map(cc, ssb_offset0 / (ratio * 12) - 10, CC_id); - break; - default: - AssertFatal(0, - "SSB bitmap size value %d undefined (allowed values 1,2,3)\n", - cc->ServingCellConfigCommon->ssb_PositionsInBurst->present); + int8_t ssb_period = *scc->ssb_periodicityServingCell; + uint8_t ssb_frame_periodicity = 1; // every how many frames SSB are generated + + if (ssb_period > 1) // 0 is every half frame + ssb_frame_periodicity = 1 << (ssb_period -1); + + if (!(frameP%ssb_frame_periodicity) && + ((slotP<(slots_per_frame>>1)) || (ssb_period == 0))) { + // schedule SSB only for given frames according to SSB periodicity + // and in first half frame unless periodicity of 5ms + int rel_slot; + if (ssb_period == 0) // scheduling every half frame + rel_slot = slotP%(slots_per_frame>>1); + else + rel_slot = slotP; + + NR_SubcarrierSpacing_t scs = *scc->ssbSubcarrierSpacing; + const long band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + uint16_t offset_pointa = get_ssboffset_pointa(scc,band); + uint8_t ssbSubcarrierOffset = gNB->ssb_SubcarrierOffset; + + const BIT_STRING_t *shortBitmap = &scc->ssb_PositionsInBurst->choice.shortBitmap; + const BIT_STRING_t *mediumBitmap = &scc->ssb_PositionsInBurst->choice.mediumBitmap; + const BIT_STRING_t *longBitmap = &scc->ssb_PositionsInBurst->choice.longBitmap; + + uint16_t ssb_start_symbol; + + switch (scc->ssb_PositionsInBurst->present) { + case 1: + // short bitmap (<3GHz) max 4 SSBs + for (int i_ssb=0; i_ssb<4; i_ssb++) { + if ((shortBitmap->buf[0]>>(7-i_ssb))&0x01) { + ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb); + // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters + if ((ssb_start_symbol/14) == rel_slot){ + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id); + if (get_softmodem_params()->sa == 1) { + get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], + frameP, + mib, + slots_per_frame, + ssbSubcarrierOffset, + ssb_start_symbol, + scs, + FR1, + i_ssb, + offset_pointa); + gNB->type0_PDCCH_CSS_config[i_ssb].active = true; + } + } + } + } + break; + case 2: + // medium bitmap (<6GHz) max 8 SSBs + for (int i_ssb=0; i_ssb<8; i_ssb++) { + if ((mediumBitmap->buf[0]>>(7-i_ssb))&0x01) { + ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb); + // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters + if ((ssb_start_symbol/14) == rel_slot){ + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id); + if (get_softmodem_params()->sa == 1) { + get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], + frameP, + mib, + slots_per_frame, + ssbSubcarrierOffset, + ssb_start_symbol, + scs, + FR1, + i_ssb, + offset_pointa); + gNB->type0_PDCCH_CSS_config[i_ssb].active = true; + } + } + } + } + break; + case 3: + // long bitmap FR2 max 64 SSBs + num_ssb = 0; + for (int i_ssb=0; i_ssb<64; i_ssb++) { + if ((longBitmap->buf[i_ssb/8]>>(7-(i_ssb%8)))&0x01) { + ssb_start_symbol = get_ssb_start_symbol(band,scs,i_ssb); + // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters + if ((ssb_start_symbol/14) == rel_slot){ + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + fill_ssb_vrb_map(cc, offset_pointa, ssb_start_symbol, CC_id); + const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; + const int nr_mix_slots = tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0; + const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots; + num_tdd_period = rel_slot/nr_slots_period; + gNB->tdd_beam_association[num_tdd_period]=i_ssb; + num_ssb++; + AssertFatal(num_ssb<2,"beamforming currently not supported for more than one SSB per slot\n"); + if (get_softmodem_params()->sa == 1) { + get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], + frameP, + mib, + slots_per_frame, + ssbSubcarrierOffset, + ssb_start_symbol, + scs, + FR2, + i_ssb, + offset_pointa); + gNB->type0_PDCCH_CSS_config[i_ssb].active = true; + } + } + } + } + break; + default: + AssertFatal(0,"SSB bitmap size value %d undefined (allowed values 1,2,3)\n", + scc->ssb_PositionsInBurst->present); + } } } } @@ -224,14 +297,22 @@ void schedule_nr_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframe //---------------------------------------- } -void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id) { +void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, uint16_t symStart, int CC_id) { + + AssertFatal(*cc->ServingCellConfigCommon->ssbSubcarrierSpacing != + NR_SubcarrierSpacing_kHz240, + "240kHZ subcarrier won't work with current VRB map because a single SSB might be across 2 slots\n"); + uint16_t *vrb_map = cc[CC_id].vrb_map; + for (int rb = 0; rb < 20; rb++) - vrb_map[rbStart + rb] = 1; + vrb_map[rbStart + rb] = 15<common_channels[CC_id].vrb_map; if (gNB_mac->sched_ctrlCommon == NULL){ + LOG_D(NR_MAC,"schedule_control_common: Filling nr_mac->sched_ctrlCommon\n"); gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); - gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp)); fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space); fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon); fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon); } - gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; - gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; - gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; - gNB_mac->sched_ctrlCommon->mcs = mcs; + gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation = time_domain_allocation; + gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx = mcsTableIdx; + gNB_mac->sched_ctrlCommon->sched_pdsch.mcs = mcs; gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes; uint8_t nr_of_candidates; @@ -272,55 +352,67 @@ void schedule_control_sib1(module_id_t module_id, AssertFatal(gNB_mac->sched_ctrlCommon->cce_index >= 0, "Could not find CCE for coreset0\n"); - const uint16_t bwpSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; - int rbStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs; + int rbStart = type0_PDCCH_CSS_config->cset_start_rb; - // Calculate number of symbols - struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; - int startSymbolIndex, nrOfSymbols; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + int startSymbolIndex = 0; + int nrOfSymbols = 0; + + if(gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position == 0) { + startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][1]; + nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][2]; + } else { + startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][1]; + nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][2]; + } + + // TODO: There are exceptions to this in table 5.1.2.1.1-4,5 (Default time domain allocation tables B, C) + int mappingtype = (startSymbolIndex <= 3)? typeA: typeB; if (nrOfSymbols == 2) { - gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 1; + gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData = 1; } else { - gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 2; + gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData = 2; } // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols); + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 6; + uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype); uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); int rbSize = 0; uint32_t TBS = 0; do { rbSize++; - TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), + TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, + gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, + gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx), rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); - gNB_mac->sched_ctrlCommon->rbSize = rbSize; - gNB_mac->sched_ctrlCommon->rbStart = 0; + gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize = rbSize; + gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart = 0; - LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength); LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); - LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); + LOG_D(MAC, "rbSize = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize); LOG_D(MAC,"TBS = %i\n", TBS); + LOG_D(MAC,"mappingtype = %d\n", mappingtype); // Mark the corresponding RBs as used - for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { + for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) { vrb_map[rb + rbStart] = 1; } } void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, nfapi_nr_dl_tti_request_body_t *dl_req, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, uint32_t TBS, int StartSymbolIndex, - int NrOfSymbols) { + int NrOfSymbols, + uint16_t dlDmrsSymbPos) { gNB_MAC_INST *gNB_mac = RC.nrmac[Mod_idP]; NR_COMMON_channels_t *cc = gNB_mac->common_channels; @@ -340,6 +432,10 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, scc, bwp); + // TODO: This assignment should be done in function nr_configure_pdcch() + pdcch_pdu_rel15->BWPSize = type0_PDCCH_CSS_config->num_rbs; + pdcch_pdu_rel15->BWPStart = type0_PDCCH_CSS_config->cset_start_rb; + nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdsch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs]; memset((void*)dl_tti_pdsch_pdu,0,sizeof(nfapi_nr_dl_tti_request_pdu_t)); dl_tti_pdsch_pdu->PDUType = NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE; @@ -353,8 +449,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->rnti = SI_RNTI; pdsch_pdu_rel15->pduIndex = gNB_mac->pdu_index[0]++; - pdsch_pdu_rel15->BWPSize = gNB_mac->type0_PDCCH_CSS_config.num_rbs; - pdsch_pdu_rel15->BWPStart = gNB_mac->type0_PDCCH_CSS_config.cset_start_rb; + pdsch_pdu_rel15->BWPSize = type0_PDCCH_CSS_config->num_rbs; + pdsch_pdu_rel15->BWPStart = type0_PDCCH_CSS_config->cset_start_rb; pdsch_pdu_rel15->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing; if (bwp->bwp_Common->genericParameters.cyclicPrefix) { @@ -364,32 +460,31 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, } pdsch_pdu_rel15->NrOfCodewords = 1; - pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs,0); + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, 0); pdsch_pdu_rel15->qamModOrder[0] = 2; - pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->mcs; + pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->sched_pdsch.mcs; pdsch_pdu_rel15->mcsTable[0] = 0; pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0]; pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; pdsch_pdu_rel15->nrOfLayers = 1; pdsch_pdu_rel15->transmissionScheme = 0; pdsch_pdu_rel15->refPoint = 1; - pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; + pdsch_pdu_rel15->dmrsConfigType = 0; pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu_rel15->SCID = 0; - pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData; + pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData; pdsch_pdu_rel15->dmrsPorts = 1; pdsch_pdu_rel15->resourceAlloc = 1; - pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; - pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; + pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart; + pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; pdsch_pdu_rel15->VRBtoPRBMapping = 0; - pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); + pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, + gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx); pdsch_pdu_rel15->TBSize[0] = TBS; - pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; + pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx; pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; - - pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, pdsch_pdu_rel15->StartSymbolIndex+pdsch_pdu_rel15->NrOfSymbols); - + pdsch_pdu_rel15->dlDmrsSymbPos = dlDmrsSymbPos; LOG_D(MAC,"dlDmrsSymbPos = 0x%x\n", pdsch_pdu_rel15->dlDmrsSymbPos); /* Fill PDCCH DL DCI PDU */ @@ -411,10 +506,10 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, // frequency domain assignment dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0( - pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, gNB_mac->type0_PDCCH_CSS_config.num_rbs); + pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, type0_PDCCH_CSS_config->num_rbs); - dci_payload.time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; - dci_payload.mcs = gNB_mac->sched_ctrlCommon->mcs; + dci_payload.time_domain_assignment.val = gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation; + dci_payload.mcs = gNB_mac->sched_ctrlCommon->sched_pdsch.mcs; dci_payload.rv = pdsch_pdu_rel15->rvIndex[0]; dci_payload.harq_pid = 0; dci_payload.ndi = 0; @@ -456,8 +551,6 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) { - LOG_D(MAC,"Schedule_nr_sib1: frameP = %i, slotP = %i\n", frameP, slotP); - // TODO: Get these values from RRC const int CC_id = 0; int time_domain_allocation = 0; @@ -466,52 +559,87 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) uint8_t candidate_idx = 0; gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; + NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; - if( (frameP%2 == gNB_mac->type0_PDCCH_CSS_config.sfn_c) && (slotP == gNB_mac->type0_PDCCH_CSS_config.n_0) && (gNB_mac->type0_PDCCH_CSS_config.num_rbs > 0) ) { + int L_max; + switch (scc->ssb_PositionsInBurst->present) { + case 1: + L_max = 4; + break; + case 2: + L_max = 8; + break; + case 3: + L_max = 64; + break; + default: + AssertFatal(0,"SSB bitmap size value %d undefined (allowed values 1,2,3)\n", + scc->ssb_PositionsInBurst->present); + } - LOG_D(MAC,"> SIB1 transmission\n"); + for (int i=0; itype0_PDCCH_CSS_config[i]; - // Configure sched_ctrlCommon for SIB1 - schedule_control_sib1(module_idP, CC_id, time_domain_allocation, mcsTableIdx, mcs, candidate_idx, sib1_sdu_length); + if((frameP%2 == type0_PDCCH_CSS_config->sfn_c) && + (slotP == type0_PDCCH_CSS_config->n_0) && + (type0_PDCCH_CSS_config->num_rbs > 0) && + (type0_PDCCH_CSS_config->active == true)) { - // Calculate number of symbols - int startSymbolIndex, nrOfSymbols; - struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + LOG_D(NR_MAC,"(%d.%d) SIB1 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index); - // Calculate number of PRB_DMRS - uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; - uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols); - uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); + // Get SIB1 + uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8]; + uint8_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, SI_RNTI, 1, sib1_payload); + LOG_D(NR_MAC,"sib1_sdu_length = %i\n", sib1_sdu_length); + LOG_D(NR_MAC,"SIB1: \n"); + for (int k=0;ksched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), - gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0 ,0 ,1 ) >> 3; + // Configure sched_ctrlCommon for SIB1 + schedule_control_sib1(module_idP, CC_id, type0_PDCCH_CSS_config, time_domain_allocation, mcsTableIdx, mcs, candidate_idx, sib1_sdu_length); - nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; - nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); + int startSymbolIndex = 0; + int nrOfSymbols = 0; + if(gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position == 0) { + startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][1]; + nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][2]; + } else { + startSymbolIndex = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][1]; + nrOfSymbols = table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[gNB_mac->sched_ctrlCommon->pdsch_semi_static.time_domain_allocation][2]; + } - const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; - nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; + // TODO: There are exceptions to this in table 5.1.2.1.1-4,5 (Default time domain allocation tables B, C) + int mappingtype = (startSymbolIndex <= 3) ? typeA : typeB; - // Data to be transmitted - bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); - memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); + // Calculate number of PRB_DMRS + uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->pdsch_semi_static.numDmrsCdmGrpsNoData * 6; + uint16_t dlDmrsSymbPos = fill_dmrs_mask(NULL, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, nrOfSymbols, startSymbolIndex, mappingtype); + uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); - tx_req->PDU_length = TBS; - tx_req->PDU_index = gNB_mac->pdu_index[0]++; - tx_req->num_TLV = 1; - tx_req->TLVs[0].length = TBS + 2; - gNB_mac->TX_req[CC_id].Number_of_PDUs++; - gNB_mac->TX_req[CC_id].SFN = frameP; - gNB_mac->TX_req[CC_id].Slot = slotP; + const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx), + nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->pdsch_semi_static.mcsTableIdx), + gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0 ,0 ,1 ) >> 3; + + nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; + nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, type0_PDCCH_CSS_config, TBS, startSymbolIndex, nrOfSymbols, dlDmrsSymbPos); + + const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs; + nfapi_nr_pdu_t *tx_req = &gNB_mac->TX_req[CC_id].pdu_list[ntx_req]; + + // Data to be transmitted + bzero(tx_req->TLVs[0].value.direct,MAX_NR_DLSCH_PAYLOAD_BYTES); + memcpy(tx_req->TLVs[0].value.direct, sib1_payload, sib1_sdu_length); + + tx_req->PDU_length = TBS; + tx_req->PDU_index = gNB_mac->pdu_index[0]++; + tx_req->num_TLV = 1; + tx_req->TLVs[0].length = TBS + 2; + gNB_mac->TX_req[CC_id].Number_of_PDUs++; + gNB_mac->TX_req[CC_id].SFN = frameP; + gNB_mac->TX_req[CC_id].Slot = slotP; + + type0_PDCCH_CSS_config->active = false; + } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index cf512653b7..02e0e42139 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -57,8 +57,81 @@ #define WORD 32 //#define SIZE_OF_POINTER sizeof (void *) -int harq_rounds = 0; -int harq_pid = 0; +void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp) +{ + gNB_MAC_INST *nrmac = RC.nrmac[module_id]; + const int bwp_id = bwp->bwp_Id; + if (nrmac->preferred_dl_tda[bwp_id]) + return; + + /* there is a mixed slot only when in TDD */ + NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon; + const NR_TDD_UL_DL_Pattern_t *tdd = + scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; + const int symb_dlMixed = tdd ? (1 << tdd->nrofDownlinkSymbols) - 1 : 0; + + const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + const NR_SearchSpace_t *search_space = get_searchspace(bwp, target_ss); + const NR_ControlResourceSet_t *coreset = get_coreset(bwp, search_space, 1 /* dedicated */); + // get coreset symbol "map" + const uint16_t symb_coreset = (1 << coreset->duration) - 1; + + /* check that TDA index 0 fits into DL and does not overlap CORESET */ + const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = + bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + AssertFatal(tdaList->list.count >= 1, "need to have at least one TDA for DL slots\n"); + const NR_PDSCH_TimeDomainResourceAllocation_t *tdaP_DL = tdaList->list.array[0]; + AssertFatal(!tdaP_DL->k0 || *tdaP_DL->k0 == 0, + "TimeDomainAllocation at index 1: non-null k0 (%ld) is not supported by the scheduler\n", + *tdaP_DL->k0); + int start, len; + SLIV2SL(tdaP_DL->startSymbolAndLength, &start, &len); + const uint16_t symb_tda = ((1 << len) - 1) << start; + // check whether coreset and TDA overlap: then we cannot use it. Note that + // here we assume that the coreset is scheduled every slot (which it + // currently is) and starting at symbol 0 + AssertFatal((symb_coreset & symb_tda) == 0, "TDA index 0 for DL overlaps with CORESET\n"); + + /* check that TDA index 1 fits into DL part of mixed slot, if it exists */ + int tdaMi = -1; + if (tdaList->list.count > 1) { + const NR_PDSCH_TimeDomainResourceAllocation_t *tdaP_Mi = tdaList->list.array[1]; + AssertFatal(!tdaP_Mi->k0 || *tdaP_Mi->k0 == 0, + "TimeDomainAllocation at index 1: non-null k0 (%ld) is not supported by the scheduler\n", + *tdaP_Mi->k0); + int start, len; + SLIV2SL(tdaP_Mi->startSymbolAndLength, &start, &len); + const uint16_t symb_tda = ((1 << len) - 1) << start; + // check whether coreset and TDA overlap: then, we cannot use it. Also, + // check whether TDA is entirely within mixed slot DL. Note that + // here we assume that the coreset is scheduled every slot (which it + // currently is) + if ((symb_coreset & symb_tda) == 0 && (symb_dlMixed & symb_tda) == symb_tda) { + tdaMi = 1; + } else { + LOG_E(MAC, + "TDA index 1 DL overlaps with CORESET or is not entirely in mixed slot (symb_coreset %x symb_dlMixed %x symb_tda %x), won't schedule DL mixed slot\n", + symb_coreset, + symb_dlMixed, + symb_tda); + } + } + + const uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160}; + const int n = slots_per_frame[*scc->ssbSubcarrierSpacing]; + nrmac->preferred_dl_tda[bwp_id] = malloc(n * sizeof(*nrmac->preferred_dl_tda[bwp_id])); + + const int nr_mix_slots = tdd ? tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0 : 0; + const int nr_slots_period = tdd ? tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots : n; + for (int i = 0; i < n; ++i) { + nrmac->preferred_dl_tda[bwp_id][i] = -1; + if (!tdd || i % nr_slots_period < tdd->nrofDownlinkSlots) + nrmac->preferred_dl_tda[bwp_id][i] = 0; + else if (tdd && nr_mix_slots && i % nr_slots_period == tdd->nrofDownlinkSlots) + nrmac->preferred_dl_tda[bwp_id][i] = tdaMi; + LOG_I(MAC, "slot %d preferred_dl_tda %d\n", i, nrmac->preferred_dl_tda[bwp_id][i]); + } +} // Compute and write all MAC CEs and subheaders, and return number of written // bytes @@ -306,35 +379,6 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP, return offset; } -int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda) { - struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = - bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - AssertFatal(tda < tdaList->list.count, - "time_domain_allocation %d>=%d\n", - tda, - tdaList->list.count); - - const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; - int startSymbolIndex, nrOfSymbols; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - return nrOfSymbols; -} - -nfapi_nr_dmrs_type_e getDmrsConfigType(NR_BWP_Downlink_t *bwp) { - return bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; -} - -uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData) { - const nfapi_nr_dmrs_type_e dmrsConfigType = getDmrsConfigType(bwp); - if (dmrsConfigType == NFAPI_NR_DMRS_TYPE1) { - // if no data in dmrs cdm group is 1 only even REs have no data - // if no data in dmrs cdm group is 2 both odd and even REs have no data - return numDmrsCdmGrpsNoData * 6; - } else { - return numDmrsCdmGrpsNoData * 4; - } -} - void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, sub_frame_t slot) { @@ -369,61 +413,127 @@ void nr_store_dlsch_buffer(module_id_t module_id, } } -bool allocate_retransmission(module_id_t module_id, - uint8_t *rballoc_mask, - int *n_rb_sched, - int UE_id, - int current_harq_pid){ - NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[module_id]->UE_info.UE_sched_ctrl[UE_id]; - NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid]; +bool allocate_dl_retransmission(module_id_t module_id, + frame_t frame, + sub_frame_t slot, + uint8_t *rballoc_mask, + int *n_rb_sched, + int UE_id, + int current_harq_pid) +{ + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon; + NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_sched_pdsch_t *retInfo = &sched_ctrl->harq_processes[current_harq_pid].sched_pdsch; const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const uint8_t num_dmrs_cdm_grps_no_data = 1; - sched_ctrl->time_domain_allocation = retInfo->time_domain_allocation; - - /* ensure that there is a free place for RB allocation */ int rbSize = 0; - while (rbSize < retInfo->rbSize) { - rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ - rbSize = 0; - while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; - if (rbStart >= bwpSize) { - LOG_D(MAC, - "cannot allocate retransmission for UE %d/RNTI %04x: no resources\n", - UE_id, - RC.nrmac[module_id]->UE_info.rnti[UE_id]); - return false; + const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot]; + if (tda == retInfo->time_domain_allocation) { + /* Check that there are enough resources for retransmission */ + while (rbSize < retInfo->rbSize) { + rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ + rbSize = 0; + while (rbStart < bwpSize && !rballoc_mask[rbStart]) + rbStart++; + if (rbStart >= bwpSize) { + LOG_D(MAC, "cannot allocate retransmission for UE %d/RNTI %04x: no resources\n", UE_id, UE_info->rnti[UE_id]); + return false; + } + while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize] && rbSize < retInfo->rbSize) + rbSize++; } - while (rbStart + rbSize < bwpSize - && rballoc_mask[rbStart + rbSize] - && rbSize < retInfo->rbSize) + /* check whether we need to switch the TDA allocation since the last + * (re-)transmission */ + NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; + if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data) + nr_set_pdsch_semi_static( + scc, UE_info->secondaryCellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps); + } else { + /* the retransmission will use a different time domain allocation, check + * that we have enough resources */ + while (rbStart < bwpSize && !rballoc_mask[rbStart]) + rbStart++; + while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize]) rbSize++; + NR_pdsch_semi_static_t temp_ps; + nr_set_pdsch_semi_static( + scc, UE_info->secondaryCellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, &temp_ps); + uint32_t new_tbs; + uint16_t new_rbSize; + bool success = nr_find_nb_rb(retInfo->Qm, + retInfo->R, + temp_ps.nrOfSymbols, + temp_ps.N_PRB_DMRS * temp_ps.N_DMRS_SLOT, + retInfo->tb_size, + rbSize, + &new_tbs, + &new_rbSize); + if (!success || new_tbs != retInfo->tb_size) { + LOG_D(MAC, "%s(): new TBsize %d of new TDA does not match old TBS %d\n", __func__, new_tbs, retInfo->tb_size); + return false; /* the maximum TBsize we might have is smaller than what we need */ + } + /* we can allocate it. Overwrite the time_domain_allocation, the number + * of RBs, and the new TB size. The rest is done below */ + retInfo->tb_size = new_tbs; + retInfo->rbSize = new_rbSize; + retInfo->time_domain_allocation = tda; + sched_ctrl->pdsch_semi_static = temp_ps; } - sched_ctrl->rbSize = retInfo->rbSize; - sched_ctrl->rbStart = rbStart; - /* MCS etc: just reuse from previous scheduling opportunity */ - sched_ctrl->mcsTableIdx = retInfo->mcsTableIdx; - sched_ctrl->mcs = retInfo->mcs; - sched_ctrl->numDmrsCdmGrpsNoData = retInfo->numDmrsCdmGrpsNoData; + /* Find a free CCE */ + bool freeCCE = find_free_CCE(module_id, slot, UE_id); + if (!freeCCE) { + LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission UE %d/RNTI %04x\n", + frame, slot, UE_id, UE_info->rnti[UE_id]); + return false; + } + + /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH + * allocation after CCE alloc fail would be more complex) */ + const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot); + if (alloc<0) { + LOG_D(MAC, + "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", + __func__, + UE_id, + UE_info->rnti[UE_id], + frame, + slot); + int cid = sched_ctrl->coreset->controlResourceSetId; + UE_info->num_pdcch_cand[UE_id][cid]--; + int *cce_list = RC.nrmac[module_id]->cce_list[sched_ctrl->active_bwp->bwp_Id][cid]; + for (int i = 0; i < sched_ctrl->aggregation_level; i++) + cce_list[sched_ctrl->cce_index + i] = 0; + return false; + } + + sched_ctrl->sched_pdsch.pucch_allocation = alloc; + + /* just reuse from previous scheduling opportunity, set new start RB */ + sched_ctrl->sched_pdsch = *retInfo; + sched_ctrl->sched_pdsch.rbStart = rbStart; /* retransmissions: directly allocate */ - *n_rb_sched -= sched_ctrl->rbSize; - for (int rb = 0; rb < sched_ctrl->rbSize; rb++) - rballoc_mask[rb+sched_ctrl->rbStart] = 0; + *n_rb_sched -= sched_ctrl->sched_pdsch.rbSize; + for (int rb = 0; rb < sched_ctrl->sched_pdsch.rbSize; rb++) + rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] = 0; return true; } float thr_ue[MAX_MOBILES_PER_GNB]; +uint32_t pf_tbs[3][28]; // pre-computed, approximate TBS values for PF coefficient void pf_dl(module_id_t module_id, frame_t frame, sub_frame_t slot, NR_list_t *UE_list, + int max_num_ue, int n_rb_sched, - uint8_t *rballoc_mask, - int max_num_ue) { - + uint8_t *rballoc_mask) { + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled @@ -433,11 +543,10 @@ void pf_dl(module_id_t module_id, /* Loop UE_info->list to check retransmission */ for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, NR_SearchSpace__searchSpaceType_PR_ue_Specific); - sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); + NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; + NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; /* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */ - sched_ctrl->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; - const rnti_t rnti = UE_info->rnti[UE_id]; + sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; /* Calculate Throughput */ const float a = 0.0005f; // corresponds to 200ms window @@ -445,33 +554,10 @@ void pf_dl(module_id_t module_id, thr_ue[UE_id] = (1 - a) * thr_ue[UE_id] + a * b; /* retransmission */ - if (sched_ctrl->dl_harq_pid >= 0) { - /* Find a free CCE */ - bool freeCCE = find_free_CCE(module_id, slot, UE_id); - if (!freeCCE){ - LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); - continue; - } - /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH - * allocation after CCE alloc fail would be more complex) */ - const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot); - if (!alloc) { - LOG_W(MAC, - "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", - __func__, - UE_id, - rnti, - frame, - slot); - int cid = sched_ctrl->coreset->controlResourceSetId; - UE_info->num_pdcch_cand[UE_id][cid]--; - int *cce_list = RC.nrmac[module_id]->cce_list[sched_ctrl->active_bwp->bwp_Id][cid]; - for (int i = 0; i < sched_ctrl->aggregation_level; i++) - cce_list[sched_ctrl->cce_index + i] = 0; - return; - } + if (sched_pdsch->dl_harq_pid >= 0) { /* Allocate retransmission */ - bool r = allocate_retransmission(module_id, rballoc_mask, &n_rb_sched, UE_id, sched_ctrl->dl_harq_pid); + bool r = allocate_dl_retransmission( + module_id, frame, slot, rballoc_mask, &n_rb_sched, UE_id, sched_pdsch->dl_harq_pid); if (!r) { LOG_D(MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot); continue; @@ -485,23 +571,8 @@ void pf_dl(module_id_t module_id, continue; /* Calculate coeff */ - sched_ctrl->time_domain_allocation = 2; - sched_ctrl->mcsTableIdx = 0; - sched_ctrl->mcs = 9; - sched_ctrl->numDmrsCdmGrpsNoData = 1; - uint8_t N_PRB_DMRS = - getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); - int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, - sched_ctrl->time_domain_allocation); - uint32_t tbs = nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), - nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), - 1, // rbSize - nrOfSymbols, - N_PRB_DMRS, // FIXME // This should be multiplied by the - // number of dmrs symbols - 0 /* N_PRB_oh, 0 for initialBWP */, 0 /* tb_scaling */, - 1 /* nrOfLayers */) - >> 3; + sched_pdsch->mcs = 9; + uint32_t tbs = pf_tbs[ps->mcsTableIdx][sched_pdsch->mcs]; coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id]; LOG_D(MAC,"b %d, thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n", b, UE_id, thr_ue[UE_id], tbs, UE_id, coeff_ue[UE_id]); @@ -547,9 +618,9 @@ void pf_dl(module_id_t module_id, /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH * allocation after CCE alloc fail would be more complex) */ - const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot); - if (!alloc) { - LOG_W(MAC, + const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot); + if (alloc<0) { + LOG_D(MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", __func__, UE_id, @@ -564,57 +635,48 @@ void pf_dl(module_id_t module_id, return; } - /* Allocate transmission */ - // Time-domain allocation - sched_ctrl->time_domain_allocation = 2; - - // modulation scheme - sched_ctrl->mcsTableIdx = 0; - sched_ctrl->mcs = 9; - sched_ctrl->numDmrsCdmGrpsNoData = 1; - // Freq-demain allocation while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; + uint16_t max_rbSize = 1; + while (rbStart + max_rbSize < bwpSize && rballoc_mask[rbStart + max_rbSize]) + max_rbSize++; - const uint8_t N_PRB_DMRS = - getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); - const int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, - sched_ctrl->time_domain_allocation); - const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon; - const uint8_t N_DMRS_SLOT = get_num_dmrs_symbols( - sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, - scc->dmrs_TypeA_Position, - nrOfSymbols); - - int rbSize = 0; + /* MCS has been set above */ + const uint8_t num_dmrs_cdm_grps_no_data = 1; + const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot]; + NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; + NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; + if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data) + nr_set_pdsch_semi_static( + scc, UE_info->secondaryCellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps); + sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); + sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx); + sched_pdsch->pucch_allocation = alloc; uint32_t TBS = 0; + uint16_t rbSize; const int oh = 2 + (sched_ctrl->num_total_bytes >= 256) + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); - do { - rbSize++; - TBS = nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), - nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), - rbSize, - nrOfSymbols, - N_PRB_DMRS * N_DMRS_SLOT, - 0 /* N_PRB_oh, 0 for initialBWP */, - 0 /* tb_scaling */, - 1 /* nrOfLayers */) - >> 3; - } while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize] && TBS < sched_ctrl->num_total_bytes + oh); - sched_ctrl->rbSize = rbSize; - sched_ctrl->rbStart = rbStart; + nr_find_nb_rb(sched_pdsch->Qm, + sched_pdsch->R, + ps->nrOfSymbols, + ps->N_PRB_DMRS * ps->N_DMRS_SLOT, + sched_ctrl->num_total_bytes + oh, + max_rbSize, + &TBS, + &rbSize); + sched_pdsch->rbSize = rbSize; + sched_pdsch->rbStart = rbStart; + sched_pdsch->tb_size = TBS; /* transmissions: directly allocate */ - n_rb_sched -= sched_ctrl->rbSize; - for (int rb = 0; rb < sched_ctrl->rbSize; rb++) - rballoc_mask[rb+sched_ctrl->rbStart] = 0; + n_rb_sched -= sched_pdsch->rbSize; + for (int rb = 0; rb < sched_pdsch->rbSize; rb++) + rballoc_mask[rb + sched_pdsch->rbStart] = 0; } } -void nr_simple_dlsch_preprocessor(module_id_t module_id, - frame_t frame, - sub_frame_t slot) { +void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) +{ NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; if (UE_info->num_UEs == 0) @@ -626,6 +688,11 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, /* Get bwpSize from the first UE */ int UE_id = UE_info->list.head; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + + const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot]; + if (tda < 0) + return; + const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; @@ -646,16 +713,46 @@ void nr_simple_dlsch_preprocessor(module_id_t module_id, frame, slot, &UE_info->list, + 2, n_rb_sched, - rballoc_mask, - 2); + rballoc_mask); +} + +nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(module_id_t module_id, int CC_id) +{ + /* in the PF algorithm, we have to use the TBsize to compute the coefficient. + * This would include the number of DMRS symbols, which in turn depends on + * the time domain allocation. In case we are in a mixed slot, we do not want + * to recalculate all these values just, and therefore we provide a look-up + * table which should approximately give us the TBsize */ + for (int mcsTableIdx = 0; mcsTableIdx < 3; ++mcsTableIdx) { + for (int mcs = 0; mcs < 29; ++mcs) { + if (mcs > 27 && mcsTableIdx == 1) + continue; + const uint8_t Qm = nr_get_Qm_dl(mcs, mcsTableIdx); + const uint16_t R = nr_get_code_rate_dl(mcs, mcsTableIdx); + pf_tbs[mcsTableIdx][mcs] = nr_compute_tbs(Qm, + R, + 1, /* rbSize */ + 10, /* hypothetical number of slots */ + 0, /* N_PRB_DMRS * N_DMRS_SLOT */ + 0 /* N_PRB_oh, 0 for initialBWP */, + 0 /* tb_scaling */, + 1 /* nrOfLayers */) + >> 3; + } + } + + return nr_fr1_dlsch_preprocessor; } void nr_schedule_ue_spec(module_id_t module_id, frame_t frame, sub_frame_t slot) { gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; - + if (!is_xlsch_in_slot(gNB_mac->dlsch_slot_bitmap[slot / 64], slot)) + return; + /* PREPROCESSOR */ gNB_mac->pre_processor_dl(module_id, frame, slot); @@ -668,6 +765,7 @@ void nr_schedule_ue_spec(module_id_t module_id, NR_list_t *UE_list = &UE_info->list; for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; UE_info->mac_stats[UE_id].dlsch_current_bytes = 0; /* update TA and set ta_apply every 10 frames. @@ -679,45 +777,23 @@ void nr_schedule_ue_spec(module_id_t module_id, LOG_D(MAC, "[UE %d][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE_id, frame, slot); } - if (sched_ctrl->rbSize <= 0) + if (sched_pdsch->rbSize <= 0) continue; const rnti_t rnti = UE_info->rnti[UE_id]; /* POST processing */ - struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = - sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; - AssertFatal(sched_ctrl->time_domain_allocation < tdaList->list.count, - "time_domain_allocation %d>=%d\n", - sched_ctrl->time_domain_allocation, - tdaList->list.count); - - const int startSymbolAndLength = - tdaList->list.array[sched_ctrl->time_domain_allocation]->startSymbolAndLength; - int startSymbolIndex, nrOfSymbols; - SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); - - uint8_t N_PRB_DMRS = - getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); - uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, - RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position , - nrOfSymbols); - const nfapi_nr_dmrs_type_e dmrsConfigType = getDmrsConfigType(sched_ctrl->active_bwp); const int nrOfLayers = 1; - const uint16_t R = nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx); - const uint8_t Qm = nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx); - const uint32_t TBS = - nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), - nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), - sched_ctrl->rbSize, - nrOfSymbols, - N_PRB_DMRS * N_DMRS_SLOT, - 0 /* N_PRB_oh, 0 for initialBWP */, - 0 /* tb_scaling */, - nrOfLayers) - >> 3; + const uint16_t R = sched_pdsch->R; + const uint8_t Qm = sched_pdsch->Qm; + const uint32_t TBS = sched_pdsch->tb_size; - int8_t current_harq_pid = sched_ctrl->dl_harq_pid; + /* pre-computed PDSCH values that only change if time domain + * allocation/DMRS parameters change. Updated in the preprocessor through + * nr_set_pdsch_semi_static() */ + NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; + + int8_t current_harq_pid = sched_pdsch->dl_harq_pid; if (current_harq_pid < 0) { /* PP has not selected a specific HARQ Process, get a new one */ if (NFAPI_MODE == NFAPI_MODE_VNF) @@ -727,7 +803,7 @@ void nr_schedule_ue_spec(module_id_t module_id, "no free HARQ process available for UE %d\n", UE_id); remove_front_nr_list(&sched_ctrl->available_dl_harq); - sched_ctrl->dl_harq_pid = current_harq_pid; + sched_pdsch->dl_harq_pid = current_harq_pid; } else { /* PP selected a specific HARQ process. Check whether it will be a new * transmission or a retransmission, and remove from the corresponding @@ -743,21 +819,22 @@ void nr_schedule_ue_spec(module_id_t module_id, } DevAssert(!harq->is_waiting); add_tail_nr_list(&sched_ctrl->feedback_dl_harq, current_harq_pid); - NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0]; + NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[sched_pdsch->pucch_allocation]; + harq->feedback_frame = pucch->frame; harq->feedback_slot = pucch->ul_slot; harq->is_waiting = true; UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++; LOG_D(MAC, - "%4d.%2d RNTI %04x start %d RBs %d startSymbol %d nb_symbsol %d MCS %d TBS %d HARQ PID %d round %d NDI %d\n", + "%4d.%2d RNTI %04x start %3d RBs %3d startSymbol %2d nb_symbol %2d MCS %2d TBS %4d HARQ PID %2d round %d NDI %d\n", frame, slot, rnti, - sched_ctrl->rbStart, - sched_ctrl->rbSize, - startSymbolIndex, - nrOfSymbols, - sched_ctrl->mcs, + sched_pdsch->rbStart, + sched_pdsch->rbSize, + ps->startSymbolIndex, + ps->nrOfSymbols, + sched_pdsch->mcs, TBS, current_harq_pid, harq->round, @@ -821,17 +898,18 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->NrOfCodewords = 1; pdsch_pdu->targetCodeRate[0] = R; pdsch_pdu->qamModOrder[0] = Qm; - pdsch_pdu->mcsIndex[0] = sched_ctrl->mcs; - pdsch_pdu->mcsTable[0] = sched_ctrl->mcsTableIdx; + pdsch_pdu->mcsIndex[0] = sched_pdsch->mcs; + pdsch_pdu->mcsTable[0] = ps->mcsTableIdx; + AssertFatal(harq->round<4,"%d",harq->round); pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round]; - if (NFAPI_MODE == NFAPI_MODE_VNF){ // done since uplink isnt operational yet which means harq structures dont get filled properly - pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq_rounds]; - if (harq_rounds % 5 == 0 && harq_rounds!=0){ - harq_rounds = 0; - harq_pid = (harq_pid + 1) % 16; - } - harq_rounds++; - } + // if (NFAPI_MODE == NFAPI_MODE_VNF){ // done since uplink isnt operational yet which means harq structures dont get filled properly + // pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq_rounds]; + // if (harq_rounds % 5 == 0 && harq_rounds!=0){ + // harq_rounds = 0; + // harq_pid = (harq_pid + 1) % 16; + // } + // harq_rounds++; + // } pdsch_pdu->TBSize[0] = TBS; pdsch_pdu->dataScramblingId = *scc->physCellId; @@ -840,25 +918,22 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->refPoint = 0; // Point A // DMRS - pdsch_pdu->dlDmrsSymbPos = - fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, - scc->dmrs_TypeA_Position, - nrOfSymbols); - pdsch_pdu->dmrsConfigType = dmrsConfigType; + pdsch_pdu->dlDmrsSymbPos = ps->dl_dmrs_symb_pos; + pdsch_pdu->dmrsConfigType = ps->dmrsConfigType; pdsch_pdu->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu->SCID = 0; - pdsch_pdu->numDmrsCdmGrpsNoData = sched_ctrl->numDmrsCdmGrpsNoData; + pdsch_pdu->numDmrsCdmGrpsNoData = ps->numDmrsCdmGrpsNoData; pdsch_pdu->dmrsPorts = 1; // Pdsch Allocation in frequency domain pdsch_pdu->resourceAlloc = 1; - pdsch_pdu->rbStart = sched_ctrl->rbStart; - pdsch_pdu->rbSize = sched_ctrl->rbSize; + pdsch_pdu->rbStart = sched_pdsch->rbStart; + pdsch_pdu->rbSize = sched_pdsch->rbSize; pdsch_pdu->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP // Resource Allocation in time domain - pdsch_pdu->StartSymbolIndex = startSymbolIndex; - pdsch_pdu->NrOfSymbols = nrOfSymbols; + pdsch_pdu->StartSymbolIndex = ps->startSymbolIndex; + pdsch_pdu->NrOfSymbols = ps->nrOfSymbols; /* Check and validate PTRS values */ struct NR_SetupRelease_PTRS_DownlinkConfig *phaseTrackingRS = @@ -912,8 +987,8 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->rbSize, pdsch_pdu->rbStart, pdsch_pdu->BWPSize); - dci_payload.time_domain_assignment.val = sched_ctrl->time_domain_allocation; - dci_payload.mcs = sched_ctrl->mcs; + dci_payload.time_domain_assignment.val = ps->time_domain_allocation; + dci_payload.mcs = sched_pdsch->mcs; dci_payload.rv = pdsch_pdu->rvIndex[0]; dci_payload.harq_pid = current_harq_pid; dci_payload.ndi = harq->ndi; @@ -943,10 +1018,10 @@ void nr_schedule_ue_spec(module_id_t module_id, const int dci_format = f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0; const int rnti_type = NR_RNTI_C; - if (NFAPI_MODE == NFAPI_MODE_VNF){ - dci_payload.harq_pid = harq_pid; - dci_payload.tpc = 2; - } + // if (NFAPI_MODE == NFAPI_MODE_VNF){ + // dci_payload.harq_pid = harq_pid; + // dci_payload.tpc = 2; + // } fill_dci_pdu_rel15(scc, UE_info->secondaryCellGroup[UE_id], dci_pdu, @@ -962,29 +1037,7 @@ void nr_schedule_ue_spec(module_id_t module_id, pdcch_pdu->StartSymbolIndex, pdcch_pdu->DurationSymbols); - NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid]; if (harq->round != 0) { /* retransmission */ - if (sched_ctrl->rbSize != retInfo->rbSize) - LOG_W(MAC, - "retransmission uses different rbSize (%d vs. orig %d)\n", - sched_ctrl->rbSize, - retInfo->rbSize); - if (sched_ctrl->time_domain_allocation != retInfo->time_domain_allocation) - LOG_W(MAC, - "retransmission uses different time_domain_allocation (%d vs. orig %d)\n", - sched_ctrl->time_domain_allocation, - retInfo->time_domain_allocation); - if (sched_ctrl->mcs != retInfo->mcs - || sched_ctrl->mcsTableIdx != retInfo->mcsTableIdx - || sched_ctrl->numDmrsCdmGrpsNoData != retInfo->numDmrsCdmGrpsNoData) - LOG_W(MAC, - "retransmission uses different table/MCS/numDmrsCdmGrpsNoData (%d/%d/%d vs. orig %d/%d/%d)\n", - sched_ctrl->mcsTableIdx, - sched_ctrl->mcs, - sched_ctrl->numDmrsCdmGrpsNoData, - retInfo->mcsTableIdx, - retInfo->mcs, - retInfo->numDmrsCdmGrpsNoData); /* we do not have to do anything, since we do not require to get data * from RLC or encode MAC CEs. The TX_req structure is filled below * or copy data to FAPI structures */ @@ -997,7 +1050,7 @@ void nr_schedule_ue_spec(module_id_t module_id, current_harq_pid, harq->round, harq->ndi); - AssertFatal(harq->tb_size == TBS, + AssertFatal(harq->sched_pdsch.tb_size == TBS, "UE %d mismatch between scheduled TBS and buffered TB for HARQ PID %d\n", UE_id, current_harq_pid); @@ -1005,7 +1058,6 @@ void nr_schedule_ue_spec(module_id_t module_id, LOG_D(MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot); - harq->tb_size = TBS; uint8_t *buf = (uint8_t *) harq->tb; /* first, write all CEs that might be there */ @@ -1113,11 +1165,11 @@ void nr_schedule_ue_spec(module_id_t module_id, UE_info->mac_stats[UE_id].dlsch_current_bytes = TBS; UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes; - retInfo->rbSize = sched_ctrl->rbSize; - retInfo->time_domain_allocation = sched_ctrl->time_domain_allocation; - retInfo->mcsTableIdx = sched_ctrl->mcsTableIdx; - retInfo->mcs = sched_ctrl->mcs; - retInfo->numDmrsCdmGrpsNoData = sched_ctrl->numDmrsCdmGrpsNoData; + /* save retransmission information */ + harq->sched_pdsch = *sched_pdsch; + /* save which time allocation has been used, to be used on + * retransmissions */ + harq->sched_pdsch.time_domain_allocation = ps->time_domain_allocation; // ta command is sent, values are reset if (sched_ctrl->ta_apply) { @@ -1146,6 +1198,6 @@ void nr_schedule_ue_spec(module_id_t module_id, gNB_mac->TX_req[CC_id].Slot = slot; /* mark UE as scheduled */ - sched_ctrl->rbSize = 0; + memset(sched_pdsch, 0, sizeof(*sched_pdsch)); } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 6487f391b9..adfcd79b8e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -146,15 +146,18 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, int startSymbolAndLength=0; int StartSymbolIndex=-1,NrOfSymbols=14; int StartSymbolIndex_tmp,NrOfSymbols_tmp; + int mappingtype_tmp, mappingtype; for (int i=0; idownlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count; i++) { startSymbolAndLength = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength; SLIV2SL(startSymbolAndLength,&StartSymbolIndex_tmp,&NrOfSymbols_tmp); + mappingtype_tmp = scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType; if (NrOfSymbols_tmp < NrOfSymbols) { NrOfSymbols = NrOfSymbols_tmp; StartSymbolIndex = StartSymbolIndex_tmp; + mappingtype = mappingtype_tmp; // k0 = *scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0; // time_domain_assignment = i; } @@ -164,7 +167,9 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, scc->dmrs_TypeA_Position, - NrOfSymbols); + NrOfSymbols, + StartSymbolIndex, + mappingtype); /* AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n"); @@ -254,16 +259,22 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, } } +extern int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda); +extern uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData); +uint32_t target_dl_mcs = 9; +uint32_t target_dl_bw = 50; +uint64_t dlsch_slot_bitmap = (1<<1); /* schedules whole bandwidth for first user, all the time */ void nr_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot) { - if (slot != 1) + if (!is_xlsch_in_slot(dlsch_slot_bitmap, slot)) return; + const int CC_id = 0; + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; const int UE_id = 0; - const int CC_id = 0; AssertFatal(UE_info->active[UE_id], "%s(): expected UE %d to be active\n", __func__, @@ -272,24 +283,25 @@ void nr_preprocessor_phytest(module_id_t module_id, /* find largest unallocated chunk */ const int bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); int rbStart = 0; - int tStart = 0; int rbSize = 0; uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map; - /* find largest unallocated RB region */ - do { + /* loop ensures that we allocate exactly target_dl_bw, or return */ + while (true) { /* advance to first free RB */ - while (tStart < bwpSize && vrb_map[tStart]) - tStart++; - /* find maximum rbSize at current rbStart */ - int tSize = 1; - while (tStart + tSize < bwpSize && !vrb_map[tStart + tSize]) - tSize++; - if (tSize > rbSize) { - rbStart = tStart; - rbSize = tSize; - } - tStart += tSize; - } while (tStart < bwpSize); + while (rbStart < bwpSize && vrb_map[rbStart]) + rbStart++; + rbSize = 1; + /* iterate until we are at target_dl_bw or no available RBs */ + while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && rbSize < target_dl_bw) + rbSize++; + /* found target_dl_bw? */ + if (rbSize == target_dl_bw) + break; + /* at end and below target_dl_bw? */ + if (rbStart + rbSize >= bwpSize) + return; + rbStart += rbSize; + } sched_ctrl->num_total_bytes = 0; const int lcid = DL_SCH_LCID_DTCH; @@ -308,14 +320,10 @@ void nr_preprocessor_phytest(module_id_t module_id, 0); sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; - const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss); uint8_t nr_of_candidates; find_aggregation_candidates(&sched_ctrl->aggregation_level, &nr_of_candidates, sched_ctrl->search_space); - sched_ctrl->coreset = get_coreset( - sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); const int cid = sched_ctrl->coreset->controlResourceSetId; const uint16_t Y = UE_info->Y[UE_id][cid][slot]; const int m = UE_info->num_pdcch_cand[UE_id][cid]; @@ -331,8 +339,8 @@ void nr_preprocessor_phytest(module_id_t module_id, __func__, UE_id); - const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot); - if (!alloc) { + const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot); + if (alloc < 0) { LOG_D(MAC, "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n", __func__, @@ -347,36 +355,47 @@ void nr_preprocessor_phytest(module_id_t module_id, return; } - AssertFatal(alloc, - "could not find uplink slot for PUCCH (RNTI %04x@%d.%d)!\n", - rnti, frame, slot); + //AssertFatal(alloc, + // "could not find uplink slot for PUCCH (RNTI %04x@%d.%d)!\n", + // rnti, frame, slot); + + NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; + NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; + sched_pdsch->pucch_allocation = alloc; + sched_pdsch->rbStart = rbStart; + sched_pdsch->rbSize = rbSize; + const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot]; + const uint8_t num_dmrs_cdm_grps_no_data = 1; + if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data) + nr_set_pdsch_semi_static( + scc, UE_info->secondaryCellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps); + + sched_pdsch->mcs = target_dl_mcs; + sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); + sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx); + sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm, + sched_pdsch->R, + sched_pdsch->rbSize, + ps->nrOfSymbols, + ps->N_PRB_DMRS * ps->N_DMRS_SLOT, + 0 /* N_PRB_oh, 0 for initialBWP */, + 0 /* tb_scaling */, + 1 /* nrOfLayers */) + >> 3; - sched_ctrl->rbStart = rbStart; - sched_ctrl->rbSize = rbSize; - sched_ctrl->time_domain_allocation = 2; - if (!UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table) - sched_ctrl->mcsTableIdx = 0; - else { - if (*UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table == 0) - sched_ctrl->mcsTableIdx = 1; - else - sched_ctrl->mcsTableIdx = 2; - } - sched_ctrl->mcs = 9; - sched_ctrl->numDmrsCdmGrpsNoData = 1; /* get the PID of a HARQ process awaiting retransmission, or -1 otherwise */ - sched_ctrl->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; + sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; /* mark the corresponding RBs as used */ - for (int rb = 0; rb < sched_ctrl->rbSize; rb++) - vrb_map[rb + sched_ctrl->rbStart] = 1; + for (int rb = 0; rb < sched_pdsch->rbSize; rb++) + vrb_map[rb + sched_pdsch->rbStart] = 1; } -bool nr_ul_preprocessor_phytest(module_id_t module_id, - frame_t frame, - sub_frame_t slot, - int num_slots_per_tdd, - uint64_t ulsch_in_slot_bitmap) { +uint32_t target_ul_mcs = 9; +uint32_t target_ul_bw = 50; +uint64_t ulsch_slot_bitmap = (1 << 8); +bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot) +{ gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; NR_COMMON_channels_t *cc = nr_mac->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; @@ -395,7 +414,9 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - const int tda = 1; + const int tda = RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot]; + if (tda < 0) + return false; const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; AssertFatal(tda < tdaList->list.count, @@ -408,19 +429,29 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, /* check if slot is UL, and that slot is 8 (assuming K2=6 because of UE * limitations). Note that if K2 or the TDD configuration is changed, below * conditions might exclude each other and never be true */ - if (!(is_xlsch_in_slot(ulsch_in_slot_bitmap, sched_slot) && sched_slot == 8)) + if (!is_xlsch_in_slot(ulsch_slot_bitmap, sched_slot)) return false; - const int bw = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; + const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; + const uint8_t num_dmrs_cdm_grps_no_data = 1; + /* we want to avoid a lengthy deduction of DMRS and other parameters in + * every TTI if we can save it, so check whether dci_format, TDA, or + * num_dmrs_cdm_grps_no_data has changed and only then recompute */ + NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; + if (ps->time_domain_allocation != tda + || ps->dci_format != dci_format + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) + nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + uint16_t rbStart = 0; - uint16_t rbSize = 50; /* due to OAI UE limitations */ - if (rbSize>bw) - rbSize = bw; + uint16_t rbSize = target_ul_bw; uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; + const uint16_t symb = ((1 << ps->nrOfSymbols) - 1) << ps->startSymbolIndex; for (int i = rbStart; i < rbStart + rbSize; ++i) { - if (vrb_map_UL[i]) { + if ((vrb_map_UL[i] & symb) != 0) { LOG_E(MAC, "%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n", __func__, @@ -434,14 +465,10 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.frame = sched_frame; - const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; - sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss); uint8_t nr_of_candidates; find_aggregation_candidates(&sched_ctrl->aggregation_level, &nr_of_candidates, sched_ctrl->search_space); - sched_ctrl->coreset = get_coreset( - sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); const int cid = sched_ctrl->coreset->controlResourceSetId; const uint16_t Y = UE_info->Y[UE_id][cid][slot]; const int m = UE_info->num_pdcch_cand[UE_id][cid]; @@ -458,25 +485,7 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, } UE_info->num_pdcch_cand[UE_id][cid]++; - sched_ctrl->sched_pusch.time_domain_allocation = tda; - const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; - const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; - const uint8_t num_dmrs_cdm_grps_no_data = 1; - /* we want to avoid a lengthy deduction of DMRS and other parameters in - * every TTI if we can save it, so check whether dci_format, TDA, or - * num_dmrs_cdm_grps_no_data has changed and only then recompute */ - NR_sched_pusch_save_t *ps = &sched_ctrl->pusch_save; - if (ps->time_domain_allocation != tda - || ps->dci_format != dci_format - || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_save_pusch_fields(scc, - sched_ctrl->active_ubwp, - dci_format, - tda, - num_dmrs_cdm_grps_no_data, - ps); - - const int mcs = 9; + const int mcs = target_ul_mcs; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; sched_pusch->mcs = mcs; sched_pusch->rbStart = rbStart; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 37cafff9cc..9a50297dd1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -121,11 +121,10 @@ static inline uint8_t get_max_candidates(uint8_t scs) { static inline uint8_t get_max_cces(uint8_t scs) { AssertFatal(scs<4, "Invalid PDCCH subcarrier spacing %d\n", scs); return (nr_max_number_of_cces_per_slot[scs]); -} +} -NR_ControlResourceSet_t *get_coreset(NR_BWP_Downlink_t *bwp, - NR_SearchSpace_t *ss, - int ss_type) { +NR_ControlResourceSet_t *get_coreset(const NR_BWP_Downlink_t *bwp, const NR_SearchSpace_t *ss, int ss_type) +{ NR_ControlResourceSetId_t coreset_id = *ss->controlResourceSetId; if (ss_type == 0) { // common search space AssertFatal(coreset_id != 0, "coreset0 currently not supported\n"); @@ -147,9 +146,8 @@ NR_ControlResourceSet_t *get_coreset(NR_BWP_Downlink_t *bwp, } } -NR_SearchSpace_t *get_searchspace( - NR_BWP_Downlink_t *bwp, - NR_SearchSpace__searchSpaceType_PR target_ss) { +NR_SearchSpace_t *get_searchspace(const NR_BWP_Downlink_t *bwp, NR_SearchSpace__searchSpaceType_PR target_ss) +{ DevAssert(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList); DevAssert(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count > 0); @@ -179,7 +177,7 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, int coreset_id = coreset->controlResourceSetId; int *cce_list; - if(bwp->bwp_Id == 0) { + if( bwp==NULL || bwp->bwp_Id == 0 ) { cce_list = nr_mac->cce_list[1][0]; } else { cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id]; @@ -213,12 +211,99 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, } -void nr_save_pusch_fields(const NR_ServingCellConfigCommon_t *scc, - const NR_BWP_Uplink_t *ubwp, - long dci_format, - int tda, - uint8_t num_dmrs_cdm_grps_no_data, - NR_sched_pusch_save_t *ps) +bool nr_find_nb_rb(uint16_t Qm, + uint16_t R, + uint16_t nb_symb_sch, + uint16_t nb_dmrs_prb, + uint32_t bytes, + uint16_t nb_rb_max, + uint32_t *tbs, + uint16_t *nb_rb) +{ + /* is the maximum (not even) enough? */ + *nb_rb = nb_rb_max; + *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; + /* check whether it does not fit, or whether it exactly fits. Some algorithms + * might depend on the return value! */ + if (bytes > *tbs) + return false; + if (bytes == *tbs) + return true; + + /* is the minimum enough? */ + *nb_rb = 1; + *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; + if (bytes <= *tbs) + return true; + + /* perform binary search to allocate all bytes within a TBS up to nb_rb_max + * RBs */ + int hi = nb_rb_max; + int lo = 1; + for (int p = (hi + lo) / 2; lo + 1 < hi; p = (hi + lo) / 2) { + const uint32_t TBS = nr_compute_tbs(Qm, R, p, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; + if (bytes == TBS) { + hi = p; + break; + } else if (bytes < TBS) { + hi = p; + } else { + lo = p; + } + } + *nb_rb = hi; + *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; + /* return whether we could allocate all bytes and stay below nb_rb_max */ + return *tbs >= bytes && *nb_rb <= nb_rb_max; +} + +void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, + const NR_CellGroupConfig_t *secondaryCellGroup, + const NR_BWP_Downlink_t *bwp, + int tda, + uint8_t num_dmrs_cdm_grps_no_data, + NR_pdsch_semi_static_t *ps) +{ + ps->time_domain_allocation = tda; + + const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = + bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; + AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count); + const int mapping_type = tdaList->list.array[tda]->mappingType; + const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; + SLIV2SL(startSymbolAndLength, &ps->startSymbolIndex, &ps->nrOfSymbols); + + if (!secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup + ->mcs_Table) + ps->mcsTableIdx = 0; + else if (*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup + ->mcs_Table + == 0) + ps->mcsTableIdx = 1; + else + ps->mcsTableIdx = 2; + + ps->numDmrsCdmGrpsNoData = num_dmrs_cdm_grps_no_data; + ps->dmrsConfigType = + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type + == NULL + ? 0 + : 1; + // if no data in dmrs cdm group is 1 only even REs have no data + // if no data in dmrs cdm group is 2 both odd and even REs have no data + ps->N_PRB_DMRS = num_dmrs_cdm_grps_no_data * (ps->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6 : 4); + ps->N_DMRS_SLOT = + get_num_dmrs_symbols(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex, mapping_type); + ps->dl_dmrs_symb_pos = + fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, ps->nrOfSymbols, ps->startSymbolIndex, mapping_type); +} + +void nr_set_pusch_semi_static(const NR_ServingCellConfigCommon_t *scc, + const NR_BWP_Uplink_t *ubwp, + long dci_format, + int tda, + uint8_t num_dmrs_cdm_grps_no_data, + NR_pusch_semi_static_t *ps) { ps->dci_format = dci_format; ps->time_domain_allocation = tda; @@ -271,11 +356,12 @@ void nr_save_pusch_fields(const NR_ServingCellConfigCommon_t *scc, : *ps->NR_DMRS_UplinkConfig->dmrs_AdditionalPosition); const pusch_maxLength_t pusch_maxLength = ps->NR_DMRS_UplinkConfig->maxLength == NULL ? 1 : 2; - const uint16_t l_prime_mask = get_l_prime(ps->nrOfSymbols, + ps->ul_dmrs_symb_pos = get_l_prime(ps->nrOfSymbols, ps->mapping_type, additional_pos, - pusch_maxLength); - ps->ul_dmrs_symb_pos = l_prime_mask << ps->startSymbolIndex; + pusch_maxLength, + ps->startSymbolIndex, + scc->dmrs_TypeA_Position); uint8_t num_dmrs_symb = 0; for(int i = ps->startSymbolIndex; i < ps->startSymbolIndex + ps->nrOfSymbols; i++) num_dmrs_symb += (ps->ul_dmrs_symb_pos >> i) & 1; @@ -564,6 +650,8 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, NR_ServingCellConfigCommon_t *scc, NR_BWP_Downlink_t *bwp) { + int sps = 0; + if (bwp) { // This is not the InitialBWP pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); @@ -572,8 +660,18 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, // first symbol //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); - int sps = bwp->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + sps = bwp->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12; + } + else { // this is for InitialBWP + pdcch_pdu->BWPSize = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + pdcch_pdu->SubcarrierSpacing = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing; + pdcch_pdu->CyclicPrefix = (scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix==NULL) ? 0 : *scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix; + // first symbol + //AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored"); + sps = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12; + } AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n"); AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n"); @@ -618,10 +716,6 @@ void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, //precoderGranularity pdcch_pdu->precoderGranularity = coreset->precoderGranularity; - } - else { // this is for InitialBWP - AssertFatal(1==0,"Fill in InitialBWP PDCCH configuration\n"); - } } @@ -1135,6 +1229,7 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, break; case NR_RNTI_TC: + pos = 1; // indicating a DL DCI format 1bit *dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos++); // Freq domain assignment 0-16 bit @@ -1163,9 +1258,27 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // TPC command for scheduled PUCCH – 2 bits for (int i = 0; i < 2; i++) *dci_pdu |= (((uint64_t)dci_pdu_rel15->tpc >> (1 - i)) & 1) << (dci_size - pos++); + // PUCCH resource indicator – 3 bits + for (int i = 0; i < 3; i++) + *dci_pdu |= (((uint64_t)dci_pdu_rel15->pucch_resource_indicator >> (2 - i)) & 1) << (dci_size - pos++); // PDSCH-to-HARQ_feedback timing indicator – 3 bits for (int i = 0; i < 3; i++) *dci_pdu |= (((uint64_t)dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val >> (2 - i)) & 1) << (dci_size - pos++); + + LOG_D(NR_MAC,"N_RB = %i\n", N_RB); + LOG_D(NR_MAC,"dci_size = %i\n", dci_size); + LOG_D(NR_MAC,"fsize = %i\n", fsize); + LOG_D(NR_MAC,"dci_pdu_rel15->format_indicator = %i\n", dci_pdu_rel15->format_indicator); + LOG_D(NR_MAC,"dci_pdu_rel15->frequency_domain_assignment.val = %i\n", dci_pdu_rel15->frequency_domain_assignment.val); + LOG_D(NR_MAC,"dci_pdu_rel15->time_domain_assignment.val = %i\n", dci_pdu_rel15->time_domain_assignment.val); + LOG_D(NR_MAC,"dci_pdu_rel15->vrb_to_prb_mapping.val = %i\n", dci_pdu_rel15->vrb_to_prb_mapping.val); + LOG_D(NR_MAC,"dci_pdu_rel15->mcs = %i\n", dci_pdu_rel15->mcs); + LOG_D(NR_MAC,"dci_pdu_rel15->rv = %i\n", dci_pdu_rel15->rv); + LOG_D(NR_MAC,"dci_pdu_rel15->harq_pid = %i\n", dci_pdu_rel15->harq_pid); + LOG_D(NR_MAC,"dci_pdu_rel15->dai[0].val = %i\n", dci_pdu_rel15->dai[0].val); + LOG_D(NR_MAC,"dci_pdu_rel15->tpc = %i\n", dci_pdu_rel15->tpc); + LOG_D(NR_MAC,"dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val = %i\n", dci_pdu_rel15->pdsch_to_harq_feedback_timing_indicator.val); + break; } break; @@ -1623,6 +1736,24 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces } } +int get_dl_bwp_id(const NR_ServingCellConfig_t *servingCellConfig) +{ + if (servingCellConfig->firstActiveDownlinkBWP_Id) + return *servingCellConfig->firstActiveDownlinkBWP_Id; + else if (servingCellConfig->defaultDownlinkBWP_Id) + return *servingCellConfig->defaultDownlinkBWP_Id; + else + return 1; +} + +int get_ul_bwp_id(const NR_ServingCellConfig_t *servingCellConfig) +{ + if (servingCellConfig->uplinkConfig && servingCellConfig->uplinkConfig->firstActiveUplinkBWP_Id) + return *servingCellConfig->uplinkConfig->firstActiveUplinkBWP_Id; + else + return 1; +} + //------------------------------------------------------------------------------ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secondaryCellGroup) { @@ -1651,23 +1782,32 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon sched_ctrl->ta_frame = 0; sched_ctrl->ta_update = 31; sched_ctrl->ta_apply = false; - sched_ctrl->ul_rssi = 0; /* set illegal time domain allocation to force recomputation of all fields */ - sched_ctrl->pusch_save.time_domain_allocation = -1; + sched_ctrl->pdsch_semi_static.time_domain_allocation = -1; + sched_ctrl->pusch_semi_static.time_domain_allocation = -1; const NR_ServingCellConfig_t *servingCellConfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated; /* Set default BWPs */ const struct NR_ServingCellConfig__downlinkBWP_ToAddModList *bwpList = servingCellConfig->downlinkBWP_ToAddModList; - AssertFatal(bwpList->list.count == 1, - "downlinkBWP_ToAddModList has %d BWP!\n", + const int bwp_id = get_dl_bwp_id(servingCellConfig); + AssertFatal(bwp_id > 0 && bwp_id <= bwpList->list.count, + "%s(): illegal bwp_id %d (max %d)!\n", + __func__, + bwp_id, bwpList->list.count); - const int bwp_id = 1; sched_ctrl->active_bwp = bwpList->list.array[bwp_id - 1]; + const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; + sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, target_ss); + sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); + const struct NR_UplinkConfig__uplinkBWP_ToAddModList *ubwpList = servingCellConfig->uplinkConfig->uplinkBWP_ToAddModList; - AssertFatal(ubwpList->list.count == 1, - "uplinkBWP_ToAddModList has %d BWP!\n", + const int ubwp_id = get_ul_bwp_id(servingCellConfig); + AssertFatal(ubwp_id > 0 && ubwp_id <= ubwpList->list.count, + "%s(): illegal ubwp_id %d (max %d)!\n", + __func__, + ubwp_id, ubwpList->list.count); - sched_ctrl->active_ubwp = ubwpList->list.array[bwp_id - 1]; + sched_ctrl->active_ubwp = ubwpList->list.array[ubwp_id - 1]; /* get Number of HARQ processes for this UE */ AssertFatal(servingCellConfig->pdsch_ServingCellConfig->present == NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup, @@ -1690,7 +1830,7 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); create_nr_list(&sched_ctrl->feedback_ul_harq, 16); create_nr_list(&sched_ctrl->retrans_ul_harq, 16); - LOG_I(MAC, "gNB %d] Add NR UE_id %d : rnti %x\n", + LOG_I(MAC, "[gNB %d] Add NR UE_id %d : rnti %x\n", mod_idP, UE_id, rntiP); @@ -1713,6 +1853,7 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti) { int UE_id; int i; + int cc_id; NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; for (i = 0; i < MAX_MOBILES_PER_GNB; i++) { @@ -1745,10 +1886,34 @@ void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti) if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1); if (rnti_to_remove_count == 10) exit(1); rnti_to_remove[rnti_to_remove_count] = rnti; - LOG_W(MAC, "to remove in mac rnti_to_remove[%d]=%d\n", rnti_to_remove_count, rnti); + LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti); rnti_to_remove_count++; if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); } + + /* clear RA process(es?) associated to the UE */ + for (cc_id = 0; cc_id < NFAPI_CC_MAX; cc_id++) { + NR_COMMON_channels_t *cc = &RC.nrmac[mod_id]->common_channels[cc_id]; + for (i = 0; i < NR_NB_RA_PROC_MAX; i++) { + if (cc->ra[i].rnti == rnti) { + LOG_D(MAC, "free RA process %d for rnti %d\n", i, rnti); + /* is it enough? */ + cc->ra[i].cfra = false; + cc->ra[i].rnti = 0; + cc->ra[i].crnti = 0; + } + } + } +} + +void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti) { + // Hack to remove UE in the phy (following the same procedure as in function mac_remove_nr_ue) + if (pthread_mutex_lock(&rnti_to_remove_mutex)) exit(1); + if (rnti_to_remove_count == 10) exit(1); + rnti_to_remove[rnti_to_remove_count] = rnti; + LOG_W(NR_MAC, "to remove in mac rnti_to_remove[%d] = 0x%04x\n", rnti_to_remove_count, rnti); + rnti_to_remove_count++; + if (pthread_mutex_unlock(&rnti_to_remove_mutex)) exit(1); } uint8_t nr_get_tpc(int target, uint8_t cqi, int incr) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index a6f7105769..6f5946fe27 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -118,8 +118,13 @@ int diff_rsrp_ssb_csi_meas_10_1_6_1_2[16] = { void nr_schedule_pucch(int Mod_idP, frame_t frameP, - sub_frame_t slotP) { - NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; + sub_frame_t slotP) +{ + gNB_MAC_INST *nrmac = RC.nrmac[Mod_idP]; + if (!is_xlsch_in_slot(nrmac->ulsch_slot_bitmap[slotP / 64], slotP)) + return; + + NR_UE_info_t *UE_info = &nrmac->UE_info; const NR_list_t *UE_list = &UE_info->list; for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { @@ -181,7 +186,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in else { uint8_t nb_ssb_resources =0; //Finding the CSI_RS or SSB Resources - if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || + if (NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type || NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) { if (NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled == csi_reportconfig->groupBasedBeamReporting.present) { @@ -191,18 +196,17 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in /*! From Spec 38.331 * nrofReportedRS * The number (N) of measured RS resources to be reported per report setting in a non-group-based report. N <= N_max, where N_max is either 2 or 4 depending on UE - * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. + * capability. FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. * When the field is absent the UE applies the value 1 */ csi_report->CSI_report_bitlen.nb_ssbri_cri= 1; - }else + }else csi_report->CSI_report_bitlen.nb_ssbri_cri= 2; if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == csi_report->reportQuantity_type) { for ( csi_ssb_idx = 0; csi_ssb_idx < csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.count; csi_ssb_idx++) { if (csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceSetId == *(csi_resourceconfig->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.array[0])){ - ///We can configure only one SSB resource set from spec 38.331 IE CSI-ResourceConfig nb_ssb_resources= csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.count; csi_report->SSB_Index_list = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[csi_ssb_idx]->csi_SSB_ResourceList.list.array; @@ -226,12 +230,12 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in if (nb_ssb_resources) { csi_report->CSI_report_bitlen.cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources)); - csi_report->CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP + csi_report->CSI_report_bitlen.rsrp_bitlen = 7; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP csi_report->CSI_report_bitlen.diff_rsrp_bitlen =4; //From spec 38.212 Table 6.3.1.1.2-6: CRI, SSBRI, and RSRP - } else { + } else { csi_report->CSI_report_bitlen.cri_ssbri_bitlen =0; - csi_report->CSI_report_bitlen.rsrp_bitlen = 0; - csi_report->CSI_report_bitlen.diff_rsrp_bitlen =0; + csi_report->CSI_report_bitlen.rsrp_bitlen = 0; + csi_report->CSI_report_bitlen.diff_rsrp_bitlen =0; } LOG_I (MAC, "UCI: CSI_bit len : ssbri %d, rsrp: %d, diff_rsrp: %d\n", @@ -270,7 +274,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in csi_report->csi_meas_bitlen.ri_bitlen=0; break; case 2: - /* From Spec 38.212 + /* From Spec 38.212 * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause @@ -283,7 +287,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - /* Replace dummy with the nrofCQIsPerReport from the CSIreport + /* Replace dummy with the nrofCQIsPerReport from the CSIreport config when equalent ASN structure present */ if (0==*(csi_reportconfig->dummy)){ nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); @@ -293,7 +297,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in nb_allowed_ri = number_of_bits_set(ri_restriction, &max_ri); ri_bitlen = ceil(log2(nb_allowed_ri)); } - ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + ri_bitlen = ri_bitlen<1?ri_bitlen:1; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; break; case 4: @@ -301,7 +305,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - /* Replace dummy with the nrofCQIsPerReport from the CSIreport + /* Replace dummy with the nrofCQIsPerReport from the CSIreport config when equalent ASN structure present */ if (0==*(csi_reportconfig->dummy)){ nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0), &max_ri); @@ -311,16 +315,16 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in nb_allowed_ri = number_of_bits_set(ri_restriction,&max_ri); ri_bitlen = ceil(log2(nb_allowed_ri)); } - ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel + ri_bitlen = ri_bitlen<2?ri_bitlen:2; //from the spec 38.212 and table 6.3.1.1.2-3: RI, LI, CQI, and CRI of codebookType=typeI-SinglePanel csi_report->csi_meas_bitlen.ri_bitlen=ri_bitlen; break; case 6: case 8: AssertFatal (NULL!=csi_reportconfig->dummy, "nrofCQIsPerReport is not present"); - + ri_restriction = csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]; - /* Replace dummy with the nrofCQIsPerReport from the CSIreport + /* Replace dummy with the nrofCQIsPerReport from the CSIreport config when equalent ASN structure present */ if (0==*(csi_reportconfig->dummy)){ nb_allowed_ri = number_of_bits_set((ri_restriction & 0xf0),&max_ri); @@ -353,7 +357,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in case 4: case 6: case 8: - /* From Spec 38.212 + /* From Spec 38.212 * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause @@ -383,7 +387,7 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in case 4: case 6: case 8: - /* From Spec 38.212 + /* From Spec 38.212 * If the higher layer parameter nrofCQIsPerReport=1, nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator * values in the 4 LSBs of the higher layer parameter typeI-SinglePanel-ri-Restriction according to Subclause 5.2.2.2.1 [6, * TS 38.214]; otherwise nRI in Table 6.3.1.1.2-3 is the number of allowed rank indicator values according to Subclause @@ -392,18 +396,17 @@ void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_in * But from Current RRC ASN structures nrofCQIsPerReport is not present. Present a dummy variable is present so using it to * calculate RI for antennas equal or more than two. * */ - if (max_ri > 4 && max_ri < 8){ if (NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel==csi_reportconfig->codebookConfig->codebookType.choice.type1->subType.present){ if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) csi_report->csi_meas_bitlen.cqi_bitlen = 8; - else + else csi_report->csi_meas_bitlen.cqi_bitlen = 4; } }else{ //This condition will work even for type1-multipanel. if (NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI==csi_reportconfig->reportFreqConfiguration->cqi_FormatIndicator) csi_report->csi_meas_bitlen.cqi_bitlen = 4; - else + else csi_report->csi_meas_bitlen.cqi_bitlen = 2; } break; @@ -449,7 +452,7 @@ uint16_t nr_get_csi_bitlen(int Mod_idP, NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP==UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type){ CSI_report_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].CSI_report_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements csi_bitlen+= ((CSI_report_bitlen->cri_ssbri_bitlen * CSI_report_bitlen->nb_ssbri_cri) + - CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen * + CSI_report_bitlen->rsrp_bitlen +(CSI_report_bitlen->diff_rsrp_bitlen * (CSI_report_bitlen->nb_ssbri_cri -1 ))); } else{ csi_meas_bitlen = &(UE_info->csi_report_template[UE_id][csi_report_id].csi_meas_bitlen); //This might need to be moodif for Aperiodic CSI-RS measurements @@ -510,7 +513,7 @@ void nr_csi_meas_reporting(int Mod_idP, AssertFatal(curr_pucch->csi_bits == 0 && !curr_pucch->sr_flag && curr_pucch->dai_c == 0, - "PUCCH not free at index 2 for UE %04x\n", + "PUCCH not free at index 1 for UE %04x\n", UE_info->rnti[UE_id]); curr_pucch->frame = frame; curr_pucch->ul_slot = sched_slot; @@ -550,9 +553,6 @@ void nr_csi_meas_reporting(int Mod_idP, for (int i = start; i < start + len; ++i) { vrb_map_UL[i] |= mask; } - AssertFatal(!curr_pucch->simultaneous_harqcsi, - "UE %04x has simultaneous HARQ/CSI configured, but we don't support that\n", - UE_info->rnti[UE_id]); } } } @@ -571,7 +571,7 @@ static void handle_dl_harq(module_id_t mod_id, add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid); harq->round = 0; harq->ndi ^= 1; - } else if (harq->round == MAX_HARQ_ROUNDS) { + } else if (harq->round >= MAX_HARQ_ROUNDS - 1) { add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].available_dl_harq, harq_pid); harq->round = 0; harq->ndi ^= 1; @@ -656,7 +656,7 @@ int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_i //returns the measured RSRP value (upper limit) int get_measured_rsrp(uint8_t index) { //if index is invalid returning minimum rsrp -140 - if((index >= 0 && index <= 15) || index >= 114) + if(index <= 15 || index >= 114) return MIN_RSRP_VALUE; return L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[index]; @@ -892,7 +892,7 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; LOG_D(PHY,"SFN/SF:%d%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); - if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || + if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type || NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP == reportQuantity_type) { uint8_t csi_ssb_idx = 0; uint8_t diff_rsrp_idx = 0; @@ -924,12 +924,12 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, reverse_n_bits(payload, cri_ssbri_bitlen); if (NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP == reportQuantity_type) - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_info->csi_report_template[UE_id][csi_report_id].SSB_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); else - sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = + sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx] = *(UE_info->csi_report_template[UE_id][csi_report_id].CSI_Index_list[cri_ssbri_bitlen>0?((*payload)&~(~1<<(cri_ssbri_bitlen-1))):cri_ssbri_bitlen]); - + *payload >>= cri_ssbri_bitlen; LOG_D(PHY,"SSB_index = %d\n",sched_ctrl->CSI_report[idx].choice.ssb_cri_report.CRI_SSBRI [csi_ssb_idx]); } @@ -948,9 +948,52 @@ void extract_pucch_csi_report (NR_CSI_MeasConfig_t *csi_MeasConfig, } } - if ( !(reportQuantity_type)) + if ( !(reportQuantity_type)) AssertFatal(reportQuantity_type, "reportQuantity is not configured"); +} +static NR_UE_harq_t *find_harq(module_id_t mod_id, frame_t frame, sub_frame_t slot, int UE_id) +{ + /* In case of realtime problems: we can only identify a HARQ process by + * timing. If the HARQ process's feedback_frame/feedback_slot is not the one we + * expected, we assume that processing has been aborted and we need to + * skip this HARQ process, which is what happens in the loop below. + * Similarly, we might be "in advance", in which case we need to skip + * this result. */ + NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id]; + int8_t pid = sched_ctrl->feedback_dl_harq.head; + if (pid < 0) + return NULL; + NR_UE_harq_t *harq = &sched_ctrl->harq_processes[pid]; + /* old feedbacks we missed: mark for retransmission */ + while (harq->feedback_frame != frame + || (harq->feedback_frame == frame && harq->feedback_slot < slot)) { + LOG_W(MAC, + "expected HARQ pid %d feedback at %d.%d, but is at %d.%d instead (HARQ feedback is in the past)\n", + pid, + harq->feedback_frame, + harq->feedback_slot, + frame, + slot); + remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + handle_dl_harq(mod_id, UE_id, pid, 0); + pid = sched_ctrl->feedback_dl_harq.head; + if (pid < 0) + return NULL; + harq = &sched_ctrl->harq_processes[pid]; + } + /* feedbacks that we wait for in the future: don't do anything */ + if (harq->feedback_slot > slot) { + LOG_W(MAC, + "expected HARQ pid %d feedback at %d.%d, but is at %d.%d instead (HARQ feedback is in the future)\n", + pid, + harq->feedback_frame, + harq->feedback_slot, + frame, + slot); + return NULL; + } + return harq; } void handle_nr_uci_pucch_0_1(module_id_t mod_id, @@ -1030,6 +1073,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10, uci_234->ul_cqi, 30); + sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640; // NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; // const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; @@ -1072,14 +1116,27 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id, if ((uci_234->pduBitmap >> 3) & 0x01) { //@TODO:Handle CSI Report 2 } + if ((uci_234->pduBitmap >> 2) & 0x01) { + //API to parse the csi report and store it into sched_ctrl + extract_pucch_csi_report (csi_MeasConfig, uci_234, frame, slot, UE_id, mod_id); + //TCI handling function + tci_handling(mod_id, UE_id,frame, slot); + } + if ((uci_234->pduBitmap >> 3) & 0x01) { + //@TODO:Handle CSI Report 2 + } } // function to update pucch scheduling parameters in UE list when a USS DL is scheduled -bool nr_acknack_scheduling(int mod_id, - int UE_id, - frame_t frame, - sub_frame_t slot) +// this function returns an index to NR_sched_pucch structure +// currently this structure contains PUCCH0 at index 0 and PUCCH2 at index 1 +// if the function returns -1 it was not possible to schedule acknack +// when current pucch is ready to be scheduled nr_fill_nfapi_pucch is called +int nr_acknack_scheduling(int mod_id, + int UE_id, + frame_t frame, + sub_frame_t slot) { const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; @@ -1089,6 +1146,7 @@ bool nr_acknack_scheduling(int mod_id, const int nr_slots_period = tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots; const int first_ul_slot_tdd = tdd->nrofDownlinkSlots + nr_slots_period * (slot / nr_slots_period); const int CC_id = 0; + NR_sched_pucch_t *csi_pucch; AssertFatal(slot < first_ul_slot_tdd + (tdd->nrofUplinkSymbols != 0), "cannot handle multiple TDD periods (yet): slot %d first_ul_slot_tdd %d nrofUplinkSlots %ld\n", @@ -1101,25 +1159,18 @@ bool nr_acknack_scheduling(int mod_id, * * we do not multiplex with CSI, which is always in pucch_sched[2] * * SR uses format 0 and is allocated in the first UL (mixed) slot (and not * later) - * * that the PUCCH resource set 0 (for up to 2 bits) points to the first N - * PUCCH resources, where N is the number of resources in the PUCCH - * resource set. This is used in pucch_index_used, which counts the used - * resources by index, and not by their ID! */ + * * each UE has dedicated PUCCH Format 0 resources, and we use index 0! */ NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id]; NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0]; AssertFatal(pucch->csi_bits == 0, "%s(): csi_bits %d in sched_pucch[0]\n", __func__, pucch->csi_bits); - - const int max_acknacks = 2; - AssertFatal(pucch->dai_c + pucch->sr_flag <= max_acknacks, - "illegal number of bits in PUCCH of UE %d\n", - UE_id); /* if the currently allocated PUCCH of this UE is full, allocate it */ if (NFAPI_MODE == NFAPI_MODE_VNF) pucch->sr_flag = 1; pucch->dai_c = 1; - if (pucch->sr_flag + pucch->dai_c == max_acknacks) { + + if (pucch->dai_c == 2) { /* advance the UL slot information in PUCCH by one so we won't schedule in * the same slot again */ const int f = pucch->frame; @@ -1136,18 +1187,15 @@ bool nr_acknack_scheduling(int mod_id, pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; pucch->ul_slot = (s + 1) % n_slots_frame; // we assume that only two indices over the array sched_pucch exist - const NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[2]; + csi_pucch = &sched_ctrl->sched_pucch[1]; // skip the CSI PUCCH if it is present and if in the next frame/slot + // and if we don't multiplex if (csi_pucch->csi_bits > 0 && csi_pucch->frame == pucch->frame - && csi_pucch->ul_slot == pucch->ul_slot) { - AssertFatal(!csi_pucch->simultaneous_harqcsi, - "%s(): %d.%d cannot handle simultaneous_harqcsi, but found for UE %d\n", - __func__, - pucch->frame, - pucch->ul_slot, - UE_id); + && csi_pucch->ul_slot == pucch->ul_slot + && !csi_pucch->simultaneous_harqcsi) { nr_fill_nfapi_pucch(mod_id, frame, slot, csi_pucch, UE_id); + memset(csi_pucch, 0, sizeof(*csi_pucch)); pucch->frame = s >= n_slots_frame - 2 ? (f + 1) % 1024 : f; printf("pucch frame filled. \n"); pucch->ul_slot = (s + 2) % n_slots_frame; @@ -1160,16 +1208,15 @@ bool nr_acknack_scheduling(int mod_id, if ((pucch->frame == frame && (pucch->ul_slot >= first_ul_slot_tdd + nr_ulmix_slots)) || (pucch->frame == frame + 1)) - return false; + return -1; // this is hardcoded for now as ue specific NR_SearchSpace__searchSpaceType_PR ss_type = NR_SearchSpace__searchSpaceType_PR_ue_Specific; uint8_t pdsch_to_harq_feedback[8]; get_pdsch_to_harq_feedback(mod_id, UE_id, ss_type, pdsch_to_harq_feedback); - /* there is a scheduled SR or HARQ. Check whether we can use it for this - * ACKNACK */ - if (pucch->sr_flag + pucch->dai_c > 0) { + /* there is a HARQ. Check whether we can use it for this ACKNACK */ + if (pucch->dai_c > 0) { /* this UE already has a PUCCH occasion */ DevAssert(pucch->frame == frame); @@ -1195,23 +1242,19 @@ bool nr_acknack_scheduling(int mod_id, pucch->timing_indicator = i; pucch->dai_c++; // retain old resource indicator, and we are good - return true; + return 0; } /* we need to find a new PUCCH occasion */ - NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; - DevAssert(pucch_Config->resourceToAddModList->list.count > 0); - DevAssert(pucch_Config->resourceSetToAddModList->list.count > 0); - const int n_res = pucch_Config->resourceSetToAddModList->list.array[0]->resourceList.list.count; - int *pucch_index_used = RC.nrmac[mod_id]->pucch_index_used[sched_ctrl->active_ubwp->bwp_Id]; - /* if time information is outdated (e.g., last PUCCH occasion in last frame), * set to first possible UL occasion in this frame. Note that if such UE is * scheduled a lot and used all AckNacks, pucch->frame might have been * wrapped around to next frame */ if (frame != pucch->frame || pucch->ul_slot < first_ul_slot_tdd) { - DevAssert(pucch->sr_flag + pucch->dai_c == 0); + AssertFatal(pucch->sr_flag + pucch->dai_c == 0, + "expected no SR/AckNack for UE %d in %4d.%2d, but has %d/%d for %4d.%2d\n", + UE_id, frame, slot, pucch->sr_flag, pucch->dai_c, pucch->frame, pucch->ul_slot); AssertFatal(frame + 1 != pucch->frame, "frame wrap around not handled in %s() yet\n", __func__); @@ -1219,22 +1262,6 @@ bool nr_acknack_scheduling(int mod_id, pucch->ul_slot = first_ul_slot_tdd; } - // increase to first slot in which PUCCH resources are available - while (pucch_index_used[pucch->ul_slot] >= n_res) { - pucch->ul_slot++; - /* if there is no free resource anymore, abort search */ - if ((pucch->frame == frame - && pucch->ul_slot >= first_ul_slot_tdd + nr_ulmix_slots) - || (pucch->frame == frame + 1)) { - LOG_E(MAC, - "%4d.%2d no free PUCCH resources anymore while searching for UE %d\n", - frame, - slot, - UE_id); - return false; - } - } - // advance ul_slot if it is not reachable by UE pucch->ul_slot = max(pucch->ul_slot, slot + pdsch_to_harq_feedback[0]); @@ -1253,37 +1280,57 @@ bool nr_acknack_scheduling(int mod_id, slot, UE_id, pucch->ul_slot); - return false; + return -1; } + + // is there already CSI in this slot? + csi_pucch = &sched_ctrl->sched_pucch[1]; + if (csi_pucch->csi_bits > 0 + && csi_pucch->frame == pucch->frame + && csi_pucch->ul_slot == pucch->ul_slot) { + // skip the CSI PUCCH if it is present and if in the next frame/slot + // and if we don't multiplex + // FIXME currently we support at most 11 bits in pucch2 so skip also in that case + if(!csi_pucch->simultaneous_harqcsi + || ((csi_pucch->csi_bits + csi_pucch->dai_c) >= 11)) { + nr_fill_nfapi_pucch(mod_id, frame, slot, csi_pucch, UE_id); + memset(csi_pucch, 0, sizeof(*csi_pucch)); + /* advance the UL slot information in PUCCH by one so we won't schedule in + * the same slot again */ + const int f = pucch->frame; + const int s = pucch->ul_slot; + memset(pucch, 0, sizeof(*pucch)); + pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f; + pucch->ul_slot = (s + 1) % n_slots_frame; + return nr_acknack_scheduling(mod_id, UE_id, frame, slot); + } + // multiplexing harq and csi in a pucch + else { + csi_pucch->timing_indicator = i; + csi_pucch->dai_c++; + return 1; + } + } + pucch->timing_indicator = i; // index in the list of timing indicators pucch->dai_c++; - const int pucch_res = pucch_index_used[pucch->ul_slot]; - pucch->resource_indicator = pucch_res; - pucch_index_used[pucch->ul_slot] += 1; - AssertFatal(pucch_index_used[pucch->ul_slot] <= n_res, - "UE %d in %4d.%2d: pucch_index_used is %d (%d available)\n", - UE_id, - pucch->frame, - pucch->ul_slot, - pucch_index_used[pucch->ul_slot], - n_res); + pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources /* verify that at that slot and symbol, resources are free. We only do this * for initialCyclicShift 0 (we assume it always has that one), so other * initialCyclicShifts can overlap with ICS 0!*/ - const NR_PUCCH_Resource_t *resource = - pucch_Config->resourceToAddModList->list.array[pucch_res]; + const NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; + const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[pucch->resource_indicator]; DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); if (resource->format.choice.format0->initialCyclicShift == 0) { uint16_t *vrb_map_UL = &RC.nrmac[mod_id]->common_channels[CC_id].vrb_map_UL[pucch->ul_slot * MAX_BWP_SIZE]; const uint16_t symb = 1 << resource->format.choice.format0->startingSymbolIndex; - AssertFatal((vrb_map_UL[resource->startingPRB] & symb) == 0, - "symbol %x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d\n", - symb, resource->startingPRB, pucch->ul_slot); + if ((vrb_map_UL[resource->startingPRB] & symb) != 0) + LOG_W(MAC, "symbol 0x%x is not free for PUCCH alloc in vrb_map_UL at RB %ld and slot %d.%d\n", symb, resource->startingPRB, pucch->frame, pucch->ul_slot); vrb_map_UL[resource->startingPRB] |= symb; } - return true; + return 0; } @@ -1413,3 +1460,154 @@ uint16_t compute_pucch_prb_size(uint8_t format, AssertFatal(1==0,"Not yet implemented"); } } + +void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot) +{ + gNB_MAC_INST *nrmac = RC.nrmac[Mod_idP]; + if (!is_xlsch_in_slot(nrmac->ulsch_slot_bitmap[slot / 64], slot)) + return; + NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon; + const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + NR_UE_info_t *UE_info = &nrmac->UE_info; + NR_list_t *UE_list = &UE_info->list; + for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup; + AssertFatal(pucch_Config->schedulingRequestResourceToAddModList->list.count>0,"NO SR configuration available"); + + for (int SR_resource_id =0; SR_resource_id < pucch_Config->schedulingRequestResourceToAddModList->list.count;SR_resource_id++) { + NR_SchedulingRequestResourceConfig_t *SchedulingRequestResourceConfig = pucch_Config->schedulingRequestResourceToAddModList->list.array[SR_resource_id]; + + int SR_period; int SR_offset; + + periodicity__SRR(SchedulingRequestResourceConfig,&SR_period,&SR_offset); + // convert to int to avoid underflow of uint + int sfn_sf = SFN * n_slots_frame + slot; + if ((sfn_sf - SR_offset) % SR_period != 0) + continue; + LOG_D(MAC, "%4d.%2d Scheduling Request identified\n", SFN, slot); + NR_PUCCH_ResourceId_t *PucchResourceId = SchedulingRequestResourceConfig->resource; + + int found = -1; + NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[0]; // set with formats 0,1 + int n_list = pucchresset->resourceList.list.count; + for (int i=0; iresourceList.list.array[i] == *PucchResourceId ) + found = i; + } + AssertFatal(found>-1,"SR resource not found among PUCCH resources"); + + /* loop through nFAPI PUCCH messages: if the UEs is in there in this slot + * with the resource_indicator, it means we already allocated that PUCCH + * resource for AckNack (e.g., the UE has been scheduled often), and we + * just need to add the SR_flag. Otherwise, just allocate in the internal + * PUCCH resource, and nr_schedule_pucch() will handle the rest */ + NR_PUCCH_Resource_t *pucch_res = pucch_Config->resourceToAddModList->list.array[found]; + /* for the moment, can only handle SR on PUCCH Format 0 */ + DevAssert(pucch_res->format.present == NR_PUCCH_Resource__format_PR_format0); + nfapi_nr_ul_tti_request_t *ul_tti_req = &nrmac->UL_tti_req_ahead[0][slot]; + bool nfapi_allocated = false; + for (int i = 0; i < ul_tti_req->n_pdus; ++i) { + if (ul_tti_req->pdus_list[i].pdu_type != NFAPI_NR_UL_CONFIG_PUCCH_PDU_TYPE) + continue; + nfapi_nr_pucch_pdu_t *pdu = &ul_tti_req->pdus_list[i].pucch_pdu; + /* check that it is our PUCCH F0. Assuming there can be only one */ + if (pdu->rnti == UE_info->rnti[UE_id] + && pdu->format_type == 0 // does not use NR_PUCCH_Resource__format_PR_format0 + && pdu->initial_cyclic_shift == pucch_res->format.choice.format0->initialCyclicShift + && pdu->nr_of_symbols == pucch_res->format.choice.format0->nrofSymbols + && pdu->start_symbol_index == pucch_res->format.choice.format0->startingSymbolIndex) { + LOG_D(MAC,"%4d.%2d adding SR_flag 1 to PUCCH nFAPI SR for RNTI %04x\n", SFN, slot, pdu->rnti); + pdu->sr_flag = 1; + nfapi_allocated = true; + break; + } + } + + if (nfapi_allocated) // break scheduling resource loop, continue next UE + break; + + /* we did not find it: check if current PUCCH is for the current slot, in + * which case we add the SR to it; otherwise, allocate SR separately */ + NR_sched_pucch_t *curr_pucch = &sched_ctrl->sched_pucch[0]; + if (curr_pucch->frame == SFN && curr_pucch->ul_slot == slot) { + if (curr_pucch->resource_indicator != found) { + LOG_W(MAC, "%4d.%2d expected PUCCH in this slot to have resource indicator of SR (%d), skipping SR\n", SFN, slot, found); + continue; + } + curr_pucch->sr_flag = true; + } else { + NR_sched_pucch_t sched_sr; + memset(&sched_sr, 0, sizeof(sched_sr)); + sched_sr.frame = SFN; + sched_sr.ul_slot = slot; + sched_sr.resource_indicator = found; + sched_sr.sr_flag = true; + nr_fill_nfapi_pucch(Mod_idP, SFN, slot, &sched_sr, UE_id); + } + } + } +} + + +void periodicity__SRR (NR_SchedulingRequestResourceConfig_t *SchedulingReqRec, int *period, int *offset) +{ + NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR P_O = SchedulingReqRec->periodicityAndOffset->present; + switch (P_O){ + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl1: + *period = 1; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl1; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl2: + *period = 2; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl2; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl4: + *period = 4; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl4; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl5: + *period = 5; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl5; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl8: + *period = 8; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl8; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10: + *period = 10; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl10; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl16: + *period = 16; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl16; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl20: + *period = 20; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl20; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl40: + *period = 40; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl40; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl80: + *period = 80; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl80; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl160: + *period = 160; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl160; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl320: + *period = 320; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl320; + break; + case NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl640: + *period = 640; + *offset = SchedulingReqRec->periodicityAndOffset->choice.sl640; + break; + default: + AssertFatal(1==0,"No periodicityAndOffset resources found in schedulingrequestresourceconfig"); + } +} + diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 23d8f7677f..bcdc85fec3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -62,13 +62,124 @@ const uint32_t NR_LONG_BSR_TABLE[256] ={ 35910462, 38241455, 40723756, 43367187, 46182206, 49179951, 52372284, 55771835, 59392055, 63247269, 67352729, 71724679, 76380419, 81338368, 162676736, 4294967295 }; -void nr_process_mac_pdu( - module_id_t module_idP, - rnti_t rnti, - uint8_t CC_id, - frame_t frameP, - uint8_t *pduP, - uint16_t mac_pdu_len) +void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ubwp) +{ + gNB_MAC_INST *nrmac = RC.nrmac[module_id]; + const int bwp_id = ubwp->bwp_Id; + if (nrmac->preferred_ul_tda[bwp_id]) + return; + + /* there is a mixed slot only when in TDD */ + const NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon; + const int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; + const NR_TDD_UL_DL_Pattern_t *tdd = + scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; + /* Uplink symbols are at the end of the slot */ + const int symb_ulMixed = tdd ? ((1 << tdd->nrofUplinkSymbols) - 1) << (14 - tdd->nrofUplinkSymbols) : 0; + + const struct NR_PUCCH_Config__resourceToAddModList *resList = ubwp->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList; + // for the moment, just block any symbol that might hold a PUCCH, regardless + // of the RB. This is a big simplification, as most RBs will NOT have a PUCCH + // in the respective symbols, but it simplifies scheduling + uint16_t symb_pucch = 0; + for (int i = 0; i < resList->list.count; ++i) { + const NR_PUCCH_Resource_t *resource = resList->list.array[i]; + int nrofSymbols = 0; + int startingSymbolIndex = 0; + switch (resource->format.present) { + case NR_PUCCH_Resource__format_PR_format0: + nrofSymbols = resource->format.choice.format0->nrofSymbols; + startingSymbolIndex = resource->format.choice.format0->startingSymbolIndex; + break; + case NR_PUCCH_Resource__format_PR_format1: + nrofSymbols = resource->format.choice.format1->nrofSymbols; + startingSymbolIndex = resource->format.choice.format1->startingSymbolIndex; + break; + case NR_PUCCH_Resource__format_PR_format2: + nrofSymbols = resource->format.choice.format2->nrofSymbols; + startingSymbolIndex = resource->format.choice.format2->startingSymbolIndex; + break; + case NR_PUCCH_Resource__format_PR_format3: + nrofSymbols = resource->format.choice.format3->nrofSymbols; + startingSymbolIndex = resource->format.choice.format3->startingSymbolIndex; + break; + case NR_PUCCH_Resource__format_PR_format4: + nrofSymbols = resource->format.choice.format4->nrofSymbols; + startingSymbolIndex = resource->format.choice.format4->startingSymbolIndex; + break; + default: + AssertFatal(0, "found NR_PUCCH format index %d\n", resource->format.present); + break; + } + symb_pucch |= ((1 << nrofSymbols) - 1) << startingSymbolIndex; + } + + /* check that TDA index 1 fits into UL slot and does not overlap with PUCCH */ + const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + AssertFatal(tdaList->list.count >= 3, "need to have at least three TDAs for UL slots\n"); + const NR_PUSCH_TimeDomainResourceAllocation_t *tdaP_UL = tdaList->list.array[0]; + const int k2 = get_K2(ubwp, /* tda = */ 0, mu); + int start, len; + SLIV2SL(tdaP_UL->startSymbolAndLength, &start, &len); + const uint16_t symb_tda = ((1 << len) - 1) << start; + // check whether PUCCH and TDA overlap: then, we cannot use it. Note that + // here we assume that the PUCCH is scheduled in every slot, and on all RBs + // (which is mostly not true, this is a simplification) + AssertFatal((symb_pucch & symb_tda) == 0, "TDA index 0 for UL overlaps with PUCCH\n"); + + // get largest time domain allocation (TDA) for UL slot and UL in mixed slot + int tdaMi = -1; + const NR_PUSCH_TimeDomainResourceAllocation_t *tdaP_Mi = tdaList->list.array[1]; + AssertFatal(k2 == get_K2(ubwp, /* tda = */ 1, mu), + "scheduler cannot handle different k2 for UL slot (%d) and UL Mixed slot (%ld)\n", + k2, + get_K2(ubwp, /* tda = */ 1, mu)); + SLIV2SL(tdaP_Mi->startSymbolAndLength, &start, &len); + const uint16_t symb_tda_mi = ((1 << len) - 1) << start; + // check whether PUCCH and TDA overlap: then, we cannot use it. Also, check + // whether TDA is entirely within mixed slot, UL. Note that here we assume + // that the PUCCH is scheduled in every slot, and on all RBs (which is + // mostly not true, this is a simplification) + if ((symb_pucch & symb_tda_mi) == 0 && (symb_ulMixed & symb_tda_mi) == symb_tda_mi) { + tdaMi = 1; + } else { + LOG_E(MAC, + "TDA index 1 UL overlaps with PUCCH or is not entirely in mixed slot (symb_pucch %x symb_ulMixed %x symb_tda_mi %x), won't schedule UL mixed slot\n", + symb_pucch, + symb_ulMixed, + symb_tda_mi); + } + + const uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160}; + const int n = slots_per_frame[*scc->ssbSubcarrierSpacing]; + nrmac->preferred_ul_tda[bwp_id] = malloc(n * sizeof(*nrmac->preferred_ul_tda[bwp_id])); + + const int nr_mix_slots = tdd ? tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0 : 0; + const int nr_slots_period = tdd ? tdd->nrofDownlinkSlots + tdd->nrofUplinkSlots + nr_mix_slots : n; + for (int slot = 0; slot < n; ++slot) { + const int sched_slot = (slot + k2) % n; + nrmac->preferred_ul_tda[bwp_id][slot] = -1; + if (!tdd || sched_slot % nr_slots_period >= tdd->nrofDownlinkSlots + nr_mix_slots) + nrmac->preferred_ul_tda[bwp_id][slot] = 0; + else if (tdd && nr_mix_slots && sched_slot % nr_slots_period == tdd->nrofDownlinkSlots) + nrmac->preferred_ul_tda[bwp_id][slot] = tdaMi; + LOG_I(MAC, "DL slot %d UL slot %d preferred_ul_tda %d\n", slot, sched_slot, nrmac->preferred_ul_tda[bwp_id][slot]); + } + + if (k2 < tdd->nrofUplinkSlots) + LOG_W(MAC, + "k2 %d < tdd->nrofUplinkSlots %ld: not all UL slots can be scheduled\n", + k2, + tdd->nrofUplinkSlots); +} + +void nr_process_mac_pdu(module_id_t module_idP, + int UE_id, + uint8_t CC_id, + frame_t frameP, + sub_frame_t slot, + uint8_t *pduP, + uint16_t mac_pdu_len) { // This function is adapting code from the old @@ -80,11 +191,6 @@ void nr_process_mac_pdu( NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info; - int UE_id = find_nr_UE_id(module_idP, rnti); - if (UE_id == -1) { - LOG_E(MAC, "%s() UE_id == -1\n",__func__); - return; - } NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; // For both DL/UL-SCH // Except: @@ -138,20 +244,23 @@ void nr_process_mac_pdu( case UL_SCH_LCID_S_BSR: case UL_SCH_LCID_S_TRUNCATED_BSR: - //38.321 section 6.1.3.1 - //fixed length - mac_ce_len =1; - /* Extract short BSR value */ + //38.321 section 6.1.3.1 + //fixed length + mac_ce_len =1; + /* Extract short BSR value */ ce_ptr = &pdu_ptr[mac_subheader_len]; NR_BSR_SHORT *bsr_s = (NR_BSR_SHORT *) ce_ptr; sched_ctrl->estimated_ul_buffer = 0; sched_ctrl->estimated_ul_buffer = NR_SHORT_BSR_TABLE[bsr_s->Buffer_size]; - LOG_D(MAC, "SHORT BSR, LCG ID %d, BS Index %d, BS value < %d, est buf %d\n", + LOG_D(MAC, + "SHORT BSR at %4d.%2d, LCG ID %d, BS Index %d, BS value < %d, est buf %d\n", + frameP, + slot, bsr_s->LcgID, bsr_s->Buffer_size, NR_SHORT_BSR_TABLE[bsr_s->Buffer_size], sched_ctrl->estimated_ul_buffer); - break; + break; case UL_SCH_LCID_L_BSR: case UL_SCH_LCID_L_TRUNCATED_BSR: @@ -171,19 +280,21 @@ void nr_process_mac_pdu( n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 + bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0; - LOG_D(MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", - bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4, - bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0); - for (int n = 0; n < n_Lcg; n++){ - LOG_D(MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d", - n, n_Lcg, pdu_ptr[mac_subheader_len + 1 + n], - NR_LONG_BSR_TABLE[pdu_ptr[mac_subheader_len + 1 + n]]); sched_ctrl->estimated_ul_buffer += NR_LONG_BSR_TABLE[pdu_ptr[mac_subheader_len + 1 + n]]; + LOG_D(MAC, + "LONG BSR at %4d.%2d, %d/%d (n/n_Lcg), BS Index %d, BS value < %d, total %d\n", + frameP, + slot, + n, + n_Lcg, + pdu_ptr[mac_subheader_len + 1 + n], + NR_LONG_BSR_TABLE[pdu_ptr[mac_subheader_len + 1 + n]], + sched_ctrl->estimated_ul_buffer); } - break; + break; case UL_SCH_LCID_C_RNTI: //38.321 section 6.1.3.2 @@ -197,6 +308,20 @@ void nr_process_mac_pdu( //fixed length mac_ce_len = 2; /* Extract SINGLE ENTRY PHR elements for PHR calculation */ + ce_ptr = &pdu_ptr[mac_subheader_len]; + NR_SINGLE_ENTRY_PHR_MAC_CE *phr = (NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr; + /* Save the phr info */ + const int PH = phr->PH; + const int PCMAX = phr->PCMAX; + /* 38.133 Table10.1.17.1-1 */ + if (PH < 55) + sched_ctrl->ph = PH - 32; + else + sched_ctrl->ph = PH - 32 + (PH - 54); + /* 38.133 Table10.1.18.1-1 */ + sched_ctrl->pcmax = PCMAX - 29; + LOG_D(MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", + phr->R1, PH, sched_ctrl->ph, phr->R2, PCMAX, sched_ctrl->pcmax); break; case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT: @@ -238,57 +363,91 @@ void nr_process_mac_pdu( case UL_SCH_LCID_SRB3: // todo break; - case UL_SCH_LCID_CCCH_MSG3: - // todo - break; + case UL_SCH_LCID_CCCH: - // todo - mac_subheader_len = 2; + case UL_SCH_LCID_CCCH1: + // fixed length + mac_subheader_len = 1; + + if ( rx_lcid == UL_SCH_LCID_CCCH1 ) { + // RRCResumeRequest1 message includes the full I-RNTI and has a size of 8 bytes + mac_sdu_len = 8; + + // Check if it is a valid CCCH1 message, we get all 00's messages very often + int i = 0; + for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) { + if(pdu_ptr[i] != 0) { + break; + } + } + if (i == (mac_subheader_len+mac_sdu_len)) { + LOG_D(NR_MAC, "%s() Invalid CCCH1 message!, pdu_len: %d\n", __func__, pdu_len); + done = 1; break; + } + } else { + // fixed length of 6 bytes + mac_sdu_len = 6; + } + + nr_mac_rrc_data_ind(module_idP, + CC_id, + frameP, + 0, + 0, + UE_info->rnti[UE_id], + CCCH, + pdu_ptr+mac_subheader_len, + mac_sdu_len, + 0); + break; case UL_SCH_LCID_DTCH: - // check if LCID is valid at current time. - if(((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F){ - //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8; - mac_subheader_len = 3; - mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L1 & 0x7f) << 8) - | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pdu_ptr)->L2 & 0xff); + // check if LCID is valid at current time. + if (((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->F) { + // mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2)<<8; + mac_subheader_len = 3; + mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L1 & 0x7f) << 8) + | ((uint16_t)((NR_MAC_SUBHEADER_LONG *)pdu_ptr)->L2 & 0xff); - } else { - mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L; - mac_subheader_len = 2; - } + } else { + mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pdu_ptr)->L; + mac_subheader_len = 2; + } - LOG_D(MAC, "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len); - int UE_id = find_nr_UE_id(module_idP, rnti); - RC.nrmac[module_idP]->UE_info.mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len; - #if defined(ENABLE_MAC_PAYLOAD_DEBUG) - log_dump(MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n"); + LOG_D(MAC, + "[UE %d] Frame %d : ULSCH -> UL-DTCH %d (gNB %d, %d bytes)\n", + module_idP, + frameP, + rx_lcid, + module_idP, + mac_sdu_len); + UE_info->mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len; +#if defined(ENABLE_MAC_PAYLOAD_DEBUG) + log_dump(MAC, pdu_ptr + mac_subheader_len, 32, LOG_DUMP_CHAR, "\n"); +#endif - #endif + mac_rlc_data_ind(module_idP, + UE_info->rnti[UE_id], + module_idP, + frameP, + ENB_FLAG_YES, + MBMS_FLAG_NO, + rx_lcid, + (char *)(pdu_ptr + mac_subheader_len), + mac_sdu_len, + 1, + NULL); - mac_rlc_data_ind(module_idP, - rnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - rx_lcid, - (char *) (pdu_ptr + mac_subheader_len), - mac_sdu_len, - 1, - NULL); - - /* Updated estimated buffer when receiving data */ - if (sched_ctrl->estimated_ul_buffer >= mac_sdu_len) - sched_ctrl->estimated_ul_buffer -= mac_sdu_len; - else - sched_ctrl->estimated_ul_buffer = 0; - - break; + /* Updated estimated buffer when receiving data */ + if (sched_ctrl->estimated_ul_buffer >= mac_sdu_len) + sched_ctrl->estimated_ul_buffer -= mac_sdu_len; + else + sched_ctrl->estimated_ul_buffer = 0; + break; default: - LOG_D(MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid); + LOG_E(MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid); return; break; } @@ -306,6 +465,24 @@ void nr_process_mac_pdu( } } +void abort_nr_ul_harq(module_id_t mod_id, int UE_id, int8_t harq_pid) +{ + NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_UE_ul_harq_t *harq = &sched_ctrl->ul_harq_processes[harq_pid]; + + harq->ndi ^= 1; + harq->round = 0; + UE_info->mac_stats[UE_id].ulsch_errors++; + add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); + + /* the transmission failed: the UE won't send the data we expected initially, + * so retrieve to correctly schedule after next BSR */ + sched_ctrl->sched_ul_bytes -= harq->sched_pusch.tb_size; + if (sched_ctrl->sched_ul_bytes < 0) + sched_ctrl->sched_ul_bytes = 0; +} + void handle_nr_ul_harq(module_id_t mod_id, frame_t frame, sub_frame_t slot, @@ -330,8 +507,13 @@ void handle_nr_ul_harq(module_id_t mod_id, return; remove_front_nr_list(&sched_ctrl->feedback_ul_harq); - sched_ctrl->ul_harq_processes[harq_pid].round++; - add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid); + sched_ctrl->ul_harq_processes[harq_pid].is_waiting = false; + if(sched_ctrl->ul_harq_processes[harq_pid].round >= MAX_HARQ_ROUNDS - 1) { + abort_nr_ul_harq(mod_id, UE_id, harq_pid); + } else { + sched_ctrl->ul_harq_processes[harq_pid].round++; + add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid); + } harq_pid = sched_ctrl->feedback_ul_harq.head; } remove_front_nr_list(&sched_ctrl->feedback_ul_harq); @@ -347,15 +529,12 @@ void handle_nr_ul_harq(module_id_t mod_id, harq_pid, crc_pdu->rnti); add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); - } else if (harq->round == MAX_HARQ_ROUNDS) { - harq->ndi ^= 1; - harq->round = 0; + } else if (harq->round >= MAX_HARQ_ROUNDS - 1) { + abort_nr_ul_harq(mod_id, UE_id, harq_pid); LOG_D(MAC, "RNTI %04x: Ulharq id %d crc failed in all rounds\n", crc_pdu->rnti, harq_pid); - UE_info->mac_stats[UE_id].ulsch_errors++; - add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); } else { harq->round++; LOG_D(MAC, @@ -408,11 +587,12 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, sduP); // if not missed detection (10dB threshold for now) - if (UE_scheduling_control->ul_rssi < (100+rssi)) { + if (UE_scheduling_control->raw_rssi < 100 + rssi) { UE_scheduling_control->tpc0 = nr_get_tpc(target_snrx10,ul_cqi,30); if (timing_advance != 0xffff) UE_scheduling_control->ta_update = timing_advance; - UE_scheduling_control->ul_rssi = rssi; + UE_scheduling_control->raw_rssi = rssi; + UE_scheduling_control->pusch_snrx10 = ul_cqi * 5 - 640; LOG_D(NR_MAC, "[UE %d] PUSCH TPC %d and TA %d\n",UE_id,UE_scheduling_control->tpc0,UE_scheduling_control->ta_update); } else{ @@ -439,21 +619,21 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (UE_scheduling_control->sched_ul_bytes < 0) UE_scheduling_control->sched_ul_bytes = 0; - nr_process_mac_pdu(gnb_mod_idP, current_rnti, CC_idP, frameP, sduP, sdu_lenP); + nr_process_mac_pdu(gnb_mod_idP, UE_id, CC_idP, frameP, slotP, sduP, sdu_lenP); } - else { - NR_UE_ul_harq_t *cur_harq = &UE_scheduling_control->ul_harq_processes[harq_pid]; - /* reduce sched_ul_bytes when cur_harq->round == 3 */ - if (cur_harq->round == 3){ - const uint32_t tb_size = UE_scheduling_control->ul_harq_processes[harq_pid].sched_pusch.tb_size; - UE_scheduling_control->sched_ul_bytes -= tb_size; - if (UE_scheduling_control->sched_ul_bytes < 0) - UE_scheduling_control->sched_ul_bytes = 0; + } else if(sduP) { + + bool no_sig = true; + for (int k = 0; k < sdu_lenP; k++) { + if(sduP[k]!=0) { + no_sig = false; + break; } } - } else { - if (!sduP) // check that CRC passed - return; + + if(no_sig) { + LOG_W(NR_MAC, "No signal\n"); + } T(T_GNB_MAC_UL_PDU_WITH_DATA, T_INT(gnb_mod_idP), T_INT(CC_idP), T_INT(rntiP), T_INT(frameP), T_INT(slotP), T_INT(-1) /* harq_pid */, @@ -467,45 +647,93 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (ra->state != WAIT_Msg3) continue; - // random access pusch with TC-RNTI - if (ra->rnti != current_rnti) { - LOG_W(NR_MAC, - "expected TC-RNTI %04x to match current RNTI %04x\n", + if(no_sig) { + LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); + } else { + + // random access pusch with TC-RNTI + if (ra->rnti != current_rnti) { + LOG_W(NR_MAC, + "expected TC_RNTI %04x to match current RNTI %04x\n", + ra->rnti, + current_rnti); + + if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) { + LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); + } + + continue; + } + + const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup); + UE_info->UE_beam_index[UE_id] = ra->beam_id; + + // re-initialize ta update variables after RA procedure completion + UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP; + + LOG_I(NR_MAC, + "reset RA state information for RA-RNTI %04x/index %d\n", ra->rnti, - current_rnti); + i); + + LOG_I(NR_MAC, + "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, " + "adding UE MAC Context UE_id %d/RNTI %04x\n", + gnb_mod_idP, + current_rnti, + UE_id, + ra->rnti); + + if(ra->cfra) { + + LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) CFRA procedure succeeded!\n", UE_id, ra->rnti); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); + UE_info->active[UE_id] = true; + + } else { + + LOG_I(NR_MAC,"[RAPROC] RA-Msg3 received (sdu_lenP %d)\n",sdu_lenP); + LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n"); + for (int k = 0; k < sdu_lenP; k++) { + LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); + } + + // UE Contention Resolution Identity + // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to fill in Msg4 + // First byte corresponds to R/LCID MAC sub-header + memcpy(ra->cont_res_id, &sduP[1], sizeof(uint8_t) * 6); + + nr_process_mac_pdu(gnb_mod_idP, UE_id, CC_idP, frameP, slotP, sduP, sdu_lenP); + + ra->state = Msg4; + ra->Msg4_frame = ( frameP +2 ) % 1024; + ra->Msg4_slot = 1; + LOG_I(NR_MAC, "Scheduling RA-Msg4 for TC_RNTI %04x (state %d, frame %d, slot %d)\n", ra->rnti, ra->state, ra->Msg4_frame, ra->Msg4_slot); + + } + return; + + } + } + } else { + for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) { + NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i]; + if (ra->state != WAIT_Msg3) continue; - } - const int UE_id = add_new_nr_ue(gnb_mod_idP, ra->rnti, ra->secondaryCellGroup); - UE_info->UE_beam_index[UE_id] = ra->beam_id; - LOG_I(NR_MAC, - "[gNB %d][RAPROC] PUSCH with TC_RNTI %x received correctly, " - "adding UE MAC Context UE_id %d/RNTI %04x\n", - gnb_mod_idP, - current_rnti, - UE_id, - ra->rnti); - LOG_D(NR_MAC,"[RAPROC] Received Msg3:\n"); - for (int k = 0; k < sdu_lenP; k++) { - LOG_D(NR_MAC,"(%i): 0x%x\n",k,sduP[k]); - } - - // re-initialize ta update variables afrer RA procedure completion - UE_info->UE_sched_ctrl[UE_id].ta_frame = frameP; - - free(ra->preambles.preamble_list); - ra->state = RA_IDLE; - LOG_I(NR_MAC, - "reset RA state information for RA-RNTI %04x/index %d\n", - ra->rnti, - i); - - return; + LOG_W(NR_MAC, "Random Access %i failed at state %i\n", i, ra->state); + nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); + nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); } } } -long get_K2(NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu) { +long get_K2(const NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu) { DevAssert(ubwp); const NR_PUSCH_TimeDomainResourceAllocation_t *tda_list = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[time_domain_assignment]; if (tda_list->k2) @@ -518,6 +746,34 @@ long get_K2(NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu) { return 3; } +bool nr_UE_is_to_be_scheduled(module_id_t mod_id, int CC_id, int UE_id, frame_t frame, sub_frame_t slot) +{ + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon; + const uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160}; + const int n = slots_per_frame[*scc->ssbSubcarrierSpacing]; + const int now = frame * n + slot; + + const struct gNB_MAC_INST_s *nrmac = RC.nrmac[mod_id]; + const NR_UE_sched_ctrl_t *sched_ctrl = &nrmac->UE_info.UE_sched_ctrl[UE_id]; + const int last_ul_sched = sched_ctrl->last_ul_frame * n + sched_ctrl->last_ul_slot; + + const int diff = (now - last_ul_sched + 1024 * n) % (1024 * n); + /* UE is to be scheduled if + * (1) we think the UE has more bytes awaiting than what we scheduled + * (2) there is a scheduling request + * (3) or we did not schedule it in more than 10 frames */ + const bool has_data = sched_ctrl->estimated_ul_buffer > sched_ctrl->sched_ul_bytes; + const bool high_inactivity = diff >= nrmac->ulsch_max_slots_inactivity; + LOG_D(MAC, + "%4d.%2d UL inactivity %d slots has_data %d SR %d\n", + frame, + slot, + diff, + has_data, + sched_ctrl->SR); + return has_data || sched_ctrl->SR || high_inactivity; +} + int next_list_entry_looped(NR_list_t *list, int UE_id) { if (UE_id < 0) @@ -525,121 +781,188 @@ int next_list_entry_looped(NR_list_t *list, int UE_id) return list->next[UE_id] < 0 ? list->head : list->next[UE_id]; } +bool allocate_ul_retransmission(module_id_t module_id, + frame_t frame, + sub_frame_t slot, + uint8_t *rballoc_mask, + int *n_rb_sched, + int UE_id, + int harq_pid) +{ + const int CC_id = 0; + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon; + NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; + NR_sched_pusch_t *retInfo = &sched_ctrl->ul_harq_processes[harq_pid].sched_pusch; + int rbStart = + NRRIV2PRBOFFSET(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const uint16_t bwpSize = + NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + + const uint8_t num_dmrs_cdm_grps_no_data = 1; + const int tda = RC.nrmac[module_id]->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot]; + if (tda == retInfo->time_domain_allocation) { + /* Check the resource is enough for retransmission */ + while (rbStart < bwpSize && !rballoc_mask[rbStart]) + rbStart++; + if (rbStart + retInfo->rbSize >= bwpSize) { + LOG_D(MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources\n", UE_id, UE_info->rnti[UE_id]); + return false; + } + /* check whether we need to switch the TDA allocation since tha last + * (re-)transmission */ + NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; + const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; + const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; + if (ps->time_domain_allocation != tda + || ps->dci_format != dci_format + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) + nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + LOG_D(MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); + } else { + /* the retransmission will use a different time domain allocation, check + * that we have enough resources */ + while (rbStart < bwpSize && !rballoc_mask[rbStart]) + rbStart++; + int rbSize = 0; + while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize]) + rbSize++; + NR_pusch_semi_static_t temp_ps; + const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; + const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; + nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps); + uint32_t new_tbs; + uint16_t new_rbSize; + bool success = nr_find_nb_rb(retInfo->Qm, + retInfo->R, + temp_ps.nrOfSymbols, + temp_ps.N_PRB_DMRS * temp_ps.num_dmrs_symb, + retInfo->tb_size, + rbSize, + &new_tbs, + &new_rbSize); + if (!success || new_tbs != retInfo->tb_size) { + LOG_D(MAC, "%s(): new TBsize %d of new TDA does not match old TBS %d\n", __func__, new_tbs, retInfo->tb_size); + return false; /* the maximum TBsize we might have is smaller than what we need */ + } + LOG_D(MAC, "%s(): retransmission with TDA %d->%d and TBS %d -> %d\n", __func__, retInfo->time_domain_allocation, tda, retInfo->tb_size, new_tbs); + /* we can allocate it. Overwrite the time_domain_allocation, the number + * of RBs, and the new TB size. The rest is done below */ + retInfo->tb_size = new_tbs; + retInfo->rbSize = new_rbSize; + retInfo->time_domain_allocation = tda; + sched_ctrl->pusch_semi_static = temp_ps; + } + + /* Find free CCE */ + bool freeCCE = find_free_CCE(module_id, slot, UE_id); + if (!freeCCE) { + LOG_D(MAC, "%4d.%2d no free CCE for retransmission UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); + return false; + } + + /* frame/slot in sched_pusch has been set previously. In the following, we + * overwrite the information in the retransmission information before storing + * as the new scheduling instruction */ + retInfo->frame = sched_ctrl->sched_pusch.frame; + retInfo->slot = sched_ctrl->sched_pusch.slot; + /* Get previous PSUCH field info */ + sched_ctrl->sched_pusch = *retInfo; + NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; + LOG_D(MAC, + "%4d.%2d Allocate UL retransmission UE %d/RNTI %04x sched %4d.%2d (%d RBs)\n", + frame, + slot, + UE_id, + UE_info->rnti[UE_id], + sched_pusch->frame, + sched_pusch->slot, + sched_pusch->rbSize); + + sched_pusch->rbStart = rbStart; + /* no need to recompute the TBS, it will be the same */ + + /* Mark the corresponding RBs as used */ + n_rb_sched -= sched_pusch->rbSize; + for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) + rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0; + return true; +} + +void update_ul_ue_R_Qm(NR_sched_pusch_t *sched_pusch, const NR_pusch_semi_static_t *ps) +{ + const int mcs = sched_pusch->mcs; + sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table); + sched_pusch->Qm = nr_get_Qm_ul(mcs, ps->mcs_table); + if (ps->pusch_Config->tp_pi2BPSK + && ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6))) { + sched_pusch->R >>= 1; + sched_pusch->Qm <<= 1; + } +} + float ul_thr_ue[MAX_MOBILES_PER_GNB]; -int bsr0ue = -1; +uint32_t ul_pf_tbs[3][28]; // pre-computed, approximate TBS values for PF coefficient void pf_ul(module_id_t module_id, frame_t frame, sub_frame_t slot, - int num_slots_per_tdd, NR_list_t *UE_list, + int max_num_ue, int n_rb_sched, - uint8_t *rballoc_mask, - int max_num_ue) { + uint8_t *rballoc_mask) { const int CC_id = 0; - const int tda = 1; - NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon; - NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; + const uint8_t num_dmrs_cdm_grps_no_data = 1; + gNB_MAC_INST *nrmac = RC.nrmac[module_id]; + NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; + NR_UE_info_t *UE_info = &nrmac->UE_info; const int min_rb = 5; float coeff_ue[MAX_MOBILES_PER_GNB]; // UEs that could be scheduled int ue_array[MAX_MOBILES_PER_GNB]; NR_list_t UE_sched = { .head = -1, .next = ue_array, .tail = -1, .len = MAX_MOBILES_PER_GNB }; - /* Hack: currently, we do not have SR, and need to schedule UEs continuously. - * To keep the wasted resources low, we switch UEs to be scheduled in a - * round-robin fashion below, and only schedule a UE with BSR=0 if it is the - * selected one */ - bsr0ue = next_list_entry_looped(UE_list, bsr0ue); - /* Loop UE_list to calculate throughput and coeff */ for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + int rbStart = + NRRIV2PRBOFFSET(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; + NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; /* Calculate throughput */ const float a = 0.0005f; // corresponds to 200ms window const uint32_t b = UE_info->mac_stats[UE_id].ulsch_current_bytes; ul_thr_ue[UE_id] = (1 - a) * ul_thr_ue[UE_id] + a * b; - /* Save PUSCH field */ - /* we want to avoid a lengthy deduction of DMRS and other parameters in - * every TTI if we can save it, so check whether dci_format, TDA, or - * num_dmrs_cdm_grps_no_data has changed and only then recompute */ - sched_ctrl->sched_pusch.time_domain_allocation = tda; - sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, NR_SearchSpace__searchSpaceType_PR_ue_Specific); - sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); - const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; - const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; - const uint8_t num_dmrs_cdm_grps_no_data = 1; - NR_sched_pusch_save_t *ps = &sched_ctrl->pusch_save; - if (ps->time_domain_allocation != tda - || ps->dci_format != dci_format - || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) - nr_save_pusch_fields(scc, sched_ctrl->active_ubwp, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); - /* Check if retransmission is necessary */ - sched_ctrl->sched_pusch.ul_harq_pid = sched_ctrl->retrans_ul_harq.head; - if (sched_ctrl->sched_pusch.ul_harq_pid >= 0) { - /* RETRANSMISSION: Allocate retransmission*/ - /* Find free CCE */ - bool freeCCE = find_free_CCE(module_id, slot, UE_id); - if (!freeCCE) { - LOG_D(MAC, "%4d.%2d no free CCE for retransmission UL DCI UE %04x\n", frame, slot, UE_info->rnti[UE_id]); + sched_pusch->ul_harq_pid = sched_ctrl->retrans_ul_harq.head; + if (sched_pusch->ul_harq_pid >= 0) { + /* Allocate retransmission*/ + bool r = allocate_ul_retransmission( + module_id, frame, slot, rballoc_mask, &n_rb_sched, UE_id, sched_pusch->ul_harq_pid); + if (!r) { + LOG_D(MAC, "%4d.%2d UL retransmission UE RNTI %04x can NOT be allocated\n", frame, slot, UE_info->rnti[UE_id]); continue; } /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ max_num_ue--; if (max_num_ue < 0) return; - - /* Save shced_frame and sched_slot before overwrite by previous PUSCH filed */ - NR_UE_ul_harq_t *cur_harq = &sched_ctrl->ul_harq_processes[sched_ctrl->sched_pusch.ul_harq_pid]; - cur_harq->sched_pusch.frame = sched_ctrl->sched_pusch.frame; - cur_harq->sched_pusch.slot = sched_ctrl->sched_pusch.slot; - /* Get previous PSUCH filed info */ - sched_ctrl->sched_pusch = cur_harq->sched_pusch; - NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; - LOG_D(MAC, "%4d.%2d Allocate UL retransmission UE %d/RNTI %04x sched %4d.%2d (%d RBs)\n", - frame, slot, UE_id, UE_info->rnti[UE_id], - sched_pusch->frame, sched_pusch->slot, - sched_pusch->rbSize); - - while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; - if (rbStart + sched_pusch->rbSize >= bwpSize) { - LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources\n", - UE_id, UE_info->rnti[UE_id]); - return; - } - sched_pusch->rbStart = rbStart; - /* no need to recompute the TBS, it will be the same */ - - /* Mark the corresponding RBs as used */ - n_rb_sched -= sched_pusch->rbSize; - for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) - rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0; - continue; } - /* Calculate TBS from MCS */ - NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; - const int mcs = 9; - sched_pusch->mcs = mcs; - sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table); - sched_pusch->Qm = nr_get_Qm_ul(mcs, ps->mcs_table); - if (ps->pusch_Config->tp_pi2BPSK - && ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6))) { - sched_pusch->R >>= 1; - sched_pusch->Qm <<= 1; - } + const int B = max(0, sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes); + /* preprocessor computed sched_frame/sched_slot */ + const bool do_sched = nr_UE_is_to_be_scheduled(module_id, 0, UE_id, sched_pusch->frame, sched_pusch->slot); - /* Check BSR and schedule UE if it is zero to avoid starvation, since we do - * not have SR (yet) */ - if (sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes <= 0) { - if (UE_id != bsr0ue) - continue; + if (B == 0 && !do_sched) + continue; + + /* Schedule UE on SR or UL inactivity and no data (otherwise, will be scheduled + * based on data to transmit) */ + if (B == 0 && do_sched) { /* if no data, pre-allocate 5RB */ bool freeCCE = find_free_CCE(module_id, slot, UE_id); if (!freeCCE) { @@ -653,10 +976,25 @@ void pf_ul(module_id_t module_id, while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; if (rbStart + min_rb >= bwpSize) { - LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources\n", + LOG_D(MAC, "cannot allocate continuous data for UE %d/RNTI %04x: no resources\n", UE_id, UE_info->rnti[UE_id]); - return; + continue; } + + /* Save PUSCH field */ + /* we want to avoid a lengthy deduction of DMRS and other parameters in + * every TTI if we can save it, so check whether dci_format, TDA, or + * num_dmrs_cdm_grps_no_data has changed and only then recompute */ + const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; + const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; + const int tda = nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot]; + if (ps->time_domain_allocation != tda + || ps->dci_format != dci_format + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) + nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; + sched_pusch->mcs = 9; + update_ul_ue_R_Qm(sched_pusch, ps); sched_pusch->rbStart = rbStart; sched_pusch->rbSize = min_rb; sched_pusch->tb_size = nr_compute_tbs(sched_pusch->Qm, @@ -681,15 +1019,8 @@ void pf_ul(module_id_t module_id, add_tail_nr_list(&UE_sched, UE_id); /* Calculate coefficient*/ - const uint32_t tbs = nr_compute_tbs(sched_pusch->Qm, - sched_pusch->R, - 1, // rbSize - ps->nrOfSymbols, - ps->N_PRB_DMRS * ps->num_dmrs_symb, - 0, // nb_rb_oh - 0, - 1 /* NrOfLayers */) - >> 3; + sched_pusch->mcs = 9; + const uint32_t tbs = ul_pf_tbs[ps->mcs_table][sched_pusch->mcs]; coeff_ue[UE_id] = (float) tbs / ul_thr_ue[UE_id]; LOG_D(MAC,"b %d, ul_thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n", b, UE_id, ul_thr_ue[UE_id], tbs, UE_id, coeff_ue[UE_id]); @@ -728,35 +1059,45 @@ void pf_ul(module_id_t module_id, NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + /* for some reason, the UEs do not like when they are scheduled on the last + * RB. Hence, as a (hopefully temporary) fix, schedule one RB less. */ + const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) - 1; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; - + NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; sched_pusch->rbStart = rbStart; - if (rbStart + min_rb >= bwpSize) { - LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources\n", - UE_id, UE_info->rnti[UE_id]); - return; - } + uint16_t max_rbSize = 1; + while (rbStart + max_rbSize < bwpSize && rballoc_mask[rbStart + max_rbSize]) + max_rbSize++; - /* Calculate the current scheduling bytes */ + /* Save PUSCH field */ + /* we want to avoid a lengthy deduction of DMRS and other parameters in + * every TTI if we can save it, so check whether dci_format, TDA, or + * num_dmrs_cdm_grps_no_data has changed and only then recompute */ + const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; + const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0; + const int tda = nrmac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot]; + if (ps->time_domain_allocation != tda + || ps->dci_format != dci_format + || ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data) + nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, dci_format, tda, num_dmrs_cdm_grps_no_data, ps); + update_ul_ue_R_Qm(sched_pusch, ps); + + /* Calculate the current scheduling bytes and the necessary RBs */ const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0); - uint16_t rbSize = min_rb - 1; - do { - rbSize++; - sched_pusch->rbSize = rbSize; - sched_pusch->tb_size = nr_compute_tbs(sched_pusch->Qm, - sched_pusch->R, - sched_pusch->rbSize, - sched_ctrl->pusch_save.nrOfSymbols, - sched_ctrl->pusch_save.N_PRB_DMRS * sched_ctrl->pusch_save.num_dmrs_symb, - 0, // nb_rb_oh - 0, - 1 /* NrOfLayers */) - >> 3; - } while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart+rbSize] && - sched_pusch->tb_size < B); + uint16_t rbSize = 0; + uint32_t TBS = 0; + nr_find_nb_rb(sched_pusch->Qm, + sched_pusch->R, + ps->nrOfSymbols, + ps->N_PRB_DMRS * ps->num_dmrs_symb, + B, + max_rbSize, + &TBS, + &rbSize); + sched_pusch->rbSize = rbSize; + sched_pusch->tb_size = TBS; LOG_D(MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d\n", rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B); @@ -767,11 +1108,8 @@ void pf_ul(module_id_t module_id, } } -bool nr_simple_ulsch_preprocessor(module_id_t module_id, - frame_t frame, - sub_frame_t slot, - int num_slots_per_tdd, - uint64_t ulsch_in_slot_bitmap) { +bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) +{ gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; NR_COMMON_channels_t *cc = nr_mac->common_channels; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; @@ -783,45 +1121,47 @@ bool nr_simple_ulsch_preprocessor(module_id_t module_id, const int CC_id = 0; - /* NOT support different K2 in here, Get the K2 for first UE */ + /* Get the K2 for first UE to compute offset. The other UEs are guaranteed to + * have the same K2 (we don't support multiple/different K2s via different + * TDAs yet). If the TDA is negative, it means that there is no UL slot to + * schedule now (slot + k2 is not UL slot) */ int UE_id = UE_info->list.head; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - const int tda = 1; - const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = - sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; - AssertFatal(tda < tdaList->list.count, - "time domain assignment %d >= %d\n", - tda, - tdaList->list.count); - + const int tda = nr_mac->preferred_ul_tda[sched_ctrl->active_ubwp->bwp_Id][slot]; + if (tda < 0) + return false; int K2 = get_K2(sched_ctrl->active_ubwp, tda, mu); const int sched_frame = frame + (slot + K2 >= nr_slots_per_frame[mu]); const int sched_slot = (slot + K2) % nr_slots_per_frame[mu]; - if (!is_xlsch_in_slot(ulsch_in_slot_bitmap, sched_slot)) + if (!is_xlsch_in_slot(nr_mac->ulsch_slot_bitmap[sched_slot / 64], sched_slot)) return false; sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.frame = sched_frame; - - /* Confirm all the UE have same K2 as the first UE */ for (UE_id = UE_info->list.next[UE_id]; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; - AssertFatal(K2 == get_K2(sched_ctrl->active_ubwp, tda, mu), - "Different K2, %d(UE%d) != %ld(UE%d)\n", K2, 0, get_K2(sched_ctrl->active_ubwp, tda, mu), UE_id); sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.frame = sched_frame; } - /* Change vrb_map_UL to rballoc_mask */ + /* Change vrb_map_UL to rballoc_mask: check which symbols per RB (in + * vrb_map_UL) overlap with the "default" tda and exclude those RBs. + * Calculate largest contiguous RBs */ uint16_t *vrb_map_UL = &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); + const struct NR_PUSCH_TimeDomainResourceAllocationList *tdaList = + sched_ctrl->active_ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList; + const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; + int startSymbolIndex, nrOfSymbols; + SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); + const uint16_t symb = ((1 << nrOfSymbols) - 1) << startSymbolIndex; int st = 0, e = 0, len = 0; for (int i = 0; i < bwpSize; i++) { - while (vrb_map_UL[i] == 1) + while ((vrb_map_UL[i] & symb) != 0 && i < bwpSize) i++; st = i; - while (vrb_map_UL[i] == 0) + while ((vrb_map_UL[i] & symb) == 0 && i < bwpSize) i++; if (i - st > len) { len = i - st; @@ -840,28 +1180,53 @@ bool nr_simple_ulsch_preprocessor(module_id_t module_id, pf_ul(module_id, frame, slot, - num_slots_per_tdd, &UE_info->list, + 2, len, - rballoc_mask, - 2); + rballoc_mask); return true; } -void nr_schedule_ulsch(module_id_t module_id, - frame_t frame, - sub_frame_t slot, - int num_slots_per_tdd, - int ul_slots, - uint64_t ulsch_in_slot_bitmap) { +nr_pp_impl_ul nr_init_fr1_ulsch_preprocessor(module_id_t module_id, int CC_id) +{ + /* in the PF algorithm, we have to use the TBsize to compute the coefficient. + * This would include the number of DMRS symbols, which in turn depends on + * the time domain allocation. In case we are in a mixed slot, we do not want + * to recalculate all these values, and therefore we provide a look-up table + * which should approximately(!) give us the TBsize. In particular, the + * number of symbols, the number of DMRS symbols, and the exact Qm and R, are + * not correct*/ + for (int mcsTableIdx = 0; mcsTableIdx < 3; ++mcsTableIdx) { + for (int mcs = 0; mcs < 29; ++mcs) { + if (mcs > 27 && mcsTableIdx == 1) + continue; + const uint8_t Qm = nr_get_Qm_dl(mcs, mcsTableIdx); + const uint16_t R = nr_get_code_rate_dl(mcs, mcsTableIdx); + /* note: we do not update R/Qm based on low MCS or pi2BPSK */ + ul_pf_tbs[mcsTableIdx][mcs] = nr_compute_tbs(Qm, + R, + 1, /* rbSize */ + 10, /* hypothetical number of slots */ + 0, /* N_PRB_DMRS * N_DMRS_SLOT */ + 0 /* N_PRB_oh, 0 for initialBWP */, + 0 /* tb_scaling */, + 1 /* nrOfLayers */) + >> 3; + } + } + return nr_fr1_ulsch_preprocessor; +} + +void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) +{ + gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; /* Uplink data ONLY can be scheduled when the current slot is downlink slot, * because we have to schedule the DCI0 first before schedule uplink data */ - if (is_xlsch_in_slot(ulsch_in_slot_bitmap, slot)) { + if (!is_xlsch_in_slot(nr_mac->dlsch_slot_bitmap[slot / 64], slot)) { LOG_D(MAC, "Current slot %d is NOT DL slot, cannot schedule DCI0 for UL data\n", slot); return; } - bool do_sched = RC.nrmac[module_id]->pre_processor_ul( - module_id, frame, slot, num_slots_per_tdd, ulsch_in_slot_bitmap); + bool do_sched = RC.nrmac[module_id]->pre_processor_ul(module_id, frame, slot); if (!do_sched) return; @@ -880,6 +1245,7 @@ void nr_schedule_ulsch(module_id_t module_id, for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; UE_info->mac_stats[UE_id].ulsch_current_bytes = 0; + /* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in * every TTI are pre-populated by the preprocessor and used below */ NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; @@ -887,6 +1253,7 @@ void nr_schedule_ulsch(module_id_t module_id, continue; uint16_t rnti = UE_info->rnti[UE_id]; + sched_ctrl->SR = false; int8_t harq_id = sched_pusch->ul_harq_pid; if (NFAPI_MODE == NFAPI_MODE_VNF) @@ -926,8 +1293,8 @@ void nr_schedule_ulsch(module_id_t module_id, /* pre-computed PUSCH values that only change if time domain allocation, * DCI format, or DMRS parameters change. Updated in the preprocessor - * through nr_save_pusch_fields() */ - NR_sched_pusch_save_t *ps = &sched_ctrl->pusch_save; + * through nr_set_pusch_semi_static() */ + NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static; /* Statistics */ UE_info->mac_stats[UE_id].ulsch_rounds[cur_harq->round]++; @@ -936,6 +1303,9 @@ void nr_schedule_ulsch(module_id_t module_id, /* Save information on MCS, TBS etc for the current initial transmission * so we have access to it when retransmitting */ cur_harq->sched_pusch = *sched_pusch; + /* save which time allocation has been used, to be used on + * retransmissions */ + cur_harq->sched_pusch.time_domain_allocation = ps->time_domain_allocation; sched_ctrl->sched_ul_bytes += sched_pusch->tb_size; } else { LOG_D(MAC, @@ -950,9 +1320,11 @@ void nr_schedule_ulsch(module_id_t module_id, cur_harq->ndi); } UE_info->mac_stats[UE_id].ulsch_current_bytes = sched_pusch->tb_size; + sched_ctrl->last_ul_frame = sched_pusch->frame; + sched_ctrl->last_ul_slot = sched_pusch->slot; LOG_D(MAC, - "%4d.%2d RNTI %04x UL sched %4d.%2d start %d RBS %d MCS %d TBS %d HARQ PID %d round %d NDI %d\n", + "%4d.%2d RNTI %04x UL sched %4d.%2d start %2d RBS %3d startSymbol %2d nb_symbol %2d MCS %2d TBS %4d HARQ PID %2d round %d NDI %d est %6d sched %6d est BSR %6d\n", frame, slot, rnti, @@ -960,11 +1332,17 @@ void nr_schedule_ulsch(module_id_t module_id, sched_pusch->slot, sched_pusch->rbStart, sched_pusch->rbSize, + ps->startSymbolIndex, + ps->nrOfSymbols, sched_pusch->mcs, sched_pusch->tb_size, harq_id, cur_harq->round, - cur_harq->ndi); + cur_harq->ndi, + sched_ctrl->estimated_ul_buffer, + sched_ctrl->sched_ul_bytes, + sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes); + /* PUSCH in a later slot, but corresponding DCI now! */ nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][sched_pusch->slot]; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index c1c7278338..1010ebafda 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -41,13 +41,16 @@ void set_cset_offset(uint16_t); void mac_top_init_gNB(void); void config_common(int Mod_idP, + int ssb_SubcarrierOffset, int pdsch_AntennaPorts, + int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc ); -int rrc_mac_config_req_gNB(module_id_t Mod_idP, - int ssb_SubcarrierOffset, +int rrc_mac_config_req_gNB(module_id_t Mod_idP, + int ssb_SubcarrierOffset, int pdsch_AntennaPorts, + int pusch_AntennaPorts, int pusch_tgt_snrx10, int pucch_tgt_snrx10, NR_ServingCellConfigCommon_t *scc, @@ -64,12 +67,19 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frame_rxP, sub_frame_t slot_rxP); +/* \brief main DL scheduler function. Calls a preprocessor to decide on + * resource allocation, then "post-processes" resource allocation (nFAPI + * messages, statistics, HARQ handling, CEs, ... */ void nr_schedule_ue_spec(module_id_t module_id, frame_t frame, sub_frame_t slot); +/* \brief default FR1 DL preprocessor init routine, returns preprocessor to call */ +nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(module_id_t module_id, int CC_id); + void schedule_control_sib1(module_id_t module_id, int CC_id, + NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, int time_domain_allocation, uint8_t mcsTableIdx, uint8_t mcs, @@ -78,26 +88,15 @@ void schedule_control_sib1(module_id_t module_id, void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP); -/* \brief default preprocessor */ -void nr_simple_dlsch_preprocessor(module_id_t module_id, - frame_t frame, - sub_frame_t slot); +void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); -void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, uint8_t slots_per_frame); +/* \brief main UL scheduler function. Calls a preprocessor to decide on + * resource allocation, then "post-processes" resource allocation (nFAPI + * messages, statistics, HARQ handling, ... */ +void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot); -/// uplink scheduler -void nr_schedule_ulsch(module_id_t module_id, - frame_t frame, - sub_frame_t slot, - int num_slots_per_tdd, - int ul_slots, - uint64_t ulsch_in_slot_bitmap); - -bool nr_simple_ulsch_preprocessor(module_id_t module_id, - frame_t frame, - sub_frame_t slot, - int num_slots_per_tdd, - uint64_t ulsch_in_slot_bitmap); +/* \brief default FR1 UL preprocessor init routine, returns preprocessor to call */ +nr_pp_impl_ul nr_init_fr1_ulsch_preprocessor(module_id_t module_id, int CC_id); /////// Random Access MAC-PHY interface functions and primitives /////// @@ -114,7 +113,7 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP); void nr_initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, uint16_t preamble_index, uint8_t freq_index, uint8_t symbol, int16_t timing_offset); -void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP); +void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra); int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only); @@ -124,7 +123,8 @@ void nr_get_Msg3alloc(module_id_t module_id, NR_BWP_Uplink_t *ubwp, sub_frame_t current_subframe, frame_t current_frame, - NR_RA_t *ra); + NR_RA_t *ra, + int16_t *tdd_beam_association); /* \brief Function in gNB to fill RAR pdu when requested by PHY. @param ra Instance of RA resources of gNB @@ -150,11 +150,7 @@ void nr_preprocessor_phytest(module_id_t module_id, sub_frame_t slot); /* \brief UL preprocessor for phytest: schedules UE_id 0 with fixed MCS on a * fixed set of resources */ -bool nr_ul_preprocessor_phytest(module_id_t module_id, - frame_t frame, - sub_frame_t slot, - int num_slots_per_tdd, - uint64_t ulsch_in_slot_bitmap); +bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_t slot); void nr_schedule_css_dlsch_phytest(module_id_t module_idP, frame_t frameP, @@ -190,10 +186,10 @@ void nr_csi_meas_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP); -bool nr_acknack_scheduling(int Mod_idP, - int UE_id, - frame_t frameP, - sub_frame_t slotP); +int nr_acknack_scheduling(int Mod_idP, + int UE_id, + frame_t frameP, + sub_frame_t slotP); void get_pdsch_to_harq_feedback(int Mod_idP, int UE_id, @@ -253,24 +249,26 @@ void prepare_dci(const NR_CellGroupConfig_t *secondaryCellGroup, int bwp_id); /* find coreset within the search space */ -NR_ControlResourceSet_t *get_coreset(NR_BWP_Downlink_t *bwp, - NR_SearchSpace_t *ss, - int ss_type); +NR_ControlResourceSet_t *get_coreset(const NR_BWP_Downlink_t *bwp, const NR_SearchSpace_t *ss, int ss_type); /* find a search space within a BWP */ -NR_SearchSpace_t *get_searchspace( - NR_BWP_Downlink_t *bwp, - NR_SearchSpace__searchSpaceType_PR target_ss); +NR_SearchSpace_t *get_searchspace(const NR_BWP_Downlink_t *bwp, NR_SearchSpace__searchSpaceType_PR target_ss); +long get_K2(const NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu); -long get_K2(NR_BWP_Uplink_t *ubwp, int time_domain_assignment, int mu); +void nr_set_pdsch_semi_static(const NR_ServingCellConfigCommon_t *scc, + const NR_CellGroupConfig_t *secondaryCellGroup, + const NR_BWP_Downlink_t *bwp, + int tda, + uint8_t num_dmrs_cdm_grps_no_data, + NR_pdsch_semi_static_t *ps); -void nr_save_pusch_fields(const NR_ServingCellConfigCommon_t *scc, - const NR_BWP_Uplink_t *ubwp, - long dci_format, - int tda, - uint8_t num_dmrs_cdm_grps_no_data, - NR_sched_pusch_save_t *ps); +void nr_set_pusch_semi_static(const NR_ServingCellConfigCommon_t *scc, + const NR_BWP_Uplink_t *ubwp, + long dci_format, + int tda, + uint8_t num_dmrs_cdm_grps_no_data, + NR_pusch_semi_static_t *ps); uint8_t nr_get_tpc(int target, uint8_t cqi, int incr); @@ -312,6 +310,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *secon void mac_remove_nr_ue(module_id_t mod_id, rnti_t rnti); +void nr_mac_remove_ra_rnti(module_id_t mod_id, rnti_t rnti); + int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, NR_BWP_Downlink_t *bwp, NR_ControlResourceSet_t *coreset, @@ -347,21 +347,23 @@ void config_nr_mib(int Mod_idP, int cellBarred, int intraFreqReselection); +int nr_write_ce_dlsch_pdu(module_id_t module_idP, + const NR_UE_sched_ctrl_t *ue_sched_ctl, + unsigned char *mac_pdu, + unsigned char drx_cmd, + unsigned char *ue_cont_res_id); + void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra); -void nr_process_mac_pdu( - module_id_t module_idP, - rnti_t rnti, - uint8_t CC_id, - frame_t frameP, - uint8_t *pduP, - uint16_t mac_pdu_len); +void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP, NR_RA_t *ra); + +void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t slot, NR_RA_t *ra); int binomial(int n, int k); bool is_xlsch_in_slot(uint64_t bitmap, sub_frame_t slot); -void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, int CC_id); +void fill_ssb_vrb_map (NR_COMMON_channels_t *cc, int rbStart, uint16_t symStart, int CC_id); /* \brief Function to indicate a received SDU on ULSCH. @@ -398,5 +400,24 @@ int16_t ssb_index_from_prach(module_id_t module_idP, void find_SSB_and_RO_available(module_id_t module_idP); +void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp); +void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ubwp); + bool find_free_CCE(module_id_t module_id, sub_frame_t slot, int UE_id); + +bool nr_find_nb_rb(uint16_t Qm, + uint16_t R, + uint16_t nb_symb_sch, + uint16_t nb_dmrs_prb, + uint32_t bytes, + uint16_t nb_rb_max, + uint32_t *tbs, + uint16_t *nb_rb); + +void nr_sr_reporting(int Mod_idP, frame_t frameP, sub_frame_t slotP); + +void periodicity__SRR (NR_SchedulingRequestResourceConfig_t *SchedulingReqRecconf, + int *period, + int *offset); + #endif /*__LAYER2_NR_MAC_PROTO_H__*/ diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 33e575d2b9..60b0cac215 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -85,8 +85,8 @@ void mac_top_init_gNB(void) RC.nrmac[i]->pre_processor_dl = nr_preprocessor_phytest; RC.nrmac[i]->pre_processor_ul = nr_ul_preprocessor_phytest; } else { - RC.nrmac[i]->pre_processor_dl = nr_simple_dlsch_preprocessor; - RC.nrmac[i]->pre_processor_ul = nr_simple_ulsch_preprocessor; + RC.nrmac[i]->pre_processor_dl = nr_init_fr1_dlsch_preprocessor(i, 0); + RC.nrmac[i]->pre_processor_ul = nr_init_fr1_ulsch_preprocessor(i, 0); } }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index ac583b5270..c1ec27580f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -305,11 +305,11 @@ typedef struct NR_sched_pucch { uint8_t resource_indicator; } NR_sched_pucch_t; -/* this struct is a helper: as long as the TDA and DCI format remain the same - * over the same uBWP and search space, there is no need to recalculate all - * S/L, MCS table, or DMRS-related parameters over and over again. Hence, we - * store them in this struct for easy reference. */ -typedef struct NR_sched_pusch_save { +/* PUSCH semi-static configuration: as long as the TDA and DCI format remain + * the same over the same uBWP and search space, there is no need to + * recalculate all S/L, MCS table, or DMRS-related parameters over and over + * again. Hence, we store them in this struct for easy reference. */ +typedef struct NR_pusch_semi_static_t { int dci_format; int time_domain_allocation; uint8_t num_dmrs_cdm_grps_no_data; @@ -327,7 +327,7 @@ typedef struct NR_sched_pusch_save { uint16_t ul_dmrs_symb_pos; uint8_t num_dmrs_symb; uint8_t N_PRB_DMRS; -} NR_sched_pusch_save_t; +} NR_pusch_semi_static_t; typedef struct NR_sched_pusch { int frame; @@ -337,9 +337,6 @@ typedef struct NR_sched_pusch { uint16_t rbSize; uint16_t rbStart; - // time-domain allocation for scheduled RBs - int time_domain_allocation; - /// MCS uint8_t mcs; @@ -350,17 +347,71 @@ typedef struct NR_sched_pusch { /// UL HARQ PID to use for this UE, or -1 for "any new" int8_t ul_harq_pid; + + /// the Time Domain Allocation used for this transmission. Note that this is + /// only important for retransmissions; otherwise, the TDA in + /// NR_pusch_semi_static_t has precedence + int time_domain_allocation; } NR_sched_pusch_t; +/* PDSCH semi-static configuratio: as long as the TDA/DMRS/mcsTable remains the + * same, there is no need to recalculate all S/L or DMRS-related parameters + * over and over again. Hence, we store them in this struct for easy + * reference. */ +typedef struct NR_pdsch_semi_static { + int time_domain_allocation; + uint8_t numDmrsCdmGrpsNoData; + + int startSymbolIndex; + int nrOfSymbols; + + uint8_t mcsTableIdx; + + uint8_t N_PRB_DMRS; + uint8_t N_DMRS_SLOT; + uint16_t dl_dmrs_symb_pos; + nfapi_nr_dmrs_type_e dmrsConfigType; +} NR_pdsch_semi_static_t; + +typedef struct NR_sched_pdsch { + /// RB allocation within active BWP + uint16_t rbSize; + uint16_t rbStart; + + /// MCS-related infos + uint8_t mcs; + + /// TBS-related info + uint16_t R; + uint8_t Qm; + uint32_t tb_size; + + /// DL HARQ PID to use for this UE, or -1 for "any new" + int8_t dl_harq_pid; + + // pucch format allocation + uint8_t pucch_allocation; + + /// the Time Domain Allocation used for this transmission. Note that this is + /// only important for retransmissions; otherwise, the TDA in + /// NR_pdsch_semi_static_t has precedence + int time_domain_allocation; +} NR_sched_pdsch_t; + typedef struct NR_UE_harq { bool is_waiting; uint8_t ndi; uint8_t round; + uint16_t feedback_frame; uint16_t feedback_slot; - /* Transport block to be sent using this HARQ process */ + /* Transport block to be sent using this HARQ process, its size is in + * sched_pdsch */ uint32_t tb[16384]; uint32_t tb_size; + + /// sched_pdsch keeps information on MCS etc used for the initial transmission + NR_sched_pdsch_t sched_pdsch; } NR_UE_harq_t; //! fixme : need to enhace for the multiple TB CQI report @@ -441,13 +492,6 @@ typedef struct nr_csi_report { From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 */ #define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 -typedef struct NR_UE_old_sched { - uint16_t rbSize; - int time_domain_allocation; - uint8_t mcsTableIdx; - uint8_t mcs; - uint8_t numDmrsCdmGrpsNoData; -} NR_UE_ret_info_t; typedef enum { INACTIVE = 0, @@ -468,61 +512,63 @@ typedef struct NR_UE_ul_harq { /*! \brief scheduling control information set through an API */ #define MAX_CSI_REPORTS 48 typedef struct { - /// total amount of data awaiting for this UE - uint32_t num_total_bytes; - /// per-LC status data - mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID]; - /// the currently active BWP in DL NR_BWP_Downlink_t *active_bwp; /// the currently active BWP in UL NR_BWP_Uplink_t *active_ubwp; - - /// PUCCH scheduling information. Array of three, we assume for the moment: - /// HARQ in the first field, SR in second, CSI in third (as fixed by RRC - /// conf., i.e. if actually present). The order is important for - /// nr_acknack_scheduling()! - NR_sched_pucch_t sched_pucch[3]; - - NR_sched_pusch_save_t pusch_save; - NR_sched_pusch_t sched_pusch; - /// CCE index and aggregation, should be coherent with cce_list NR_SearchSpace_t *search_space; NR_ControlResourceSet_t *coreset; + + /// CCE index and Aggr. Level are shared for PUSCH/PDSCH allocation decisions + /// corresponding to the sched_pusch/sched_pdsch structures below int cce_index; uint8_t aggregation_level; - /// RB allocation within active BWP - uint16_t rbSize; - uint16_t rbStart; + /// PUCCH scheduling information. Array of two: HARQ+SR in the first field, + /// CSI in second. This order is important for nr_acknack_scheduling()! + NR_sched_pucch_t sched_pucch[2]; + + /// PUSCH semi-static configuration: is not cleared across TTIs + NR_pusch_semi_static_t pusch_semi_static; + /// Sched PDSCH: scheduling decisions, copied into HARQ and cleared every TTI + NR_sched_pusch_t sched_pusch; /// uplink bytes that are currently scheduled int sched_ul_bytes; /// estimation of the UL buffer size int estimated_ul_buffer; - // time-domain allocation for scheduled RBs - int time_domain_allocation; + /// PHR info: power headroom level (dB) + int ph; + /// PHR info: nominal UE transmit power levels (dBm) + int pcmax; - /// MCS-related infos - uint8_t mcsTableIdx; - uint8_t mcs; - uint8_t numDmrsCdmGrpsNoData; + /// PDSCH semi-static configuration: is not cleared across TTIs + NR_pdsch_semi_static_t pdsch_semi_static; + /// Sched PDSCH: scheduling decisions, copied into HARQ and cleared every TTI + NR_sched_pdsch_t sched_pdsch; + /// For UL synchronization: store last UL scheduling grant + frame_t last_ul_frame; + sub_frame_t last_ul_slot; - /// Retransmission-related information - NR_UE_ret_info_t retInfo[NR_MAX_NB_HARQ_PROCESSES]; - /// DL HARQ PID to use for this UE, or -1 for "any new" - int8_t dl_harq_pid; + /// total amount of data awaiting for this UE + uint32_t num_total_bytes; + /// per-LC status data + mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID]; uint16_t ta_frame; int16_t ta_update; bool ta_apply; uint8_t tpc0; uint8_t tpc1; - uint16_t ul_rssi; - uint8_t current_harq_pid; + int raw_rssi; + int pusch_snrx10; + int pucch_snrx10; + struct CSI_Report CSI_report[MAX_CSI_REPORTS]; + bool SR; + /// information about every HARQ process NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES]; /// HARQ processes that are free @@ -539,7 +585,6 @@ typedef struct { NR_list_t feedback_ul_harq; /// UL HARQ processes that await retransmission NR_list_t retrans_ul_harq; - int dummy; NR_UE_mac_ce_ctrl_t UE_mac_ce_ctrl;// MAC CE related information } NR_UE_sched_ctrl_t; @@ -591,9 +636,7 @@ typedef void (*nr_pp_impl_dl)(module_id_t mod_id, sub_frame_t slot); typedef bool (*nr_pp_impl_ul)(module_id_t mod_id, frame_t frame, - sub_frame_t slot, - int num_slots_per_tdd, - uint64_t ulsch_in_slot_bitmap); + sub_frame_t slot); /*! \brief top level eNB MAC structure */ typedef struct gNB_MAC_INST_s { @@ -611,6 +654,8 @@ typedef struct gNB_MAC_INST_s { int pusch_target_snrx10; /// Pucch target SNR int pucch_target_snrx10; + /// Subcarrier Offset + int ssb_SubcarrierOffset; /// Common cell resources NR_COMMON_channels_t common_channels[NFAPI_CC_MAX]; /// current PDU index (BCH,DLSCH) @@ -664,10 +709,23 @@ typedef struct gNB_MAC_INST_s { time_stats_t schedule_pch; /// CCE lists int cce_list[MAX_NUM_BWP][MAX_NUM_CORESET][MAX_NUM_CCE]; - /// PUCCH: keep track of the resources has already been used by saving the - /// highest index not yet been used in a given slot. Dynamically allocated - /// so we can have it for every slot as a function of the numerology - int *pucch_index_used[MAX_NUM_BWP]; + /// list of allocated beams per period + int16_t *tdd_beam_association; + + /// bitmap of DLSCH slots, can hold up to 160 slots + uint64_t dlsch_slot_bitmap[3]; + /// Lookup for preferred time domain allocation for BWP, in DL, slots + /// dynamically allocated + int *preferred_dl_tda[MAX_NUM_BWP]; + /// bitmap of ULSCH slots, can hold up to 160 slots + uint64_t ulsch_slot_bitmap[3]; + /// Lookup for preferred time domain allocation for UL BWP, dynamically + /// allocated. The index refers to the DL slot, and the indicated TDA's k2 + /// points to the right UL slot + int *preferred_ul_tda[MAX_NUM_BWP]; + + /// maximum number of slots before a UE will be scheduled ULSCH automatically + uint32_t ulsch_max_slots_inactivity; /// DL preprocessor for differentiated scheduling nr_pp_impl_dl pre_processor_dl; @@ -676,7 +734,7 @@ typedef struct gNB_MAC_INST_s { NR_UE_sched_ctrl_t *sched_ctrlCommon; NR_CellGroupConfig_t *secondaryCellGroupCommon; - NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config; + NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config[64]; } gNB_MAC_INST; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index ee2711c6ef..51d3cfc8f3 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -57,10 +57,11 @@ #include "openair2/RRC/NAS/nas_config.h" #include "intertask_interface.h" #include "openair3/S1AP/s1ap_eNB.h" - +#include # include "gtpv1u_eNB_task.h" # include "gtpv1u.h" +#include #include "ENB_APP/enb_config.h" @@ -83,9 +84,94 @@ hash_table_t *pdcp_coll_p = NULL; static int mbms_socket = -1; #endif +uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +int pdcp_pc5_sockfd; +struct sockaddr_in prose_ctrl_addr; +struct sockaddr_in prose_pdcp_addr; +struct sockaddr_in pdcp_sin; /* pdcp module parameters and related functions*/ static pdcp_params_t pdcp_params= {0,NULL}; +rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; +rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode +unsigned int pdcp_eNB_UE_instance_to_rnti_index; + +signed int pdcp_2_nas_irq; +pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB]; +pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; + +static pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +static pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +static sdu_size_t pdcp_input_sdu_remaining_size_to_read; +static sdu_size_t pdcp_output_header_bytes_to_write; +static sdu_size_t pdcp_output_sdu_bytes_to_write; +notifiedFIFO_t pdcp_sdu_list; + +pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; + + +extern volatile int oai_exit; + +pthread_t pdcp_stats_thread_desc; + +void *pdcp_stats_thread(void *param) { + + FILE *fd; + int old_byte_cnt[MAX_MOBILES_PER_ENB][NB_RB_MAX],old_byte_cnt_rx[MAX_MOBILES_PER_ENB][NB_RB_MAX]; + for (int i=0;i0) { + fprintf(fd,"PDCP: CRNTI %x, DRB %d: tx_bytes %d, DL Throughput %e\n", + pdcp_enb[0].rnti[UE_id],drb_id, + Pdcp_stats_tx_bytes[0][UE_id][drb_id], + (double)((Pdcp_stats_tx_bytes[0][UE_id][drb_id]-old_byte_cnt[UE_id][drb_id])<<3)); + fprintf(fd," rx_bytes %d, UL Throughput %e\n", + Pdcp_stats_rx_bytes[0][UE_id][drb_id], + (double)((Pdcp_stats_rx_bytes[0][UE_id][drb_id]-old_byte_cnt_rx[UE_id][drb_id])<<3)); + old_byte_cnt[UE_id][drb_id]=Pdcp_stats_tx_bytes[0][UE_id][drb_id]; + old_byte_cnt_rx[UE_id][drb_id]=Pdcp_stats_rx_bytes[0][UE_id][drb_id]; + } + } + fclose(fd); + } + return(NULL); +} uint64_t get_pdcp_optmask(void) { return pdcp_params.optmask; @@ -467,7 +553,7 @@ boolean_t pdcp_data_req( break; } - //LOG_I(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, rb_idP+rb_offset, current_sn); + LOG_D(PDCP,"ueid %d lcid %d tx seq num %d\n", pdcp_uid, (int)(rb_idP+rb_offset), current_sn); Pdcp_stats_tx[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; Pdcp_stats_tx_tmp_w[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]++; Pdcp_stats_tx_bytes[ctxt_pP->module_id][pdcp_uid][rb_idP+rb_offset]+=sdu_buffer_sizeP; @@ -937,7 +1023,7 @@ pdcp_data_ind( GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rnti = ctxt_pP->rnti; GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).rab_id = rb_id + 4; - itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); + itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); packet_forwarded = TRUE; } } else { @@ -2296,6 +2382,8 @@ uint64_t pdcp_module_init( uint64_t pdcp_optmask ) { LOG_E(PDCP, "ENB pdcp will not use tun interface\n"); } + pthread_create(&pdcp_stats_thread_desc,NULL,pdcp_stats_thread,NULL); + return pdcp_params.optmask ; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index c8ab4499ee..0c3dd2f04f 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -91,34 +91,34 @@ extern int pdcp_instance_cnt; int init_pdcp_thread(void); void cleanup_pdcp_thread(void); -uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +extern uint32_t Pdcp_stats_tx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_throughput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_tx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; -uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; -uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_window_ms[MAX_eNB][MAX_MOBILES_PER_ENB]; +extern uint32_t Pdcp_stats_rx[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_bytes[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_bytes_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_bytes_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_sn[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_goodput_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_aiat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_aiat_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_aiat_tmp_w[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_iat[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; +extern uint32_t Pdcp_stats_rx_outoforder[MAX_eNB][MAX_MOBILES_PER_ENB][NB_RB_MAX]; void pdcp_update_perioidical_stats(const protocol_ctxt_t *const ctxt_pP); @@ -138,7 +138,7 @@ typedef struct pdcp_enb_s { } pdcp_enb_t; -pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; +extern pdcp_enb_t pdcp_enb[MAX_NUM_CCs]; typedef struct pdcp_stats_s { time_stats_t pdcp_run; @@ -242,17 +242,18 @@ typedef struct pdcp_mbms_s { * \note None * @ingroup _pdcp */ + boolean_t pdcp_data_req( protocol_ctxt_t *ctxt_pP, const srb_flag_t srb_flagP, const rb_id_t rb_id, const mui_t muiP, - const confirm_t confirmP, \ + const confirm_t confirmP, const sdu_size_t sdu_buffer_size, unsigned char *const sdu_buffer, const pdcp_transmission_mode_t mode, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id + const uint32_t * sourceL2Id, + const uint32_t * destinationL2Id ); /*! \fn boolean_t pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t) @@ -455,10 +456,10 @@ struct pdcp_netlink_element_s { //TTN for D2D (PC5S) #define PDCP_SOCKET_PORT_NO 9999 //temporary value #define PC5_SIGNALLING_PAYLOAD_SIZE 100 //should be updated with a correct value -int pdcp_pc5_sockfd; -struct sockaddr_in prose_ctrl_addr; -struct sockaddr_in prose_pdcp_addr; -struct sockaddr_in pdcp_sin; +extern int pdcp_pc5_sockfd; +extern struct sockaddr_in prose_ctrl_addr; +extern struct sockaddr_in prose_pdcp_addr; +extern struct sockaddr_in pdcp_sin; void pdcp_pc5_socket_init(void); typedef struct { @@ -500,28 +501,18 @@ typedef struct { #define REORDERING_WINDOW_SN_7BIT 64 #define REORDERING_WINDOW_SN_12BIT 2048 -signed int pdcp_2_nas_irq; -pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB]; -pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; +extern signed int pdcp_2_nas_irq; +extern pdcp_stats_t UE_pdcp_stats[MAX_MOBILES_PER_ENB]; +extern pdcp_stats_t eNB_pdcp_stats[NUMBER_OF_eNB_MAX]; // for UE code conly -rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; -rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode -unsigned int pdcp_eNB_UE_instance_to_rnti_index; +extern rnti_t pdcp_UE_UE_module_id_to_rnti[MAX_MOBILES_PER_ENB]; +extern rnti_t pdcp_eNB_UE_instance_to_rnti[MAX_MOBILES_PER_ENB]; // for noS1 mode +extern unsigned int pdcp_eNB_UE_instance_to_rnti_index; -pdcp_mbms_t pdcp_mbms_array_ue[MAX_MOBILES_PER_ENB][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -pdcp_mbms_t pdcp_mbms_array_eNB[NUMBER_OF_eNB_MAX][LTE_maxServiceCount][LTE_maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -sdu_size_t pdcp_output_sdu_bytes_to_write; -sdu_size_t pdcp_output_header_bytes_to_write; -notifiedFIFO_t pdcp_sdu_list; -int pdcp_sent_a_sdu; -pdcp_data_req_header_t pdcp_input_header; -unsigned char pdcp_input_sdu_buffer[MAX_IP_PACKET_SIZE]; -sdu_size_t pdcp_input_index_header; -sdu_size_t pdcp_input_sdu_size_read; -sdu_size_t pdcp_input_sdu_remaining_size_to_read; +extern notifiedFIFO_t pdcp_sdu_list; #define PDCP_COLL_KEY_VALUE(mODULE_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \ ((hash_key_t)mODULE_iD | \ diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 687d7b1bfe..8ff3c06cd4 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -78,9 +78,6 @@ extern int nas_sock_fd[MAX_MOBILES_PER_ENB]; extern int nas_sock_mbms_fd; -extern int mbms_rab_id; - - extern struct msghdr nas_msg_tx; extern struct msghdr nas_msg_rx; @@ -113,8 +110,6 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { * PDCP packet to pick the right socket below */ int rb_id = pdcpHead->rb_id; - int sizeToWrite= sizeof (pdcp_data_ind_header_t) + - pdcpHead->data_size; void * pdcpData=(void*)(pdcpHead+1); if (rb_id == 10) { //hardcoded for PC5-Signaling if( LOG_DEBUGFLAG(DEBUG_PDCP) ) { @@ -128,24 +123,25 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { } else if (UE_NAS_USE_TUN) { //ret = write(nas_sock_fd[pdcpHead->inst], &(sdu_p->data[sizeof(pdcp_data_ind_header_t)]),sizeToWrite ); if(rb_id == mbms_rab_id){ - ret = write(nas_sock_mbms_fd, pdcpData,sizeToWrite ); + ret = write(nas_sock_mbms_fd, pdcpData, pdcpHead->data_size ); LOG_I(PDCP,"[PDCP_FIFOS] ret %d TRIED TO PUSH MBMS DATA TO rb_id %d handle %d sizeToWrite %d\n", - ret,rb_id,nas_sock_fd[pdcpHead->inst],sizeToWrite); + ret,rb_id,nas_sock_fd[pdcpHead->inst],pdcpHead->data_size); } else { if( LOG_DEBUGFLAG(DEBUG_PDCP) ) - log_dump(PDCP, pdcpData, sizeToWrite, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); - ret = write(nas_sock_fd[pdcpHead->inst], pdcpData,sizeToWrite ); + log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); + ret = write(nas_sock_fd[pdcpHead->inst], pdcpData,pdcpHead->data_size ); LOG_T(PDCP,"[UE PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n", - ret,rb_id,nas_sock_fd[pdcpHead->inst],sizeToWrite); + ret,rb_id,nas_sock_fd[pdcpHead->inst],pdcpHead->data_size); } } else if (ENB_NAS_USE_TUN) { if( LOG_DEBUGFLAG(DEBUG_PDCP) ) - log_dump(PDCP, pdcpData, sizeToWrite, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); - ret = write(nas_sock_fd[0], pdcpData, sizeToWrite); - LOG_T(PDCP,"[NB PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[0],sizeToWrite); + log_dump(PDCP, pdcpData, pdcpHead->data_size, LOG_DUMP_CHAR,"PDCP output to be sent to TUN interface: \n"); + ret = write(nas_sock_fd[0], pdcpData, pdcpHead->data_size); + LOG_T(PDCP,"[NB PDCP_FIFOS] ret %d TRIED TO PUSH DATA TO rb_id %d handle %d sizeToWrite %d\n",ret,rb_id,nas_sock_fd[0],pdcpHead->data_size); } else if (PDCP_USE_NETLINK) { + int sizeToWrite= sizeof (pdcp_data_ind_header_t) + pdcpHead->data_size; memcpy(NLMSG_DATA(nas_nlh_tx), (uint8_t *) pdcpHead, sizeToWrite); nas_nlh_tx->nlmsg_len = sizeToWrite; ret = sendmsg(nas_sock_fd[0],&nas_msg_tx,0); @@ -154,7 +150,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t *const ctxt_pP) { AssertFatal(ret >= 0,"[PDCP_FIFOS] pdcp_fifo_flush_sdus (errno: %d %s), nas_sock_fd[0]: %d\n", errno, strerror(errno), nas_sock_fd[0]); if( LOG_DEBUGFLAG(DEBUG_PDCP) ) - log_dump(PDCP, pdcpData, min(sizeToWrite,30) , LOG_DUMP_CHAR, + log_dump(PDCP, pdcpData, min(pdcpHead->data_size,30) , LOG_DUMP_CHAR, "Printing first bytes of PDCP SDU before removing it from the list: \n"); delNotifiedFIFO_elt (sdu_p); pdcp_nb_sdu_sent ++; @@ -377,7 +373,6 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx protocol_ctxt_t ctxt; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; - module_id_t ue_id = 0; pdcp_t *pdcp_p = NULL; static unsigned char pdcp_read_state_g =0; rb_id_t rab_id = 0; @@ -471,30 +466,7 @@ int pdcp_fifo_read_input_sdus_fromnetlinksock (const protocol_ctxt_t *const ctx } else { // rb_id =0, thus interpreated as broadcast and transported as multiple unicast // is a broadcast packet, we have to send this packet on all default RABS of all connected UEs //#warning CODE TO BE REVIEWED, ONLY WORK FOR SIMPLE TOPOLOGY CASES - for (ue_id = 0; ue_id < NB_UE_INST; ue_id++) { - if (oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id] != NOT_A_RNTI) { - ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt_cpy.module_id][ue_id]; - LOG_D(PDCP, "[FRAME %5u][eNB][IP][INSTANCE %u][RB %ld][--- PDCP_DATA_REQ / %d Bytes --->][PDCP][MOD %u][UE %u][RB DEFAULT_RAB_ID %u]\n", - ctxt.frame, - pdcp_read_header_g.inst, - pdcp_read_header_g.rb_id, - pdcp_read_header_g.data_size, - ctxt.module_id, - ctxt.rnti, - DEFAULT_RAB_ID); - pdcp_data_req ( - &ctxt, - SRB_FLAG_NO, - DEFAULT_RAB_ID, - RLC_MUI_UNDEFINED, - RLC_SDU_CONFIRM_NO, - pdcp_read_header_g.data_size, - (unsigned char *)NLMSG_DATA(nas_nlh_rx), - PDCP_TRANSMISSION_MODE_DATA - ,NULL, NULL - ); - } - } + // never finished code, dropped } } else { // ctxt.enb_flag => UE if (NFAPI_MODE == NFAPI_UE_STUB_PNF) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index bf6579955b..e0adfefa03 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -319,13 +319,15 @@ error: } int proto_agent_get_ack_result(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { +/* code useless in this status: return 0 anyways rlc_op_status_t result = 0; - //printf("PROTO_AGENT: handling the data_req_ack message\n"); + printf("PROTO_AGENT: handling the data_req_ack message\n"); Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; Protocol__FspRlcDataReqAck *data_ack = input->data_req_ack; result = data_ack->result; - //printf("PROTO_AGENT: ACK RESULT IS %u\n", result); + printf("PROTO_AGENT: ACK RESULT IS %u\n", result); ack_result = result; +*/ return 0; } @@ -500,6 +502,13 @@ error: return -1; } +boolean_t pdcp_data_ind( + const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_id, + const sdu_size_t sdu_buffer_size, + mem_block_t *const sdu_buffer); int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { boolean_t result = 0; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h index c805b81543..8f553e05e1 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.h @@ -62,7 +62,6 @@ typedef int (*proto_agent_message_destruction_callback)( ); -uint32_t ack_result; /********************************** * progRAN protocol messages helper diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c index 9a63427ed5..925c11c8f8 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_net_comm.c @@ -30,7 +30,7 @@ #include "common/utils/LOG/log.h" proto_agent_channel_t *proto_channel[NUMBER_OF_eNB_MAX][ENB_AGENT_MAX]; -proto_agent_channel_instance_t channel_instance; +static proto_agent_channel_instance_t channel_instance; int proto_agent_channel_id = 0; int proto_agent_register_channel(mod_id_t mod_id, proto_agent_channel_t *channel, proto_agent_id_t agent_id) { diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c index fda84879be..cf77f9ec37 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.c @@ -80,6 +80,8 @@ static int g_send_id_read_index[2]; static struct mac_data_ind g_tx_delayed_indications[MAX_TIME_DELAYED_PDU_DUE_TO_HARQ]; static struct mac_data_ind g_rx_delayed_indications[MAX_TIME_DELAYED_PDU_DUE_TO_HARQ]; +static rlc_um_entity_t um_tx; +static rlc_um_entity_t um_rx; static int8_t *g_sdus[] = {"En dépit de son volontarisme affiché, le premier ministre est de plus en plus décrié pour son incompétence. La tension politique et dans l'opinion publique est encore montée d'un cran au Japon, sur fond d'inquiétantes nouvelles, avec du plutonium détecté dans le sol autour de la centrale de Fukushima. Le premier ministre Naoto Kan a solennellement déclaré que son gouvernement était «en état d'alerte maximum». Tout en reconnaissant que la situation restait «imprévisible». Ce volontarisme affiché par le premier ministre - que Nicolas Sarkozy rencontrera demain lors d'une visite au Japon - ne l'a pas empêché d'être la cible de violentes critiques de la part de parlementaires sur sa gestion de la crise. Attaqué sur le manque de transparence, il a assuré qu'il rendait publiques toutes les informations en sa possession. Un député de l'opposition, Yosuke Isozaki, a aussi reproché à Naoto Kan de ne pas avoir ordonné l'évacuation des populations dans la zone comprise entre 20 et 30 km autour de la centrale. «Peut-il y avoir quelque chose de plus irresponsable que cela ?», a-t-il lancé. Pour l'heure, la zone d'évacuation est limitée à un rayon de 20 km, seul le confinement étant recommandé pour les 10 km suivants. Sur ce sujet, les autorités japonaises ont été fragilisées mardi par les déclarations de Greenpeace, affirmant que ses experts avaient détecté une radioactivité dangereuse à 40 km de la centrale. L'organisation écologiste a appelé à une extension de la zone d'évacuation, exhortant Tokyo à «cesser de privilégier la politique aux dépens de la science». L'Agence japonaise de sûreté nucléaire a balayé ces critiques.", diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h index 6da464aa28..bfde1b31f3 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_test.h @@ -21,8 +21,6 @@ # ifndef __RLC_UM_TEST_H__ # define __RLC_UM_TEST_H__ -rlc_um_entity_t um_tx; -rlc_um_entity_t um_rx; void rlc_um_v9_3_0_test_windows_5(void); void rlc_um_v9_3_0_test_windows_10(void); diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 98c8c3e252..b9dcf0414b 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -36,6 +36,7 @@ #include "common/utils/LOG/vcd_signal_dumper.h" #include "targets/COMMON/openairinterface5g_limits.h" #include "assertions.h" +#include #include "common/ran_context.h" extern RAN_CONTEXT_t RC; @@ -51,7 +52,27 @@ extern boolean_t pdcp_data_ind( #define DEBUG_RLC_PDCP_INTERFACE 1 //#define TRACE_RLC_PAYLOAD 1 #define DEBUG_RLC_DATA_REQ 1 +void (*rlc_rrc_data_conf)( + const protocol_ctxt_t *const ctxtP, + const rb_id_t rb_idP, + const mui_t muiP, + const rlc_tx_status_t statusP) __attribute__ ((aligned(32))); +void (*rlc_rrc_data_ind)( + const protocol_ctxt_t *const ctxtP, + const rb_id_t rb_idP, + const sdu_size_t sdu_sizeP, + const uint8_t *const sduP) __attribute__ ((aligned(32))); + +logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); + + +logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ //----------------------------------------------------------------------------- void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP) //----------------------------------------------------------------------------- diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 7e4920a579..ef5f824ba0 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -133,13 +133,13 @@ typedef struct { #define RLC_MAX_MBMS_LC (LTE_maxSessionPerPMCH * LTE_maxServiceCount) #define RLC_MAX_LC ((max_val_LTE_DRB_Identity+1)* MAX_MOBILES_PER_ENB) -void (*rlc_rrc_data_ind)( +extern void (*rlc_rrc_data_ind)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const sdu_size_t sdu_sizeP, const uint8_t *const sduP) __attribute__ ((aligned(32))); -void (*rlc_rrc_data_conf)( +extern void (*rlc_rrc_data_conf)( const protocol_ctxt_t *const ctxtP, const rb_id_t rb_idP, const mui_t muiP, @@ -184,8 +184,8 @@ typedef struct rlc_mbms_id_s { //rlc_mbms_t rlc_mbms_array_ue[MAX_MOBILES_PER_ENB][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h //rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h -rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[MAX_MOBILES_PER_ENB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h +extern rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_LC]; // some constants from openair2/RRC/LTE/MESSAGES/asn1_constants.h #define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD] ; @@ -201,8 +201,8 @@ rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[MAX_eNB][RLC_MAX_MBMS_ rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD] = lOG_cH_iD; \ } while (0); -logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ -logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +extern logical_chan_id_t rlc_mbms_rbid2lcid_ue [MAX_MOBILES_PER_ENB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +extern logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ #define RLC_COLL_KEY_VALUE(eNB_iD, rNTI, iS_eNB, rB_iD, iS_sRB) \ @@ -250,7 +250,7 @@ logical_chan_id_t rlc_mbms_rbid2lcid_eNB[MAX_eNB][NB_RB_MBMS_MAX]; (((hash_key_t)(sESSION_ID)) << 37) | \ (((hash_key_t)(0x0000000000000001)) << 63)) -hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); +extern hash_table_t *rlc_coll_p __attribute__ ((aligned(32))); /*! \fn tbs_size_t mac_rlc_serialize_tb (char* bufferP, list_t transport_blocksP) * \brief Serialize a list of transport blocks coming from RLC in order to be processed by MAC. diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index eda6888ecd..1822239171 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -26,6 +26,7 @@ #include #include "nr_pdcp_security_nea2.h" +#include "nr_pdcp_integrity_nia2.h" #include "nr_pdcp_sdu.h" #include "LOG/log.h" @@ -54,17 +55,21 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, } if (entity->sn_size == 12) { - rcvd_sn = (((unsigned char)buffer[0] & 0xf) << 8) | - (unsigned char)buffer[1]; + rcvd_sn = ((buffer[0] & 0xf) << 8) | + buffer[1]; header_size = 2; } else { - rcvd_sn = (((unsigned char)buffer[0] & 0x3) << 16) | - ((unsigned char)buffer[1] << 8) | - (unsigned char)buffer[2]; + rcvd_sn = ((buffer[0] & 0x3) << 16) | + (buffer[1] << 8) | + buffer[2]; header_size = 3; } - integrity_size = 0; + if (entity->has_integrity) { + integrity_size = 4; + } else { + integrity_size = 0; + } if (size < header_size + integrity_size + 1) { LOG_E(PDCP, "bad PDU received (size = %d)\n", size); @@ -86,9 +91,20 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, if (entity->has_ciphering) entity->cipher(entity->security_context, - (unsigned char *)buffer+header_size, size-header_size, + buffer+header_size, size-header_size, entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1); + if (entity->has_integrity) { + unsigned char integrity[4]; + entity->integrity(entity->integrity_context, integrity, + buffer, size - integrity_size, + entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1); + if (memcmp(integrity, buffer, 4) != 0) { + LOG_E(PDCP, "discard NR PDU, integrity failed\n"); + return; + } + } + if (rcvd_count < entity->rx_deliv || nr_pdcp_sdu_in_list(entity->rx_list, rcvd_count)) { LOG_D(PDCP, "discard NR PDU rcvd_count=%d\n", rcvd_count); @@ -139,39 +155,62 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity, uint32_t count; int sn; int header_size; - char buf[size+3+4]; + int integrity_size; + char buf[size + 3 + 4]; + int dc_bit; count = entity->tx_next; sn = entity->tx_next & entity->sn_max; + /* D/C bit is only to be set for DRBs */ + if (entity->type == NR_PDCP_DRB_AM || entity->type == NR_PDCP_DRB_UM) { + dc_bit = 0x80; + } else { + dc_bit = 0; + } + if (entity->sn_size == 12) { - buf[0] = 0x80 | ((sn >> 8) & 0xf); + buf[0] = dc_bit | ((sn >> 8) & 0xf); buf[1] = sn & 0xff; header_size = 2; } else { - buf[0] = 0x80 | ((sn >> 16) & 0x3); + buf[0] = dc_bit | ((sn >> 16) & 0x3); buf[1] = (sn >> 8) & 0xff; buf[2] = sn & 0xff; header_size = 3; } - memcpy(buf+header_size, buffer, size); + if (entity->has_integrity) { + integrity_size = 4; + } else { + integrity_size = 0; + } + + memcpy(buf + header_size, buffer, size); + + if (entity->has_integrity) + entity->integrity(entity->integrity_context, + (unsigned char *)buf + header_size + size, + (unsigned char *)buf, header_size + size, + entity->rb_id, count, entity->is_gnb ? 1 : 0); if (entity->has_ciphering) entity->cipher(entity->security_context, - (unsigned char *)buf+header_size, size, + (unsigned char *)buf + header_size, size + integrity_size, entity->rb_id, count, entity->is_gnb ? 1 : 0); entity->tx_next++; entity->deliver_pdu(entity->deliver_pdu_data, entity, buf, - size+header_size, sdu_id); + header_size + size + integrity_size, sdu_id); } static void nr_pdcp_entity_set_integrity_key(nr_pdcp_entity_t *entity, char *key) { - memcpy(entity->integrity_key, key, 16); + LOG_E(PDCP, "%s: %d: %s: TODO? to remove?\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + //memcpy(entity->integrity_key, key, 16); } static void check_t_reordering(nr_pdcp_entity_t *entity) @@ -232,6 +271,8 @@ void nr_pdcp_entity_delete(nr_pdcp_entity_t *entity) } if (entity->free_security != NULL) entity->free_security(entity->security_context); + if (entity->free_integrity != NULL) + entity->free_integrity(entity->integrity_context); free(entity); } @@ -298,9 +339,18 @@ nr_pdcp_entity_t *new_nr_pdcp_entity( } ret->is_gnb = is_gnb; - if (integrity_key != NULL) { - printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); + if (integrity_key != NULL && integrity_algorithm != 0) { + if (integrity_algorithm != 2) { + LOG_E(PDCP, "FATAL: only nia2 supported for the moment\n"); + exit(1); + } + ret->has_integrity = 1; + ret->integrity_algorithm = integrity_algorithm; + memcpy(ret->integrity_key, integrity_key, 16); + + ret->integrity_context = nr_pdcp_integrity_nia2_init(integrity_key); + ret->integrity = nr_pdcp_integrity_nia2_integrity; + ret->free_integrity = nr_pdcp_integrity_nia2_free_integrity; } return ret; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h index 36e7a540c4..4ae7a45abb 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h @@ -85,7 +85,12 @@ typedef struct nr_pdcp_entity_t { unsigned char *buffer, int length, int bearer, int count, int direction); void (*free_security)(void *security_context); - /* security algorithms need to know uplink/downlink information + void *integrity_context; + void (*integrity)(void *integrity_context, unsigned char *out, + unsigned char *buffer, int length, + int bearer, int count, int direction); + void (*free_integrity)(void *integrity_context); + /* security/integrity algorithms need to know uplink/downlink information * which is reverse for gnb and ue, so we need to know if this * pdcp entity is for a gnb or an ue */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c new file mode 100644 index 0000000000..5553662ac5 --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c @@ -0,0 +1,81 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "nr_pdcp_integrity_nia2.h" + +#include +#include +#include +#include + +void *nr_pdcp_integrity_nia2_init(unsigned char *integrity_key) +{ + CMAC_CTX *ctx; + + ctx = CMAC_CTX_new(); + if (ctx == NULL) abort(); + + CMAC_Init(ctx, integrity_key, 16, EVP_aes_128_cbc(), NULL); + + return ctx; +} + +static void compute_t(unsigned char *t, uint32_t count, int bearer, + int direction) +{ + t[0] = (count >> 24) & 255; + t[1] = (count >> 16) & 255; + t[2] = (count >> 8) & 255; + t[3] = (count ) & 255; + t[4] = (bearer << 3) | (direction << 2); + memset(&t[5], 0, 8-5); +} + +void nr_pdcp_integrity_nia2_integrity(void *integrity_context, + unsigned char *out, + unsigned char *buffer, int length, + int bearer, int count, int direction) +{ + CMAC_CTX *ctx = integrity_context; + unsigned char t[8]; + unsigned char mac[16]; + size_t maclen; + + /* see 33.401 B.2.3 for the input to 128-EIA2 + * (which is identical to 128-NIA2, see 33.501 D.3.1.3) */ + compute_t(t, count, bearer, direction); + + CMAC_Update(ctx, t, 8); + CMAC_Update(ctx, buffer, length); + CMAC_Final(ctx, mac, &maclen); + + /* AES CMAC (RFC 4493) outputs 128 bits but NR PDCP PDUs have a MAC-I of + * 32 bits (see 38.323 6.2). RFC 4493 2.1 says to truncate most significant + * bit first (so seems to say 33.401 B.2.3) + */ + memcpy(out, mac, 4); +} + +void nr_pdcp_integrity_nia2_free_integrity(void *integrity_context) +{ + CMAC_CTX *ctx = integrity_context; + CMAC_CTX_free(ctx); +} diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.h new file mode 100644 index 0000000000..9593a2825c --- /dev/null +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.h @@ -0,0 +1,34 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef _NR_PDCP_INTEGRITY_NIA2_H_ +#define _NR_PDCP_INTEGRITY_NIA2_H_ + +void *nr_pdcp_integrity_nia2_init(unsigned char *integrity_key); + +void nr_pdcp_integrity_nia2_integrity(void *integrity_context, + unsigned char *out, + unsigned char *buffer, int length, + int bearer, int count, int direction); + +void nr_pdcp_integrity_nia2_free_integrity(void *integrity_context); + +#endif /* _NR_PDCP_INTEGRITY_NIA2_H_ */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index ec48b0adae..39b770508e 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -34,6 +34,7 @@ /* from OAI */ #include "pdcp.h" #include "LAYER2/nr_rlc/nr_rlc_oai_api.h" +#include #define TODO do { \ printf("%s:%d:%s: todo\n", __FILE__, __LINE__, __FUNCTION__); \ @@ -450,7 +451,7 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)buf[i]); //printf("\n"); - itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_p); + itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); } } @@ -804,7 +805,9 @@ void nr_DRB_preconfiguration(uint16_t crnti) rbconfig->securityConfig->keyToUse = calloc(1,sizeof(*rbconfig->securityConfig->keyToUse)); *rbconfig->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master; - xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig); + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig); + } NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig)); nr_rlc_bearer_init(RLC_BearerConfig); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index 1d4efc1e26..000c764e8f 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -650,7 +650,7 @@ control: control_decoder = decoder; control_e1 = e1; while (control_e1) { - nr_rlc_pdu_decoder_get_bits(&control_decoder, entity->sn_field_length); R(control_decoder); /* NACK_SN */ + nack_sn = nr_rlc_pdu_decoder_get_bits(&control_decoder, entity->sn_field_length); R(control_decoder); control_e1 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); control_e2 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); control_e3 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); @@ -660,17 +660,36 @@ control: } else { nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder); } + /* check range and so_start/so_end consistency */ if (control_e2) { - nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); /* SOstart */ - nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); /* SOend */ + so_start = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); + so_end = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder); + } else { + so_start = 0; + so_end = 0xffff; } if (control_e3) { - nr_rlc_pdu_decoder_get_bits(&control_decoder, 8); R(control_decoder); /* NACK range */ + range = nr_rlc_pdu_decoder_get_bits(&control_decoder, 8); R(control_decoder); + } else { + range = 1; + } + if (range < 1) { + LOG_E(RLC, "%s:%d:%s: error, bad 'range' in RLC NACK (sn %d)\n", + __FILE__, __LINE__, __FUNCTION__, nack_sn); + goto err; + } + /* so_start can be > so_end if more than one range; they don't refer + * to the same PDU then + */ + if (range == 1 && so_end < so_start) { + LOG_E(RLC, "%s:%d:%s: error, bad so start/end (sn %d)\n", + __FILE__, __LINE__, __FUNCTION__, nack_sn); + goto err; } } /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is - * received for the SN 'poll_sn' + * received for the SN 'poll_sn' - check ACK case (NACK done below) */ if (sn_compare_tx(entity, entity->poll_sn, ack_sn) < 0) entity->t_poll_retransmit_start = 0; @@ -697,28 +716,22 @@ control: if (e2) { so_start = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); so_end = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder); - if (so_end < so_start) { - LOG_W(RLC, "%s:%d:%s: warning, bad so start/end, NACK the whole PDU (sn %d)\n", - __FILE__, __LINE__, __FUNCTION__, nack_sn); - so_start = 0; - so_end = -1; - } - /* special value 0xffff indicates 'all bytes to the end' */ - if (so_end == 0xffff) - so_end = -1; } else { so_start = 0; - so_end = -1; + so_end = 0xffff; } if (e3) { range = nr_rlc_pdu_decoder_get_bits(&decoder, 8); R(decoder); } else { range = 1; } + /* special value 0xffff indicates 'all bytes to the end' */ + if (so_end == 0xffff) + so_end = -1; process_received_nack(entity, nack_sn, so_start, so_end, range, sn_set); /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is - * received for the SN 'poll_sn' + * received for the SN 'poll_sn' - check NACK case (ACK done above) */ if (sn_compare_tx(entity, nack_sn, entity->poll_sn) <= 0 && sn_compare_tx(entity, entity->poll_sn, (nack_sn + range) % entity->sn_modulus) < 0) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 9c139624eb..66553e813b 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -73,7 +73,8 @@ void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChann mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = calloc(1,sizeof(*mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup)); *mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup = 1; - mac_LogicalChannelConfig->ul_SpecificParameters->schedulingRequestID = NULL; + mac_LogicalChannelConfig->ul_SpecificParameters->schedulingRequestID = calloc(1,sizeof(*mac_LogicalChannelConfig->ul_SpecificParameters->schedulingRequestID)); + *mac_LogicalChannelConfig->ul_SpecificParameters->schedulingRequestID = 0; mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = false; mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false; mac_LogicalChannelConfig->ul_SpecificParameters->bitRateQueryProhibitTimer = NULL; @@ -250,7 +251,8 @@ mac_rlc_status_resp_t mac_rlc_status_ind( + buf_stat.retx_size + buf_stat.tx_size; } else { - LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); + if (!(frameP%128)) //to supress this warning message + LOG_W(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rntiP %x\n", __FUNCTION__, channel_idP, rntiP); ret.bytes_in_buffer = 0; } @@ -319,7 +321,6 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( return ret; } -int oai_emulation; rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, diff --git a/openair2/LAYER2/nr_rlc/tests/run_tests.sh b/openair2/LAYER2/nr_rlc/tests/run_tests.sh index bf1b343d7e..a98f6b5d0f 100755 --- a/openair2/LAYER2/nr_rlc/tests/run_tests.sh +++ b/openair2/LAYER2/nr_rlc/tests/run_tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_count=14 +test_count=15 for i in `seq $test_count` do diff --git a/openair2/LAYER2/nr_rlc/tests/test15.h b/openair2/LAYER2/nr_rlc/tests/test15.h new file mode 100644 index 0000000000..8ce9f97896 --- /dev/null +++ b/openair2/LAYER2/nr_rlc/tests/test15.h @@ -0,0 +1,19 @@ +/* + * am test (SN field size 18): + * test "range" in NACK, generate a case where so_start > so_end + * (so so_start and so_end are not from the same PDU) + */ + +TIME, 1, + GNB_AM, 100000, 100000, 45, 35, 0, -1, -1, 8, 18, + UE_AM, 100000, 100000, 45, 35, 0, -1, -1, 8, 18, + GNB_PDU_SIZE, 40, + UE_PDU_SIZE, 80, + GNB_SDU, 0, 50, + GNB_SDU, 1, 50, + GNB_SDU, 2, 50, +TIME, 2, + UE_RECV_FAILS, 1, +TIME, 4, + UE_RECV_FAILS, 0, +TIME, -1 diff --git a/openair2/LAYER2/nr_rlc/tests/test15.txt.gz b/openair2/LAYER2/nr_rlc/tests/test15.txt.gz new file mode 100644 index 0000000000..e615a59a5f Binary files /dev/null and b/openair2/LAYER2/nr_rlc/tests/test15.txt.gz differ diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 919d577a18..18285f6563 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -265,7 +265,6 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( return ret; } -int oai_emulation; rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, diff --git a/openair2/NETWORK_DRIVER/UE_IP/netlink.c b/openair2/NETWORK_DRIVER/UE_IP/netlink.c index 658ae19aba..b3829c51d1 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/netlink.c +++ b/openair2/NETWORK_DRIVER/UE_IP/netlink.c @@ -39,6 +39,7 @@ #include "local.h" #include "proto_extern.h" +MODULE_LICENSE("OAI"); #define OAI_IP_DRIVER_NETLINK_ID 31 #define NL_DEST_PID 1 diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index 5a090d4ffd..2190886226 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -41,8 +41,8 @@ #define MAX_IF_MODULES 100 //#define UL_HARQ_PRINT -NR_IF_Module_t *if_inst[MAX_IF_MODULES]; -NR_Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; +static NR_IF_Module_t *nr_if_inst[MAX_IF_MODULES]; +static NR_Sched_Rsp_t NR_Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); extern int oai_nfapi_cqi_indication(nfapi_cqi_indication_t *cqi_ind); @@ -55,7 +55,7 @@ extern uint16_t sl_ahead; void handle_nr_rach(NR_UL_IND_t *UL_info) { if (UL_info->rach_ind.number_of_pdus>0) { - LOG_I(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot); + LOG_D(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n",UL_info->frame,UL_info->slot, UL_info->rach_ind.sfn,UL_info->rach_ind.slot); int npdus = UL_info->rach_ind.number_of_pdus; for(int i = 0; i < npdus; i++) { UL_info->rach_ind.number_of_pdus--; @@ -105,10 +105,10 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) } UL_info->uci_ind.num_ucis = 0; - if(NFAPI_MODE != NFAPI_MODE_PNF) - // mark corresponding PUCCH resources as free - // NOTE: we just assume it is BWP ID 1, to be revised for multiple BWPs - RC.nrmac[mod_id]->pucch_index_used[1][slot] = 0; + // if(NFAPI_MODE != NFAPI_MODE_PNF) + // // mark corresponding PUCCH resources as free + // // NOTE: we just assume it is BWP ID 1, to be revised for multiple BWPs + // RC.nrmac[mod_id]->pucch_index_used[1][slot] = 0; } @@ -180,8 +180,8 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { #endif module_id_t module_id = UL_info->module_id; int CC_id = UL_info->CC_id; - NR_Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id]; - NR_IF_Module_t *ifi = if_inst[module_id]; + NR_Sched_Rsp_t *sched_info = &NR_Sched_INFO[module_id][CC_id]; + NR_IF_Module_t *ifi = nr_if_inst[module_id]; gNB_MAC_INST *mac = RC.nrmac[module_id]; nfapi_nr_config_request_scf_t *cfg = &mac->config[CC_id]; LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rach_pdus:%d rx_ind:%d crcs:%d]\n", @@ -254,17 +254,17 @@ NR_IF_Module_t *NR_IF_Module_init(int Mod_id) { AssertFatal(Mod_id %d\n",Mod_id,MAX_IF_MODULES); LOG_I(PHY,"Installing callbacks for IF_Module - UL_indication\n"); - if (if_inst[Mod_id]==NULL) { - if_inst[Mod_id] = (NR_IF_Module_t*)malloc(sizeof(NR_IF_Module_t)); - memset((void*)if_inst[Mod_id],0,sizeof(NR_IF_Module_t)); + if (nr_if_inst[Mod_id]==NULL) { + nr_if_inst[Mod_id] = (NR_IF_Module_t*)malloc(sizeof(NR_IF_Module_t)); + memset((void*)nr_if_inst[Mod_id],0,sizeof(NR_IF_Module_t)); - LOG_I(MAC,"Allocating shared L1/L2 interface structure for instance %d @ %p\n",Mod_id,if_inst[Mod_id]); + LOG_I(MAC,"Allocating shared L1/L2 interface structure for instance %d @ %p\n",Mod_id,nr_if_inst[Mod_id]); - if_inst[Mod_id]->CC_mask=0; - if_inst[Mod_id]->NR_UL_indication = NR_UL_indication; - AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0, - "allocation of if_inst[%d]->if_mutex fails\n",Mod_id); + nr_if_inst[Mod_id]->CC_mask=0; + nr_if_inst[Mod_id]->NR_UL_indication = NR_UL_indication; + AssertFatal(pthread_mutex_init(&nr_if_inst[Mod_id]->if_mutex,NULL)==0, + "allocation of nr_if_inst[%d]->if_mutex fails\n",Mod_id); } - return if_inst[Mod_id]; + return nr_if_inst[Mod_id]; } diff --git a/openair2/PHY_INTERFACE/IF_Module.c b/openair2/PHY_INTERFACE/IF_Module.c index d98c603d78..ed3c9a5b7d 100644 --- a/openair2/PHY_INTERFACE/IF_Module.c +++ b/openair2/PHY_INTERFACE/IF_Module.c @@ -7,8 +7,8 @@ #include "nfapi/oai_integration/vendor_ext.h" #define MAX_IF_MODULES 100 -IF_Module_t *if_inst[MAX_IF_MODULES]; -Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; +static IF_Module_t *if_inst[MAX_IF_MODULES]; +static Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; extern int oai_nfapi_harq_indication(nfapi_harq_indication_t *harq_ind); extern int oai_nfapi_crc_indication(nfapi_crc_indication_t *crc_ind); @@ -19,6 +19,8 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern uint16_t sf_ahead; extern UL_RCC_IND_t UL_RCC_INFO; +extern RAN_CONTEXT_t RC; + uint16_t frame_cnt=0; void handle_rach(UL_IND_t *UL_info) { int i; @@ -685,7 +687,7 @@ static void dump_dl(Sched_Rsp_t *d) { /* debug utility functions end */ /****************************************************************************/ -void UL_indication(UL_IND_t *UL_info, L1_rxtx_proc_t *proc) { +void UL_indication(UL_IND_t *UL_info, void *proc) { AssertFatal(UL_info!=NULL,"UL_INFO is null\n"); #ifdef DUMP_FAPI dump_ul(UL_info); diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h index 1470cbc006..096979c4fd 100644 --- a/openair2/PHY_INTERFACE/IF_Module.h +++ b/openair2/PHY_INTERFACE/IF_Module.h @@ -37,7 +37,6 @@ #include //#include "openair1/PHY/LTE_TRANSPORT/transport_eNB.h" #include "nfapi_interface.h" -#include "platform_constants.h" #include "platform_types.h" #include @@ -135,64 +134,13 @@ typedef struct { uint8_t Mod_id; int CC_id; nfapi_config_request_t *cfg; -}PHY_Config_t; +} PHY_Config_t; #include -/// Context data structure for RX/TX portion of subframe processing -typedef struct { - /// Component Carrier index - uint8_t CC_id; - /// timestamp transmitted to HW - openair0_timestamp timestamp_tx; - openair0_timestamp timestamp_rx; - /// subframe to act upon for transmission - int subframe_tx; - /// subframe to act upon for reception - int subframe_rx; - /// frame to act upon for transmission - int frame_tx; - /// frame to act upon for reception - int frame_rx; - int frame_prach; - int subframe_prach; - int frame_prach_br; - int subframe_prach_br; - /// \brief Instance count for RXn-TXnp4 processing thread. - /// \internal This variable is protected by \ref mutex_rxtx. - int instance_cnt; - /// pthread structure for RXn-TXnp4 processing thread - pthread_t pthread; - /// pthread attributes for RXn-TXnp4 processing thread - pthread_attr_t attr; - /// condition variable for tx processing thread - pthread_cond_t cond; - /// mutex for RXn-TXnp4 processing thread - pthread_mutex_t mutex; - /// scheduling parameters for RXn-TXnp4 thread - struct sched_param sched_param_rxtx; - - /// \internal This variable is protected by \ref mutex_RUs. - int instance_cnt_RUs; - /// condition variable for tx processing thread - pthread_cond_t cond_RUs; - /// mutex for RXn-TXnp4 processing thread - pthread_mutex_t mutex_RUs; - tpool_t *threadPool; - int nbEncode; - int nbDecode; - notifiedFIFO_t *respEncode; - notifiedFIFO_t *respDecode; - pthread_mutex_t mutex_emulateRF; - int instance_cnt_emulateRF; - pthread_t pthread_emulateRF; - pthread_attr_t attr_emulateRF; - pthread_cond_t cond_emulateRF; - int first_rx; -} L1_rxtx_proc_t; typedef struct IF_Module_s{ //define the function pointer - void (*UL_indication)(UL_IND_t *UL_INFO, L1_rxtx_proc_t *proc); - void (*schedule_response)(Sched_Rsp_t *Sched_INFO, L1_rxtx_proc_t *proc); + void (*UL_indication)(UL_IND_t *UL_INFO, void *proc); + void (*schedule_response)(Sched_Rsp_t *Sched_INFO, void *proc); void (*PHY_config_req)(PHY_Config_t* config_INFO); void (*PHY_config_update_sib2_req)(PHY_Config_t* config_INFO); @@ -209,7 +157,7 @@ void IF_Module_kill(int Mod_id); /*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler) */ -void UL_indication(UL_IND_t *UL_INFO, L1_rxtx_proc_t *proc); +void UL_indication(UL_IND_t *UL_INFO, void *proc); /*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/ void Schedule_Response(Sched_Rsp_t *Sched_INFO); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 21740016b1..c212075934 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -54,6 +54,7 @@ extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10]; extern uint16_t sf_ahead; +static eth_params_t stub_eth_params; void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 547fc2dfc4..bdf8872371 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -26,16 +26,7 @@ extern nfapi_tx_request_pdu_t* tx_request_pdu_list; extern nfapi_dl_config_request_t* dl_config_req; extern nfapi_ul_config_request_t* ul_config_req; extern nfapi_hi_dci0_request_t* hi_dci0_req; - -int tx_req_num_elems; - -//below 2 difinitions move to lte-ue.c to add initialization when difinition. -//int next_ra_frame; -//module_id_t next_Mod_id; -eth_params_t stub_eth_params; - - - +extern int tx_req_num_elems; // This function should return all the sched_response config messages which concern a specific UE. Inside this // function we should somehow make the translation of config message's rnti to Mod_ID. diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index d9682b466f..0bc63237b3 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -349,12 +349,12 @@ mac_rrc_data_ind( ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id],rntiP); if(ue_context_p) { - if (ue_context_p->ue_context.Status != RRC_RECONFIGURED) { - LOG_E(RRC,"[eNB %d] Received C-RNTI ,but UE %x status(%d) not RRC_RECONFIGURED\n",module_idP,rntiP,ue_context_p->ue_context.Status); + if (ue_context_p->ue_context.StatusRrc != RRC_RECONFIGURED) { + LOG_E(RRC,"[eNB %d] Received C-RNTI ,but UE %x status(%d) not RRC_RECONFIGURED\n",module_idP,rntiP,ue_context_p->ue_context.StatusRrc); return (-1); } rrc_eNB_generate_defaultRRCConnectionReconfiguration(&ctxt,ue_context_p,0); - ue_context_p->ue_context.Status = RRC_RECONFIGURED; + ue_context_p->ue_context.StatusRrc = RRC_RECONFIGURED; } } @@ -376,7 +376,7 @@ mac_eNB_get_rrc_status( ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP], rntiP); if (ue_context_p != NULL) { - return(ue_context_p->ue_context.Status); + return(ue_context_p->ue_context.StatusRrc); } else { return RRC_INACTIVE; } diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.c b/openair2/RRC/LTE/MESSAGES/asn1_msg.c index 61bce26b2c..ce26aeef87 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.c @@ -2728,7 +2728,7 @@ do_RRCConnectionSetup( // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax, //SchedulingRequestConfig__setup__dsr_TransMax_n4); // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = LTE_SchedulingRequestConfig__setup__dsr_TransMax_n4; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = LTE_SchedulingRequestConfig__setup__dsr_TransMax_n64; rrcConnectionSetup->rrc_TransactionIdentifier = Transaction_id; rrcConnectionSetup->criticalExtensions.present = LTE_RRCConnectionSetup__criticalExtensions_PR_c1; rrcConnectionSetup->criticalExtensions.choice.c1.present = LTE_RRCConnectionSetup__criticalExtensions__c1_PR_rrcConnectionSetup_r8 ; @@ -3220,56 +3220,58 @@ uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count=0; ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list, &rat); - - /* request NR configuration */ LTE_UECapabilityEnquiry_r8_IEs_t *r8 = &dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8; LTE_UECapabilityEnquiry_v8a0_IEs_t r8_a0; LTE_UECapabilityEnquiry_v1180_IEs_t r11_80; LTE_UECapabilityEnquiry_v1310_IEs_t r13_10; LTE_UECapabilityEnquiry_v1430_IEs_t r14_30; LTE_UECapabilityEnquiry_v1510_IEs_t r15_10; - - memset(&r8_a0, 0, sizeof(r8_a0)); - memset(&r11_80, 0, sizeof(r11_80)); - memset(&r13_10, 0, sizeof(r13_10)); - memset(&r14_30, 0, sizeof(r14_30)); - memset(&r15_10, 0, sizeof(r15_10)); - - r8->nonCriticalExtension = &r8_a0; - r8_a0.nonCriticalExtension = &r11_80; - r11_80.nonCriticalExtension = &r13_10; - r13_10.nonCriticalExtension = &r14_30; - r14_30.nonCriticalExtension = &r15_10; - - /* TODO: no hardcoded values here */ - - nsa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t)); - - nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t)); - nsa_band->present = NR_FreqBandInformation_PR_bandInformationEUTRA; - nsa_band->choice.bandInformationEUTRA = (NR_FreqBandInformationEUTRA_t *) calloc(1, sizeof(NR_FreqBandInformationEUTRA_t)); - nsa_band->choice.bandInformationEUTRA->bandEUTRA = eutra_band; - ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band); - - nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t)); - nsa_band->present = NR_FreqBandInformation_PR_bandInformationNR; - nsa_band->choice.bandInformationNR = (NR_FreqBandInformationNR_t *) calloc(1, sizeof(NR_FreqBandInformationNR_t)); - if(nr_band > 0) - nsa_band->choice.bandInformationNR->bandNR = nr_band; - else - nsa_band->choice.bandInformationNR->bandNR = 78; - ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band); - OCTET_STRING_t req_freq; - //unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x02, 0x68 }; // bands 7 & nr78 - unsigned char req_freq_buf[1024]; - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_FreqBandList, - NULL, - (void *)nsa_band_list, - req_freq_buf, - 1024); - xer_fprint(stdout, &asn_DEF_NR_FreqBandList, (void *)nsa_band_list); + if (nr_band>0) { + + /* request NR configuration */ + + memset(&r8_a0, 0, sizeof(r8_a0)); + memset(&r11_80, 0, sizeof(r11_80)); + memset(&r13_10, 0, sizeof(r13_10)); + memset(&r14_30, 0, sizeof(r14_30)); + memset(&r15_10, 0, sizeof(r15_10)); + + r8->nonCriticalExtension = &r8_a0; + r8_a0.nonCriticalExtension = &r11_80; + r11_80.nonCriticalExtension = &r13_10; + r13_10.nonCriticalExtension = &r14_30; + r14_30.nonCriticalExtension = &r15_10; + + /* TODO: no hardcoded values here */ + + nsa_band_list = (NR_FreqBandList_t *)calloc(1, sizeof(NR_FreqBandList_t)); + + nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t)); + nsa_band->present = NR_FreqBandInformation_PR_bandInformationEUTRA; + nsa_band->choice.bandInformationEUTRA = (NR_FreqBandInformationEUTRA_t *) calloc(1, sizeof(NR_FreqBandInformationEUTRA_t)); + nsa_band->choice.bandInformationEUTRA->bandEUTRA = eutra_band; + ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band); + + nsa_band = (NR_FreqBandInformation_t *) calloc(1,sizeof(NR_FreqBandInformation_t)); + nsa_band->present = NR_FreqBandInformation_PR_bandInformationNR; + nsa_band->choice.bandInformationNR = (NR_FreqBandInformationNR_t *) calloc(1, sizeof(NR_FreqBandInformationNR_t)); + //if(nr_band > 0) + nsa_band->choice.bandInformationNR->bandNR = nr_band; + //else + // nsa_band->choice.bandInformationNR->bandNR = 78; + ASN_SEQUENCE_ADD(&nsa_band_list->list, nsa_band); + + //unsigned char req_freq_buf[5] = { 0x00, 0x20, 0x1a, 0x02, 0x68 }; // bands 7 & nr78 + unsigned char req_freq_buf[1024]; + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_FreqBandList, + NULL, + (void *)nsa_band_list, + req_freq_buf, + 1024); + + xer_fprint(stdout, &asn_DEF_NR_FreqBandList, (void *)nsa_band_list); @@ -3280,14 +3282,16 @@ uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, //0x01, 0x60, 0x18, 0x05, 0x80, 0xc0, 0x04, 0x04, 0xc1, 0x2c, 0x10, 0x08, 0x20, 0x30, 0x40, 0xe0, 0x82, 0x40, 0x28, 0x80, 0x9a // }; - req_freq.buf = req_freq_buf; - req_freq.size = (enc_rval.encoded+7)/8; + req_freq.buf = req_freq_buf; + req_freq.size = (enc_rval.encoded+7)/8; // req_freq.size = 21; - r15_10.requestedFreqBandsNR_MRDC_r15 = &req_freq; - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)&dl_dcch_msg); + r15_10.requestedFreqBandsNR_MRDC_r15 = &req_freq; + // Add request for eutra-nr } +// if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_LTE_DL_DCCH_Message, (void *)&dl_dcch_msg); +// } enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message, NULL, diff --git a/openair2/RRC/LTE/defs_NB_IoT.h b/openair2/RRC/LTE/defs_NB_IoT.h index 91dc7aafd4..3907d2321d 100644 --- a/openair2/RRC/LTE/defs_NB_IoT.h +++ b/openair2/RRC/LTE/defs_NB_IoT.h @@ -148,7 +148,7 @@ typedef struct UE_RRC_INFO_NB_IoT_s { //Measurement Report not supported in NB-IoT #define PAYLOAD_SIZE_MAX 1024 -#define RRC_BUF_SIZE 255 +#define RRC_BUF_SIZE 8192 #define UNDEF_SECURITY_MODE 0xff #define NO_SECURITY_MODE 0x20 @@ -211,13 +211,13 @@ typedef struct RB_INFO_TABLE_ENTRY_NB_IoT_s { RB_INFO_NB_IoT Rb_info; uint8_t Active; uint32_t Next_check_frame; - uint8_t Status; + uint8_t status; } RB_INFO_TABLE_ENTRY_NB_IoT; typedef struct SRB_INFO_TABLE_ENTRY_NB_IoT_s { SRB_INFO_NB_IoT Srb_info; uint8_t Active; - uint8_t Status; + uint8_t status; uint32_t Next_check_frame; } SRB_INFO_TABLE_ENTRY_NB_IoT; @@ -269,7 +269,7 @@ typedef struct eNB_RRC_UE_NB_IoT_s { e_LTE_CipheringAlgorithm_r12 ciphering_algorithm; //Specs. TS 36.331 V14.1.0 pag 432 Change position of chipering enumerative w.r.t previous version e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; - uint8_t Status; + uint8_t status; rnti_t rnti; uint64_t random_ue_identity; diff --git a/openair2/RRC/LTE/plmn_data.h b/openair2/RRC/LTE/plmn_data.h index 97dc94343b..701bcaf764 100644 --- a/openair2/RRC/LTE/plmn_data.h +++ b/openair2/RRC/LTE/plmn_data.h @@ -2231,7 +2231,8 @@ static const plmn_data_t plmn_data[] = { /* 310 900 Mid-Rivers Communications Mid-Rivers Wireless Operational */ - {310, 910, "Verizon Wireless", "Verizon USA"} + {310, 910, "Verizon Wireless", "Verizon USA"}, + {0,0,"",""} /* 310 920 Get Mobile Inactive 310 930 Copper Valley Wireless Inactive diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index c57cec6ba5..b2230df623 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -330,7 +330,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) { preconfigpool->data_TF_ResourceConfig_r12.offsetIndicator_r12.choice.small_r12 = 0; // 40 ms SL Period preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.present = LTE_SubframeBitmapSL_r12_PR_bs40_r12; - preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(1,5); + preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf = CALLOC(5,1); preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.size = 5; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.bits_unused = 0; // last 36 subframes for PSCCH @@ -338,7 +338,7 @@ void init_SL_preconfig(UE_RRC_INST *UE, const uint8_t eNB_index ) { preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[1] = 0xFF; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[2] = 0xFF; preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[3] = 0xFF; - preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[5] = 0xFF; + preconfigpool->data_TF_ResourceConfig_r12.subframeBitmap_r12.choice.bs40_r12.buf[4] = 0xFF; preconfigpool->dataHoppingConfig_r12.hoppingParameter_r12 = 0; preconfigpool->dataHoppingConfig_r12.numSubbands_r12 = LTE_SL_HoppingConfigComm_r12__numSubbands_r12_ns1; preconfigpool->dataHoppingConfig_r12.rb_Offset_r12 = 0; @@ -492,7 +492,7 @@ rrc_t310_expiration( UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id, Rlc_info_um); UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active = 0; - UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Status = IDLE; + UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].StatusSrb = IDLE; UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Next_check_frame = 0; } } else { // Restablishment procedure @@ -671,7 +671,7 @@ rrc_ue_establish_srb1( { // add descriptor from RRC PDU UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Active = 1; - UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG + UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].StatusSrb = RADIO_CONFIG_OK;//RADIO CFG UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Srb_id = 1; // copy default configuration for now // memcpy(&UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Lchan_desc[0],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); @@ -695,7 +695,7 @@ rrc_ue_establish_srb2( { // add descriptor from RRC PDU UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Active = 1; - UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG + UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].StatusSrb = RADIO_CONFIG_OK;//RADIO CFG UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Srb_info.Srb_id = 2; // copy default configuration for now // memcpy(&UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Srb_info.Lchan_desc[0],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 4f55f94121..1c02c3de46 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -67,6 +67,8 @@ #define MAX_NUM_NEIGH_CELLs 6 /* maximum neighbouring cells number */ +#define MAX_NUM_GNB_CELLs 1 /* maximum gNB cells number */ + #define UE_STATE_NOTIFICATION_INTERVAL 50 #define IPV4_ADDR "%u.%u.%u.%u" @@ -327,7 +329,7 @@ typedef enum SL_TRIGGER_e { #define MAX_MEAS_ID 6 #define PAYLOAD_SIZE_MAX 1024 -#define RRC_BUF_SIZE 255 +#define RRC_BUF_SIZE 8192 #define UNDEF_SECURITY_MODE 0xff #define NO_SECURITY_MODE 0x20 @@ -517,13 +519,13 @@ typedef struct RB_INFO_TABLE_ENTRY_s { RB_INFO Rb_info; uint8_t Active; uint32_t Next_check_frame; - uint8_t Status; + uint8_t StatusRb; } RB_INFO_TABLE_ENTRY; typedef struct SRB_INFO_TABLE_ENTRY_s { SRB_INFO Srb_info; uint8_t Active; - uint8_t Status; + uint8_t StatusSrb; uint32_t Next_check_frame; } SRB_INFO_TABLE_ENTRY; @@ -597,7 +599,7 @@ typedef struct eNB_RRC_UE_s { LTE_CipheringAlgorithm_r12_t ciphering_algorithm; e_LTE_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; - uint8_t Status; // RRC status, type enum UE_STATE_t + uint8_t StatusRrc; // RRC status, type enum UE_STATE_t rnti_t rnti; int gnb_rnti; //RNTI of the UE at the gNB if in ENDC connection int gnb_x2_assoc_id; @@ -804,8 +806,13 @@ typedef struct eNB_RRC_INST_s { int num_neigh_cells_cc[MAX_NUM_CCs]; uint32_t neigh_cells_id[MAX_NUM_NEIGH_CELLs][MAX_NUM_CCs]; + // gNB cells connected to this eNB + int num_gnb_cells; + int num_gnb_cells_cc[MAX_NUM_GNB_CELLs]; + uint32_t gnb_cells_id[MAX_NUM_GNB_CELLs][MAX_NUM_CCs]; + // Nr scc freq band and SSB absolute frequency - uint32_t nr_neigh_freq_band[MAX_NUM_NEIGH_CELLs][MAX_NUM_CCs]; + uint32_t nr_gnb_freq_band[MAX_NUM_GNB_CELLs][MAX_NUM_CCs]; int nr_scg_ssb_freq; // other RAN parameters diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 526ce129b1..f86b0ddbae 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -87,6 +87,7 @@ #include "pdcp.h" #include "gtpv1u_eNB_task.h" +#include #include "intertask_interface.h" @@ -1055,7 +1056,7 @@ void release_UE_in_freeList(module_id_t mod_id) { if (id>=0) clean_eNb_dlsch(eNB_PHY->dlsch[id][0]); // clean UCI entries for rnti - for (i=0; iuci_vars[i].rnti == rnti) { LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti); memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI)); @@ -1089,7 +1090,7 @@ void release_UE_in_freeList(module_id_t mod_id) { clean_eNb_ulsch(ulsch); } - for (i=0; iuci_vars[i].rnti == rnti) { LOG_I(MAC, "clean eNb uci_vars[%d] UE %x \n",i, rnti); memset(&eNB_PHY->uci_vars[i],0,sizeof(LTE_eNB_UCI)); @@ -1201,7 +1202,7 @@ rrc_eNB_process_RRCConnectionSetupComplete( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing LTE_RRCConnectionSetupComplete from UE (SRB1 Active)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); ue_context_pP->ue_context.Srb1.Active = 1; - ue_context_pP->ue_context.Status = RRC_CONNECTED; + ue_context_pP->ue_context.StatusRrc = RRC_CONNECTED; ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity timer when UE goes into RRC_CONNECTED T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), @@ -1283,7 +1284,7 @@ rrc_eNB_generate_UECapabilityEnquiry( T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); int16_t eutra_band = RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0]; - uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_neigh_freq_band[0][0]; + uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0]; size = do_UECapabilityEnquiry( ctxt_pP, buffer, @@ -1333,7 +1334,7 @@ rrc_eNB_generate_NR_UECapabilityEnquiry( T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); int16_t eutra_band = RC.rrc[ctxt_pP->module_id]->configuration.eutra_band[0]; - uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_neigh_freq_band[0][0]; + uint32_t nr_band = RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0]; size = do_NR_UECapabilityEnquiry( ctxt_pP, buffer, @@ -1577,7 +1578,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( int measurements_enabled; uint8_t next_xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); int ret = 0; - ue_context_pP->ue_context.Status = RRC_CONNECTED; + ue_context_pP->ue_context.StatusRrc = RRC_CONNECTED; ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity when UE goes into RRC_CONNECTED ue_context_pP->ue_context.reestablishment_xid = next_xid; SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; @@ -2207,7 +2208,7 @@ rrc_eNB_generate_RRCConnectionRelease( #if 0 if(ue_context_pP != NULL) { - if(ue_context_pP->ue_context.Status == RRC_NR_NSA) { + if(ue_context_pP->ue_context.StatusRrc == RRC_NR_NSA) { //rrc_eNB_generate_SgNBReleaseRequest(ctxt_pP,ue_context_pP); } } @@ -3441,6 +3442,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); if (ue_context_pP->ue_context.does_nr) { + LOG_I(RRC,"Configuring measurement for NR cell\n"); ReportConfig_NR->reportConfigId = 7; ReportConfig_NR->reportConfig.present = LTE_ReportConfigToAddMod__reportConfig_PR_reportConfigInterRAT; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.present = LTE_ReportConfigInterRAT__triggerType_PR_event; @@ -4567,7 +4569,6 @@ rrc_eNB_process_MeasurementReport( case 7: LOG_D(RRC, "NR event frame %d subframe %d\n", ctxt_pP->frame, ctxt_pP->subframe); - printf("NR event frame %d subframe %d\n", ctxt_pP->frame, ctxt_pP->subframe); break; default: @@ -4585,13 +4586,16 @@ rrc_eNB_process_MeasurementReport( /* TODO: improve NR triggering */ if (measResults2->measId == 7) { - if ((ue_context_pP->ue_context.Status != RRC_NR_NSA) && (ue_context_pP->ue_context.Status != RRC_NR_NSA_RECONFIGURED)) { + if ((ue_context_pP->ue_context.StatusRrc != RRC_NR_NSA) && (ue_context_pP->ue_context.StatusRrc != RRC_NR_NSA_RECONFIGURED)) { MessageDef *msg; - ue_context_pP->ue_context.Status = RRC_NR_NSA; + ue_context_pP->ue_context.StatusRrc = RRC_NR_NSA; ue_context_pP->ue_context.gnb_rnti = -1; // set when receiving X2AP_ENDC_SGNB_ADDITION_REQ_ACK ue_context_pP->ue_context.gnb_x2_assoc_id = -1; // set when receiving X2AP_ENDC_SGNB_ADDITION_REQ_ACK if(is_en_dc_supported(ue_context_pP->ue_context.UE_Capability)) { + + AssertFatal(measResults2->measResultNeighCells!=NULL,"no measResultNeighCells, shouldn't happen!\n"); + AssertFatal(measResults2->measResultNeighCells->present==LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15,"field is not LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15"); /** to add gNB as Secondary node CG-ConfigInfo to be added as per 36.423 r15 **/ if(encode_CG_ConfigInfo(enc_buf,sizeof(enc_buf),ue_context_pP,&enc_size) == RRC_OK) LOG_I(RRC,"CG-ConfigInfo encoded successfully\n"); @@ -4610,6 +4614,7 @@ rrc_eNB_process_MeasurementReport( X2AP_ENDC_SGNB_ADDITION_REQ(msg).rrc_buffer_size = enc_size; X2AP_ENDC_SGNB_ADDITION_REQ(msg).target_physCellId + //= measResults2->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->pci_r15; = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId; //For the moment we have a single E-RAB which will be the one to be added to the gNB @@ -4632,6 +4637,32 @@ rrc_eNB_process_MeasurementReport( return; } } + + if (!ue_context_pP->ue_context.measResults->measResultNeighCells) { + ue_context_pP->ue_context.measResults->measResultNeighCells = calloc(1,sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells)); + ue_context_pP->ue_context.measResults->measResultNeighCells->present = LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15; + ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array = calloc(1, sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array)); + ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0] = calloc(1, sizeof(*ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0])); + ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.count = 1; + } + struct LTE_MeasResultCellNR_r15 *ueCtxtMeasResultCellNR_r15 = ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]; + const struct LTE_MeasResultCellNR_r15 *measNeighCellNR0 = measResults2->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]; + ueCtxtMeasResultCellNR_r15->pci_r15 = measNeighCellNR0->pci_r15; + if (!ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrpResult_r15) + ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrpResult_r15 = calloc(1, sizeof(*ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrpResult_r15)); + if (!ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrqResult_r15) + ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrqResult_r15 = calloc(1, sizeof(*ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrqResult_r15)); + *ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrpResult_r15 = *measNeighCellNR0->measResultCell_r15.rsrpResult_r15; + *ueCtxtMeasResultCellNR_r15->measResultCell_r15.rsrqResult_r15 = *measNeighCellNR0->measResultCell_r15.rsrqResult_r15; + if (measNeighCellNR0->measResultRS_IndexList_r15) { + if (!ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15) { + ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15 = calloc(1,sizeof(*ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15)); + ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array = calloc(1, sizeof(ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array)); + ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array[0] = calloc(1, sizeof(*ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array)); + ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.count = 1; + } + ueCtxtMeasResultCellNR_r15->measResultRS_IndexList_r15->list.array[0]->ssb_Index_r15 = measNeighCellNR0->measResultRS_IndexList_r15->list.array[0]->ssb_Index_r15; + } } if (measResults2->measResultNeighCells == NULL) @@ -4693,12 +4724,12 @@ rrc_eNB_process_MeasurementReport( LOG_D(RRC, "A3 event is triggered...\n"); /* if the UE is not in handover mode, start handover procedure */ - if (ue_context_pP->ue_context.Status != RRC_HO_EXECUTION) { + if (ue_context_pP->ue_context.StatusRrc != RRC_HO_EXECUTION) { MessageDef *msg; LOG_I(RRC, "Send HO preparation message at frame %d and subframe %d \n", ctxt_pP->frame, ctxt_pP->subframe); /* HO info struct may not be needed anymore */ ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); - ue_context_pP->ue_context.Status = RRC_HO_EXECUTION; + ue_context_pP->ue_context.StatusRrc = RRC_HO_EXECUTION; ue_context_pP->ue_context.handover_info->state = HO_REQUEST; /* HO Preparation message */ msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_HANDOVER_REQ); @@ -4830,7 +4861,7 @@ void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_re RB_INSERT(rrc_ue_tree_s, &RC.rrc[mod_id]->rrc_ue_head, ue_context_target_p); LOG_D(RRC, "eNB %d: Created new UE context uid %u\n", mod_id, ue_context_target_p->local_uid); ue_context_target_p->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_target_p->ue_context.handover_info))); - //ue_context_target_p->ue_context.Status = RRC_HO_EXECUTION; + //ue_context_target_p->ue_context.StatusRrc = RRC_HO_EXECUTION; //ue_context_target_p->ue_context.handover_info->state = HO_ACK; ue_context_target_p->ue_context.handover_info->x2_id = m->x2_id; ue_context_target_p->ue_context.handover_info->assoc_id = m->target_assoc_id; @@ -4905,7 +4936,7 @@ void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_re } rrc_eNB_process_X2AP_TUNNEL_SETUP_REQ(mod_id, ue_context_target_p); - ue_context_target_p->ue_context.Status = RRC_HO_EXECUTION; + ue_context_target_p->ue_context.StatusRrc = RRC_HO_EXECUTION; ue_context_target_p->ue_context.handover_info->state = HO_ACK; } @@ -4968,7 +4999,7 @@ void rrc_eNB_handover_ue_context_release( ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; } - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->module_id, msg_delete_tunnels_p); + itti_send_msg_to_task(TASK_VARIABLE, ctxt_pP->module_id, msg_delete_tunnels_p); struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids(RC.rrc[ctxt_pP->module_id], 0, eNB_ue_s1ap_id); @@ -5020,7 +5051,7 @@ flexran_rrc_eNB_trigger_handover (int mod_id, LOG_D(RRC, "Handover is triggered by FlexRAN controller...\n"); /* if the UE is not in handover mode, start handover procedure */ - if (ue_context_pP->ue_context.Status != RRC_HO_EXECUTION) { + if (ue_context_pP->ue_context.StatusRrc != RRC_HO_EXECUTION) { MessageDef *msg; LOG_I(RRC, "Send HO preparation message at frame %d and subframe %d \n", ctxt_pP->frame, ctxt_pP->subframe); /* Check memory leakage for handover info */ @@ -5028,7 +5059,7 @@ flexran_rrc_eNB_trigger_handover (int mod_id, //free(ue_context_pP->ue_context.handover_info); //} ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); - ue_context_pP->ue_context.Status = RRC_HO_EXECUTION; + ue_context_pP->ue_context.StatusRrc = RRC_HO_EXECUTION; ue_context_pP->ue_context.handover_info->state = HO_REQUEST; /* HO Preparation message */ msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_HANDOVER_REQ); @@ -5089,7 +5120,7 @@ check_handovers( RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { ctxt_pP->rnti = ue_context_p->ue_id_rnti; - if (ue_context_p->ue_context.Status == RRC_HO_EXECUTION && ue_context_p->ue_context.handover_info != NULL) { + if (ue_context_p->ue_context.StatusRrc == RRC_HO_EXECUTION && ue_context_p->ue_context.handover_info != NULL) { /* in the source, UE in HO_PREPARE mode */ if (ue_context_p->ue_context.handover_info->state == HO_PREPARE) { LOG_D(RRC, @@ -5140,7 +5171,7 @@ check_handovers( } } - if (ue_context_p->ue_context.Status == RRC_RECONFIGURED + if (ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED && ue_context_p->ue_context.handover_info != NULL && ue_context_p->ue_context.handover_info->forwarding_state == FORWARDING_NO_EMPTY ) { MessageDef *msg_p; @@ -5206,7 +5237,7 @@ check_handovers( ue_context_p->ue_context.handover_info->forwarding_state = FORWARDING_EMPTY; } - if( ue_context_p->ue_context.Status == RRC_RECONFIGURED && + if( ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED && ue_context_p->ue_context.handover_info != NULL && ue_context_p->ue_context.handover_info->forwarding_state == FORWARDING_EMPTY && ue_context_p->ue_context.handover_info->endmark_state == ENDMARK_NO_EMPTY && @@ -5709,7 +5740,7 @@ rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ct //SchedulingRequestConfig__setup__dsr_TransMax_n4); // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = - LTE_SchedulingRequestConfig__setup__dsr_TransMax_n4; + LTE_SchedulingRequestConfig__setup__dsr_TransMax_n64; LOG_D(RRC, "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id); @@ -6557,10 +6588,9 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( (int)DRB_configList->list.array[i]->drb_Identity, (int)*DRB_configList->list.array[i]->logicalChannelIdentity); /* For pre-ci tests */ - LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n", + LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received LTE_RRCConnectionReconfigurationComplete, reconfiguring DRB %d/LCID %d\n", ctxt_pP->module_id, ctxt_pP->frame, - oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid], (int)DRB_configList->list.array[i]->drb_Identity, (int)*DRB_configList->list.array[i]->logicalChannelIdentity); @@ -6585,7 +6615,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n", ctxt_pP->module_id, ctxt_pP->module_id, (long int)((ue_context_pP->local_uid * LTE_maxDRB) + DRB_configList->list.array[i]->drb_Identity)); - ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; + ue_module_id = 0; // Was oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; rb_conf_ipv4(0, //add ue_module_id, //cx ctxt_pP->module_id, //inst @@ -7198,7 +7228,7 @@ rrc_eNB_decode_ccch( } //c-plane not end - if((ue_context_p->ue_context.Status != RRC_RECONFIGURED) && (ue_context_p->ue_context.reestablishment_cause == LTE_ReestablishmentCause_spare1)) { + if((ue_context_p->ue_context.StatusRrc != RRC_RECONFIGURED) && (ue_context_p->ue_context.reestablishment_cause == LTE_ReestablishmentCause_spare1)) { LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" LTE_RRCConnectionReestablishmentRequest (UE %x c-plane is not end), let's reject the UE\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti); @@ -7210,9 +7240,9 @@ rrc_eNB_decode_ccch( LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRRCConnectionReconfigurationComplete(Previous) don't receive, delete the Previous UE,\nprevious Status %d, new Status RRC_RECONFIGURED\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.Status + ue_context_p->ue_context.StatusRrc ); - ue_context_p->ue_context.Status = RRC_RECONFIGURED; + ue_context_p->ue_context.StatusRrc = RRC_RECONFIGURED; protocol_ctxt_t ctxt_old_p; PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt_old_p, ctxt_pP->instance, @@ -7581,42 +7611,239 @@ rrc_eNB_decode_ccch( return rval; } +#define NCE nonCriticalExtension + +static void +get_ue_Category( + LTE_UE_EUTRA_Capability_t *c, + long *catDL, + long *catUL +) +{ + if (c != NULL) { // v8.6 + *catDL=c->ue_Category; *catUL=c->ue_Category; + struct LTE_UE_EUTRA_Capability_v920_IEs *c92=c->NCE; + if (c92 != NULL) { // v9.2 + struct LTE_UE_EUTRA_Capability_v940_IEs *c94=c92->NCE; + if (c94 != NULL) { // v9.4 + struct LTE_UE_EUTRA_Capability_v1020_IEs *c102=c94->NCE; + if (c102 != NULL) { // v10.2 + if (c102->ue_Category_v1020) {*catDL=*c102->ue_Category_v1020;*catUL=*c102->ue_Category_v1020;} + struct LTE_UE_EUTRA_Capability_v1060_IEs *c106=c102->NCE; + if (c106 != NULL) { // v10.6 + struct LTE_UE_EUTRA_Capability_v1090_IEs *c109=c106->NCE; + if (c109 != NULL) { // v10.9 + struct LTE_UE_EUTRA_Capability_v1130_IEs *c113=c109->NCE; + if (c113 != NULL) { // v11.3 + struct LTE_UE_EUTRA_Capability_v1170_IEs *c117=c113->NCE; + if (c117 != NULL) { // v11.7 + if (c117->ue_Category_v1170) {*catDL=*c117->ue_Category_v1170; + struct LTE_UE_EUTRA_Capability_v1180_IEs *c118=c117->NCE; + if (c118 != NULL) { // v11.8 + struct LTE_UE_EUTRA_Capability_v11a0_IEs *c11a=c118->NCE; + if (c11a != NULL) { // v11.a + if (c11a->ue_Category_v11a0) {*catDL=*c11a->ue_Category_v11a0;*catUL=*c11a->ue_Category_v11a0;} + struct LTE_UE_EUTRA_Capability_v1250_IEs *c125=c11a->NCE; + if (c125 != NULL) { // v12.5 + if (c125->ue_CategoryDL_r12) *catDL=*c125->ue_CategoryDL_r12; + if (c125->ue_CategoryUL_r12) *catUL=*c125->ue_CategoryUL_r12; + struct LTE_UE_EUTRA_Capability_v1260_IEs *c126=c125->NCE; + if (c126 != NULL) { // v12.6 + if (c126->ue_CategoryDL_v1260) *catDL=*c126->ue_CategoryDL_v1260; + struct LTE_UE_EUTRA_Capability_v1270_IEs *c127=c126->NCE; + if (c127 != NULL) { // v12.7 + struct LTE_UE_EUTRA_Capability_v1280_IEs *c128=c127->NCE; + if (c128 != NULL) { // v12.8 + struct LTE_UE_EUTRA_Capability_v1310_IEs *c131=c128->NCE; + if (c131 != NULL) { // v13.1 + if (c131->ue_CategoryDL_v1310 && *c131->ue_CategoryDL_v1310 == 0) *catDL=17; + if (c131->ue_CategoryDL_v1310 && *c131->ue_CategoryDL_v1310 == 1) *catDL=-1; + if (c131->ue_CategoryUL_v1310 && *c131->ue_CategoryUL_v1310 == 0) *catUL=14; + if (c131->ue_CategoryUL_v1310 && *c131->ue_CategoryUL_v1310 == 1) *catUL=-1; + struct LTE_UE_EUTRA_Capability_v1320_IEs *c132=c131->NCE; + if (c132 != NULL) { //v13.2 + struct LTE_UE_EUTRA_Capability_v1330_IEs *c133=c132->NCE; + if (c133 != NULL) { // v13.3 + if (c133->ue_CategoryDL_v1330) *catDL=*c133->ue_CategoryDL_v1330; + struct LTE_UE_EUTRA_Capability_v1340_IEs *c134=c133->NCE; + if (c134 != NULL) { // v13.4 + if (c134->ue_CategoryUL_v1340) *catUL=*c134->ue_CategoryUL_v1340; + struct LTE_UE_EUTRA_Capability_v1350_IEs *c135=c134->NCE; + if (c135 != NULL) { // v13.5 + if (c135->ue_CategoryDL_v1350) *catDL=99; // Cat 1Bis + if (c135->ue_CategoryUL_v1350) *catUL=99; // Cat 1Bis + struct LTE_UE_EUTRA_Capability_v1360_IEs *c136=c135->NCE; + if (c136 != NULL) { // v13.6 + struct LTE_UE_EUTRA_Capability_v1430_IEs *c143=c136->NCE; + if (c143 != NULL) { // v14.3 + if (c143->ue_CategoryDL_v1430 && *c143->ue_CategoryDL_v1430 == LTE_UE_EUTRA_Capability_v1430_IEs__ue_CategoryDL_v1430_m2) *catDL=-2; + if (c143->ue_CategoryUL_v1430 && *c143->ue_CategoryUL_v1430 == LTE_UE_EUTRA_Capability_v1430_IEs__ue_CategoryDL_v1430_m2) *catUL=-2; + if (c143->ue_CategoryUL_v1430) *catUL=16+*c143->ue_CategoryUL_v1430; + if (c143->ue_CategoryUL_v1430b)*catUL=21; + struct LTE_UE_EUTRA_Capability_v1440_IEs *c144=c143->NCE; + if (c144 != NULL) { // v14.4 + struct LTE_UE_EUTRA_Capability_v1450_IEs *c145=c144->NCE; + if (c145 != NULL) { // v14.5 + if (c145->ue_CategoryDL_v1450) *catDL=*c145->ue_CategoryDL_v1450; + struct LTE_UE_EUTRA_Capability_v1460_IEs *c146=c145->NCE; + if (c146 != NULL) { // v14.6 + if (c146->ue_CategoryDL_v1460) *catDL=*c146->ue_CategoryDL_v1460; + struct LTE_UE_EUTRA_Capability_v1510_IEs *c151=c146->NCE; + if (c151 != NULL) { // v15.1 + struct LTE_UE_EUTRA_Capability_v1520_IEs *c152=c151->NCE; + if (c152 != NULL) { // v15.20 + struct LTE_UE_EUTRA_Capability_v1530_IEs *c153=c152->NCE; + if (c153 != NULL) { // v15.30 + if (c153->ue_CategoryDL_v1530) *catDL=*c153->ue_CategoryDL_v1530; + if (c153->ue_CategoryUL_v1530) *catUL=*c153->ue_CategoryUL_v1530; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +static int +is_ul_64QAM_supported( + LTE_UE_EUTRA_Capability_t *c +) //----------------------------------------------------------------------------- +{ + return c != NULL // R8 + && c->NCE != NULL // R92 + && c->NCE->NCE != NULL // R94 + && c->NCE->NCE->NCE != NULL // R102 + && c->NCE->NCE->NCE->NCE != NULL // R106 + && c->NCE->NCE->NCE->NCE->NCE != NULL // R109 + && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250 != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250 != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array[0]->ul_64QAM_r12 != NULL + && *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array[0]->ul_64QAM_r12==LTE_SupportedBandEUTRA_v1250__ul_64QAM_r12_supported; +} + +static int +is_dl_256QAM_supported( + LTE_UE_EUTRA_Capability_t *c +) +//----------------------------------------------------------------------------- +{ + return c != NULL // R8 + && c->NCE != NULL // R92 + && c->NCE->NCE != NULL // R94 + && c->NCE->NCE->NCE != NULL // R102 + && c->NCE->NCE->NCE->NCE != NULL // R106 + && c->NCE->NCE->NCE->NCE->NCE != NULL // R109 + && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250 != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250 != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array[0]->dl_256QAM_r12 != NULL + && *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1250->supportedBandListEUTRA_v1250->list.array[0]->dl_256QAM_r12==LTE_SupportedBandEUTRA_v1250__dl_256QAM_r12_supported; + +} +static int +is_ul_256QAM_supported( + LTE_UE_EUTRA_Capability_t *c +) +//----------------------------------------------------------------------------- +{ + return c != NULL // R8 + && c->NCE != NULL // R92 + && c->NCE->NCE != NULL // R94 + && c->NCE->NCE->NCE != NULL // R102 + && c->NCE->NCE->NCE->NCE != NULL // R106 + && c->NCE->NCE->NCE->NCE->NCE != NULL // R109 + && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R126 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 127 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 128 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //131 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //132 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //133 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //134 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //135 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //136 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //143 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430 != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430 != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430 != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430->list.array != NULL + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430->list.array[0]->ul_256QAM_r14!=NULL + && *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->rf_Parameters_v1430->supportedBandCombination_v1430->list.array[0]->bandParameterList_v1430->list.array[0]->ul_256QAM_r14==LTE_BandParameters_v1430__ul_256QAM_r14_supported; +} + static int is_en_dc_supported( LTE_UE_EUTRA_Capability_t *c ) //----------------------------------------------------------------------------- { - /* to be refined - check that the eNB is connected to a gNB, check that - * the bands supported by the UE include the band of the gNB + /* to be refined - check that the bands supported by the UE include + * the band of the gNB */ -#define NCE nonCriticalExtension - return c != NULL - && c->NCE != NULL - && c->NCE->NCE != NULL - && c->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL - && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL + return c != NULL // R8 + && c->NCE != NULL // R92 + && c->NCE->NCE != NULL // R94 + && c->NCE->NCE->NCE != NULL // R102 + && c->NCE->NCE->NCE->NCE != NULL // R106 + && c->NCE->NCE->NCE->NCE->NCE != NULL // R109 + && c->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R113 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R117 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R118 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R11a + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R125 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // R126 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 127 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL // 128 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //131 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //132 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //133 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //134 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //135 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //136 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //143 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //144 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //145 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //146 + && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE != NULL //151 && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15 != NULL && c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 != NULL && *c->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->NCE->irat_ParametersNR_r15->en_DC_r15 == @@ -7624,6 +7851,45 @@ is_en_dc_supported( #undef NCE } +int to_nr_rsrpq(long rsrpq_result,int nr_band) { + + switch(nr_band) { + case 1: // A + case 70: + case 74: + case 34: + case 38: + case 39: + case 40: + case 50: + case 51: + return((rsrpq_result*10)-1180); + case 66: // B + return((rsrpq_result*10)-1175); + case 77: // C + case 78: + case 79: + return((rsrpq_result*10)-1170); + case 28: // D + return((rsrpq_result*10)-1165); + case 2: + case 5: + case 7: + case 41: // E + return((rsrpq_result*10)-1160); + case 3: // G + case 8: + case 12: + case 20: + case 71: + return((rsrpq_result*10)-1150); + case 25: // H + return((rsrpq_result*10)-1145); + default: + AssertFatal(1==0,"Illegal NR band %d\n",nr_band); + } +} + //----------------------------------------------------------------------------- int rrc_eNB_decode_dcch( @@ -7748,7 +8014,7 @@ rrc_eNB_decode_dcch( int flexran_agent_handover = 0; if (EPC_MODE_ENABLED) { - if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) { + if (ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED) { dedicated_DRB = 1; LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", @@ -7773,7 +8039,7 @@ rrc_eNB_decode_dcch( dedicated_DRB = 2; RC.mac[ctxt_pP->module_id]->UE_info.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; } - } else if (ue_context_p->ue_context.Status == RRC_HO_EXECUTION) { + } else if (ue_context_p->ue_context.StatusRrc == RRC_HO_EXECUTION) { int16_t UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); if(UE_id == -1) { @@ -7787,7 +8053,7 @@ rrc_eNB_decode_dcch( RC.rrc[ctxt_pP->module_id]->Nb_ue++; dedicated_DRB = 3; RC.mac[ctxt_pP->module_id]->UE_info.UE_sched_ctrl[UE_id].crnti_reconfigurationcomplete_flag = 0; - ue_context_p->ue_context.Status = RRC_RECONFIGURED; + ue_context_p->ue_context.StatusRrc = RRC_RECONFIGURED; if(ue_context_p->ue_context.handover_info) { ue_context_p->ue_context.handover_info->state = HO_CONFIGURED; @@ -7796,7 +8062,7 @@ rrc_eNB_decode_dcch( LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_HO_EXECUTION (xid %ld)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - } else if(ue_context_p->ue_context.Status == RRC_NR_NSA) { + } else if(ue_context_p->ue_context.StatusRrc == RRC_NR_NSA) { //Looking for a condition to trigger S1AP E-RAB-Modification-indication, based on the reception of RRCConnectionReconfigurationComplete //including NR specific elements. if(ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8. @@ -7815,7 +8081,7 @@ rrc_eNB_decode_dcch( nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension ->scg_ConfigResponseNR_r15!=NULL) { dedicated_DRB = -1; /* put a value that does not run anything below */ - ue_context_p->ue_context.Status = RRC_NR_NSA_RECONFIGURED; + ue_context_p->ue_context.StatusRrc = RRC_NR_NSA_RECONFIGURED; /*Trigger E-RAB Modification Indication */ rrc_eNB_send_E_RAB_Modification_Indication(ctxt_pP, ue_context_p); /* send reconfiguration complete to gNB */ @@ -7829,7 +8095,7 @@ rrc_eNB_decode_dcch( } } else { dedicated_DRB = 0; - ue_context_p->ue_context.Status = RRC_RECONFIGURED; + ue_context_p->ue_context.StatusRrc = RRC_RECONFIGURED; LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); @@ -7838,7 +8104,7 @@ rrc_eNB_decode_dcch( ue_context_p->ue_context.reestablishment_xid = -1; } else { dedicated_DRB = 1; - ue_context_p->ue_context.Status = RRC_RECONFIGURED; + ue_context_p->ue_context.StatusRrc = RRC_RECONFIGURED; LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); @@ -8193,7 +8459,7 @@ rrc_eNB_decode_dcch( ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,ue_context_p->ue_context.UE_Capability_nr); ue_context_p->ue_context.UE_Capability_nr = 0; } - + LOG_I(RRC,"Received NR_UE_Capabilities\n"); dec_rval = uper_decode(NULL, &asn_DEF_NR_UE_NR_Capability, (void **)&ue_context_p->ue_context.UE_Capability_nr, @@ -8218,6 +8484,8 @@ rrc_eNB_decode_dcch( if (ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.array[i]->rat_Type == LTE_RAT_Type_eutra_nr) { + LOG_I(RRC,"Received UE_Capabilities_MRDC\n"); + if(ue_context_p->ue_context.UE_Capability_MRDC) { ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,ue_context_p->ue_context.UE_Capability_MRDC); ue_context_p->ue_context.UE_Capability_MRDC = 0; @@ -8289,8 +8557,13 @@ rrc_eNB_decode_dcch( ue_context_p->ue_context.UE_Capability = 0; } - if (dec_rval.code == RC_OK) - ue_context_p->ue_context.does_nr = is_en_dc_supported(ue_context_p->ue_context.UE_Capability); + if (dec_rval.code == RC_OK) { + /* do NR only if at least one gNB connected */ + if (RC.rrc[ctxt_pP->module_id]->num_gnb_cells != 0) + ue_context_p->ue_context.does_nr = is_en_dc_supported(ue_context_p->ue_context.UE_Capability); + else + ue_context_p->ue_context.does_nr = 0; + } if (EPC_MODE_ENABLED) { rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, @@ -8569,14 +8842,13 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { F1AP_SETUP_RESP (msg_p).nr_cellid[cu_cell_ind] = rrc->nr_cellid; F1AP_SETUP_RESP (msg_p).nrpci[cu_cell_ind] = f1_setup_req->nr_pci[i]; int num_SI= 0; - if (rrc->carrier[0].SIB23) { - F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][num_SI] = rrc->carrier[0].SIB23; - F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][num_SI] = rrc->carrier[0].sizeof_SIB23; - //printf("SI %d size %d: ", 0, F1AP_SETUP_RESP(msg_p).SI_container_length[j][num_SI]); - //for (int n = 0; n < F1AP_SETUP_RESP(msg_p).SI_container_length[j][num_SI]; n++) - // printf("%02x ", F1AP_SETUP_RESP(msg_p).SI_container[0][num_SI][n]); - //printf("\n"); + F1AP_SETUP_RESP (msg_p).SI_container[cu_cell_ind][2+num_SI] = rrc->carrier[0].SIB23; + F1AP_SETUP_RESP (msg_p).SI_container_length[cu_cell_ind][2+num_SI] = rrc->carrier[0].sizeof_SIB23; + printf("SI %d size %d: ", 0, F1AP_SETUP_RESP(msg_p).SI_container_length[j][2+num_SI]); + for (int n = 0; n < F1AP_SETUP_RESP(msg_p).SI_container_length[j][2+num_SI]; n++) + printf("%02x ", F1AP_SETUP_RESP(msg_p).SI_container[0][2+num_SI][n]); + printf("\n"); num_SI++; } @@ -8775,10 +9047,6 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { struct rrc_eNB_ue_context_s *ue_to_be_removed[NUMBER_OF_UE_MAX]; int removed_ue_count = 0; int cur_ue; -#ifdef LOCALIZATION - double estimated_distance = 0; - protocol_ctxt_t ctxt; -#endif MessageDef *msg; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX, VCD_FUNCTION_IN); @@ -8790,22 +9058,53 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { } // check for UL failure or for UE to be released + FILE *fd=NULL; + if ((ctxt_pP->frame&127) == 0 && ctxt_pP->subframe ==0) + fd=fopen("RRC_stats.log","w+"); + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { ctxt_pP->rnti = ue_context_p->ue_id_rnti; - if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe == 0)) { - if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { - LOG_I(RRC, "UE rnti %x: S-TMSI %x failure timer %d/8\n", - ue_context_p->ue_context.rnti, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.ul_failure_timer); - } else { - LOG_I(RRC, "UE rnti %x failure timer %d/8\n", - ue_context_p->ue_context.rnti, - ue_context_p->ue_context.ul_failure_timer); + if ((ctxt_pP->frame&127) == 0 && ctxt_pP->subframe ==0) { + if (fd) { + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { + fprintf(fd,"RRC UE rnti %x: S-TMSI %x failure timer %d/8\n", + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.ul_failure_timer); + } else { + fprintf(fd,"RRC UE rnti %x failure timer %d/8\n", + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.ul_failure_timer); + } + + if (ue_context_p->ue_context.UE_Capability) { + long catDL,catUL; + get_ue_Category(ue_context_p->ue_context.UE_Capability,&catDL,&catUL); + fprintf(fd,"RRC UE cap: CatDL %ld, CatUL %ld, 64QAM UL %s, 256 QAM DL %s, 256 QAM UL %s, ENDC %s,\n", + catDL,catUL, + is_ul_64QAM_supported(ue_context_p->ue_context.UE_Capability) == 1 ? "yes" : "no", + is_dl_256QAM_supported(ue_context_p->ue_context.UE_Capability) == 1 ? "yes" : "no", + is_ul_256QAM_supported(ue_context_p->ue_context.UE_Capability) == 1 ? "yes" : "no", + is_en_dc_supported(ue_context_p->ue_context.UE_Capability) == 1 ? "yes" : "no"); + } + if (ue_context_p->ue_context.measResults) { + fprintf(fd, "RRC PCell RSRP %ld, RSRQ %ld\n", ue_context_p->ue_context.measResults->measResultPCell.rsrpResult-140, + ue_context_p->ue_context.measResults->measResultPCell.rsrqResult/2 - 20); + if (ue_context_p->ue_context.measResults->measResultNeighCells && + ue_context_p->ue_context.measResults->measResultNeighCells->present == LTE_MeasResults__measResultNeighCells_PR_measResultNeighCellListNR_r15) { + + fprintf(fd,"NR_pci %ld\n",ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->pci_r15); + if(ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15) + fprintf(fd,"NR_rsrp %f dB\n",to_nr_rsrpq(*ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrpResult_r15,RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0])/10.0); + if (ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15) + fprintf(fd,"NR_rsrq %f dB\n",to_nr_rsrpq(*ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultCell_r15.rsrqResult_r15,RC.rrc[ctxt_pP->module_id]->nr_gnb_freq_band[0][0])/10.0); + if (ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultRS_IndexList_r15) + fprintf(fd,"NR_ssb_index %ld\n",ue_context_p->ue_context.measResults->measResultNeighCells->choice.measResultNeighCellListNR_r15.list.array[0]->measResultRS_IndexList_r15->list.array[0]->ssb_Index_r15); + } + } } } - if (ue_context_p->ue_context.ul_failure_timer > 0) { ue_context_p->ue_context.ul_failure_timer++; @@ -8973,8 +9272,8 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { } /* remove UE from gNB if UE is in NSA mode */ - if (ue_to_be_removed[cur_ue]->ue_context.Status == RRC_NR_NSA || - ue_to_be_removed[cur_ue]->ue_context.Status == RRC_NR_NSA_RECONFIGURED) { + if (ue_to_be_removed[cur_ue]->ue_context.StatusRrc == RRC_NR_NSA || + ue_to_be_removed[cur_ue]->ue_context.StatusRrc == RRC_NR_NSA_RECONFIGURED) { MessageDef *message_p; message_p = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_RELEASE_REQUEST); X2AP_ENDC_SGNB_RELEASE_REQUEST(message_p).rnti = ue_to_be_removed[cur_ue]->ue_context.gnb_rnti; @@ -8982,7 +9281,7 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { X2AP_ENDC_SGNB_RELEASE_REQUEST(message_p).cause = X2AP_CAUSE_RADIO_CONNECTION_WITH_UE_LOST; itti_send_msg_to_task(TASK_X2AP, ctxt_pP->module_id, message_p); /* set state to RRC_NR_NSA_DELETED to avoid sending X2AP_ENDC_SGNB_RELEASE_REQUEST again later */ - ue_to_be_removed[cur_ue]->ue_context.Status = RRC_NR_NSA_DELETED; + ue_to_be_removed[cur_ue]->ue_context.StatusRrc = RRC_NR_NSA_DELETED; } rrc_eNB_free_UE(ctxt_pP->module_id, ue_to_be_removed[cur_ue]); @@ -8997,31 +9296,9 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { } } -#ifdef RRC_LOCALIZATION - /* for the localization, only primary CC_id might be relevant*/ - gettimeofday(&ts, NULL); - current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000; - ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms; - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - ctxt = *ctxt_pP; - ctxt.rnti = ue_context_p->ue_context.rnti; - estimated_distance = rrc_get_estimated_ue_distance(&ctxt, CC_id, RC.rrc[ctxt_pP->module_id]->loc_type); + if (fd!=NULL) fclose(fd); + - if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) && - estimated_distance != -1) { - LOG_D(LOCALIZE, "RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n", - ctxt.rnti, - ctxt_pP->module_id, - current_timestamp_ms, - ctxt_pP->frame, - estimated_distance); - LOG_D(LOCALIZE, "RRC status %d\n", - ue_context_p->ue_context.Status); - push_front(&RC.rrc[ctxt_pP->module_id]->loc_list, estimated_distance); - RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms; - } // end if - } // end RB_FOREACH -#endif (void)ts; /* remove gcc warning "unused variable" */ (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */ (void)current_timestamp_ms; /* remove gcc warning "unused variable" */ @@ -9029,22 +9306,22 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) { } void rrc_eNB_process_ENDC_x2_setup_request(int mod_id, x2ap_ENDC_setup_req_t *m) { - if (RC.rrc[mod_id]->num_neigh_cells > MAX_NUM_NEIGH_CELLs) { - LOG_E(RRC, "Error: number of neighbouring cells is exceeded \n"); + if (RC.rrc[mod_id]->num_gnb_cells >= MAX_NUM_GNB_CELLs) { + LOG_E(RRC, "Error: number of gNB cells is exceeded\n"); return; } if (m->num_cc > MAX_NUM_CCs) { - LOG_E(RRC, "Error: number of neighbouring cells carriers is exceeded \n"); + LOG_E(RRC, "Error: number of gNB cells carriers is exceeded \n"); return; } - RC.rrc[mod_id]->num_neigh_cells++; - RC.rrc[mod_id]->num_neigh_cells_cc[RC.rrc[mod_id]->num_neigh_cells-1] = m->num_cc; + RC.rrc[mod_id]->num_gnb_cells++; + RC.rrc[mod_id]->num_gnb_cells_cc[RC.rrc[mod_id]->num_gnb_cells-1] = m->num_cc; for (int i=0; inum_cc; i++) { - RC.rrc[mod_id]->neigh_cells_id[RC.rrc[mod_id]->num_neigh_cells-1][i] = m->Nid_cell[i]; - RC.rrc[mod_id]->nr_neigh_freq_band[RC.rrc[mod_id]->num_neigh_cells-1][i] = m->servedNrCell_band[i]; + RC.rrc[mod_id]->gnb_cells_id[RC.rrc[mod_id]->num_gnb_cells-1][i] = m->Nid_cell[i]; + RC.rrc[mod_id]->nr_gnb_freq_band[RC.rrc[mod_id]->num_gnb_cells-1][i] = m->servedNrCell_band[i]; } } @@ -9174,13 +9451,13 @@ void rrc_eNB_process_ENDC_DC_prep_timeout(module_id_t module_id, x2ap_ENDC_dc_pr return; } - if (ue_context->ue_context.Status != RRC_NR_NSA) { + if (ue_context->ue_context.StatusRrc != RRC_NR_NSA) { LOG_E(RRC, "receiving DC prep timeout for UE rnti %d not in state RRC_NR_NSA\n", m->rnti); return; } LOG_I(RRC, "DC prep timeout for UE rnti %d, put back to RRC_RECONFIGURED mode\n", m->rnti); - ue_context->ue_context.Status = RRC_RECONFIGURED; + ue_context->ue_context.StatusRrc = RRC_RECONFIGURED; } void rrc_eNB_process_ENDC_sgNB_release_required(module_id_t module_id, x2ap_ENDC_sgnb_release_required_t *m) @@ -9201,7 +9478,7 @@ void rrc_eNB_process_ENDC_sgNB_release_required(module_id_t module_id, x2ap_ENDC ue_context->ue_context.ue_release_timer_thres_rrc = 100; ue_context->ue_context.ue_release_timer_rrc = 1; - ue_context->ue_context.Status = RRC_NR_NSA_DELETED; + ue_context->ue_context.StatusRrc = RRC_NR_NSA_DELETED; PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, module_id, /* TODO: should be 'instance' */ @@ -9467,7 +9744,7 @@ void *rrc_enb_process_itti_msg(void *notUsed) { if (X2AP_HANDOVER_CANCEL(msg_p).cause == X2AP_T_RELOC_PREP_TIMEOUT) { /* for prep timeout, simply return to normal state */ /* TODO: be sure that it's correct to set Status to RRC_RECONFIGURED */ - ue_context_p->ue_context.Status = RRC_RECONFIGURED; + ue_context_p->ue_context.StatusRrc = RRC_RECONFIGURED; /* TODO: be sure free is enough here (check memory leaks) */ free(ue_context_p->ue_context.handover_info); ue_context_p->ue_context.handover_info = NULL; diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index e974a28f68..a6af6a4163 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -40,6 +40,7 @@ # include "common/ran_context.h" +#include extern RAN_CONTEXT_t RC; @@ -92,7 +93,6 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( } } - //------------------------------------------------------------------------------ boolean_t gtpv_data_req( @@ -113,64 +113,151 @@ gtpv_data_req( return FALSE; } LOG_D(GTPU,"gtpv_data_req ue rnti %x sdu_sizeP %d rb id %ld", ctxt_pP->rnti, sdu_sizeP, rb_idP); - { - MessageDef *message_p; - // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). - uint8_t *message_buffer; - - if(task_id == TASK_DATA_FORWARDING){ - - LOG_I(GTPU,"gtpv_data_req task_id = TASK_DATA_FORWARDING\n"); - - message_buffer = itti_malloc (TASK_GTPV1_U, TASK_DATA_FORWARDING, sdu_sizeP); - - memcpy (message_buffer, buffer_pP, sdu_sizeP); - - message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_DATA_FORWARDING_IND); - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).frame = ctxt_pP->frame; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).enb_flag = ctxt_pP->enb_flag; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rb_id = rb_idP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).muip = muiP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).confirmp = confirmP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_size = sdu_sizeP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_p = message_buffer; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).mode = modeP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).module_id = ctxt_pP->module_id; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rnti = ctxt_pP->rnti; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).eNB_index = ctxt_pP->eNB_index; - - itti_send_msg_to_task (TASK_DATA_FORWARDING, ctxt_pP->instance, message_p); - return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. - }else if(task_id == TASK_END_MARKER){ - - LOG_I(GTPU,"gtpv_data_req task_id = TASK_END_MARKER\n"); - - message_buffer = itti_malloc (TASK_GTPV1_U, TASK_END_MARKER, sdu_sizeP); - - memcpy (message_buffer, buffer_pP, sdu_sizeP); - - message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_IND); - GTPV1U_ENB_END_MARKER_IND (message_p).frame = ctxt_pP->frame; - GTPV1U_ENB_END_MARKER_IND (message_p).enb_flag = ctxt_pP->enb_flag; - GTPV1U_ENB_END_MARKER_IND (message_p).rb_id = rb_idP; - GTPV1U_ENB_END_MARKER_IND (message_p).muip = muiP; - GTPV1U_ENB_END_MARKER_IND (message_p).confirmp = confirmP; - GTPV1U_ENB_END_MARKER_IND (message_p).sdu_size = sdu_sizeP; - GTPV1U_ENB_END_MARKER_IND (message_p).sdu_p = message_buffer; - GTPV1U_ENB_END_MARKER_IND (message_p).mode = modeP; - GTPV1U_ENB_END_MARKER_IND (message_p).module_id = ctxt_pP->module_id; - GTPV1U_ENB_END_MARKER_IND (message_p).rnti = ctxt_pP->rnti; - GTPV1U_ENB_END_MARKER_IND (message_p).eNB_index = ctxt_pP->eNB_index; - - itti_send_msg_to_task (TASK_END_MARKER, ctxt_pP->instance, message_p); - return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. - } + MessageDef *message_p; + // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). + uint8_t *message_buffer; + + if(task_id == TASK_DATA_FORWARDING){ + + LOG_I(GTPU,"gtpv_data_req task_id = TASK_DATA_FORWARDING\n"); + + message_buffer = itti_malloc (TASK_GTPV1_U, TASK_DATA_FORWARDING, sdu_sizeP); + + memcpy (message_buffer, buffer_pP, sdu_sizeP); + + message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_DATA_FORWARDING_IND); + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).frame = ctxt_pP->frame; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).enb_flag = ctxt_pP->enb_flag; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rb_id = rb_idP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).muip = muiP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).confirmp = confirmP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_size = sdu_sizeP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_p = message_buffer; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).mode = modeP; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).module_id = ctxt_pP->module_id; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rnti = ctxt_pP->rnti; + GTPV1U_ENB_DATA_FORWARDING_IND (message_p).eNB_index = ctxt_pP->eNB_index; + + itti_send_msg_to_task (TASK_DATA_FORWARDING, ctxt_pP->instance, message_p); + return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. + } else if (task_id == TASK_END_MARKER){ + + LOG_I(GTPU,"gtpv_data_req task_id = TASK_END_MARKER\n"); + + message_buffer = itti_malloc (TASK_GTPV1_U, TASK_END_MARKER, sdu_sizeP); + + memcpy (message_buffer, buffer_pP, sdu_sizeP); + + message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_IND); + GTPV1U_ENB_END_MARKER_IND (message_p).frame = ctxt_pP->frame; + GTPV1U_ENB_END_MARKER_IND (message_p).enb_flag = ctxt_pP->enb_flag; + GTPV1U_ENB_END_MARKER_IND (message_p).rb_id = rb_idP; + GTPV1U_ENB_END_MARKER_IND (message_p).muip = muiP; + GTPV1U_ENB_END_MARKER_IND (message_p).confirmp = confirmP; + GTPV1U_ENB_END_MARKER_IND (message_p).sdu_size = sdu_sizeP; + GTPV1U_ENB_END_MARKER_IND (message_p).sdu_p = message_buffer; + GTPV1U_ENB_END_MARKER_IND (message_p).mode = modeP; + GTPV1U_ENB_END_MARKER_IND (message_p).module_id = ctxt_pP->module_id; + GTPV1U_ENB_END_MARKER_IND (message_p).rnti = ctxt_pP->rnti; + GTPV1U_ENB_END_MARKER_IND (message_p).eNB_index = ctxt_pP->eNB_index; + + itti_send_msg_to_task (TASK_END_MARKER, ctxt_pP->instance, message_p); + return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. } - return TRUE; - + LOG_E(RRC, "Impossible state\n"); + return FALSE; } -//#endif +boolean_t gtpv_data_req_new ( + protocol_ctxt_t *ctxt, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id) { + int task; + + if (sdu_buffer_sizeP==0) + task=TASK_END_MARKER; + else + task=TASK_DATA_FORWARDING; + + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt->module_id], ctxt->rnti); + if(ue_context_p == NULL || ue_context_p->ue_context.handover_info == NULL || + ue_context_p->ue_context.StatusRrc != RRC_HO_EXECUTION) { + LOG_E(RRC,"incoming GTP-U for X2 in non HO context\n"); + return false; + } + + /* in the source enb, UE in RRC_HO_EXECUTION mode */ + // We have 2*2=4 cases (data or end marker) * (from slave, from EPC) + if (ue_context_p->ue_context.handover_info->state == HO_COMPLETE) { + LOG_I(GTPU, "source receive END MARKER\n"); + /* set handover state */ + //ue_context_p->ue_context.handover_info->state = HO_END_MARKER; + MessageDef *msg; + // Configure end marker + msg = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_REQ); + GTPV1U_ENB_END_MARKER_REQ(msg).buffer = itti_malloc(TASK_GTPV1_U, TASK_GTPV1_U, GTPU_HEADER_OVERHEAD_MAX + sdu_buffer_sizeP); + memcpy(>PV1U_ENB_END_MARKER_REQ(msg).buffer[GTPU_HEADER_OVERHEAD_MAX], sdu_buffer_pP, sdu_buffer_sizeP); + GTPV1U_ENB_END_MARKER_REQ(msg).length = sdu_buffer_sizeP; + GTPV1U_ENB_END_MARKER_REQ(msg).rnti = ctxt->rnti; + GTPV1U_ENB_END_MARKER_REQ(msg).rab_id = rb_idP; + GTPV1U_ENB_END_MARKER_REQ(msg).offset = GTPU_HEADER_OVERHEAD_MAX; + LOG_I(GTPU, "Send End Marker to GTPV1-U at frame %d and subframe %d \n", ctxt->frame,ctxt->subframe); + itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(ctxt->module_id), msg); + return NW_GTPV1U_OK; + } + + /* target enb */ + // We have 2*2=4 cases (data or end marker) * (from source, from EPC) + if (ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED) { + // It should come from remote eNB + // case end marker by EPC is not possible ? + if (task==TASK_END_MARKER) { + LOG_I(GTPU, "target end receive END MARKER\n"); + // We close the HO, nothing to send to remote ? + ue_context_p->ue_context.handover_info->state = HO_END_MARKER; + gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req; + memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req)); + delete_tunnel_req.rnti = ctxt->rnti; + gtpv1u_delete_x2u_tunnel(ctxt->module_id, &delete_tunnel_req, GTPV1U_TARGET_ENB); + return true; + } else { + /* data packet */ + LOG_I(GTPU, "Received a message data forwarding length %d\n", sdu_buffer_sizeP); + // Is it from remote ENB + // We have to push it to the UE ? + if(ue_context_p->ue_context.handover_info->state != HO_COMPLETE) { + int result = pdcp_data_req( + ctxt, + srb_flagP, + rb_idP, + muiP, // mui + confirmP, // confirm + sdu_buffer_sizeP, + sdu_buffer_pP, + modeP, + sourceL2Id, + destinationL2Id + ); + ue_context_p->ue_context.handover_info->forwarding_state = FORWARDING_NO_EMPTY; + return result; + } else { /* It is from from epc message */ + /* in the source enb, UE in RRC_HO_EXECUTION mode */ + // ????? + return true; + } + } + } + LOG_E(RRC,"This function should return before the end\n"); + return false; +} + void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( module_id_t enb_mod_idP, @@ -181,21 +268,16 @@ void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( LOG_W(RRC, "[eNB] In %s: invalid UE\n", __func__); return; } + gtpv1u_enb_delete_tunnel_req_t tmp={0}; - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, MSC_GTPU_ENB, NULL, 0, - "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", - ue_context_pP->ue_context.eNB_ue_s1ap_id); - - MessageDef *msg = itti_alloc_new_message(TASK_RRC_ENB, 0, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg))); - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).rnti = ue_context_pP->ue_context.rnti; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).from_gnb = 0; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).num_erab = ue_context_pP->ue_context.nb_of_e_rabs; + tmp.rnti = ue_context_pP->ue_context.rnti; + tmp.from_gnb = 0; + tmp.num_erab = ue_context_pP->ue_context.nb_of_e_rabs; for (int e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_e_rabs; e_rab++) { const rb_id_t gtp_ebi = ue_context_pP->ue_context.enb_gtp_ebi[e_rab]; - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg).eps_bearer_id[e_rab] = gtp_ebi; + tmp.eps_bearer_id[e_rab] = gtp_ebi; } - itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(enb_mod_idP), msg); + gtpv1u_delete_s1u_tunnel(enb_mod_idP,&tmp); } diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 0e6d5b580f..1cb575d1dd 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -48,11 +48,12 @@ #include "pdcp_primitives.h" #include "UTIL/OSA/osa_defs.h" -#include "msc.h" +#include #include "LTE_UERadioAccessCapabilityInformation.h" #include "gtpv1u_eNB_task.h" +#include #include "RRC/LTE/rrc_eNB_GTPV1U.h" #include "TLVDecoder.h" @@ -1071,7 +1072,7 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char ue_context_p->ue_context.nr_security.kgNB); // in case, send the S1SP initial context response if it is not sent with the attach complete message - if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) { + if (ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED) { LOG_I(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause); //if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){} rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p); @@ -1787,7 +1788,7 @@ int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *ms } } - itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p); + itti_send_msg_to_task(TASK_VARIABLE, instance, msg_delete_tunnels_p); //S1AP_E_RAB_RELEASE_RESPONSE rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid); } diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 58c595a3d0..c9ab3a3a97 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -42,6 +42,7 @@ #include "NR_MIB.h" #include "NR_BCCH-BCH-Message.h" +#include "rrc_gNB_UE_context.h" extern RAN_CONTEXT_t RC; @@ -217,29 +218,22 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, const int CC_id, const frame_t frameP, const rb_id_t Srb_id, + const rnti_t rnti, const uint8_t Nb_tb, uint8_t *const buffer_pP ){ - asn_enc_rval_t enc_rval; - uint8_t Sdu_size = 0; - uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); - #ifdef DEBUG_RRC LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); #endif - rrc_gNB_carrier_data_t *carrier; - NR_BCCH_BCH_Message_t *mib; - NR_SRB_INFO *srb_info; - char payload_size, *payload_pP; - - carrier = &RC.nrrrc[Mod_idP]->carrier; - mib = &carrier->mib; - srb_info = &carrier->Srb0; - - /* MIBCH */ + // MIBCH if ((Srb_id & RAB_OFFSET) == MIBCH) { + asn_enc_rval_t enc_rval; + uint8_t sfn_msb = (uint8_t)((frameP>>4)&0x3f); + rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[Mod_idP]->carrier; + NR_BCCH_BCH_Message_t *mib = &carrier->mib; + // Currently we are getting the pdcch_ConfigSIB1 from the configuration file. // Uncomment this function for a dynamic pdcch_ConfigSIB1. //channel_bandwidth_t min_channel_bw = bw_10MHz; // Must be obtained based on TS 38.101-1 Table 5.3.5-1 @@ -269,7 +263,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, return (3); } - /* TODO BCCH SIB1 SIBs */ + // TODO BCCH SIB1 SIBs if ((Srb_id & RAB_OFFSET ) == BCCH) { memcpy(&buffer_pP[0], RC.nrrrc[Mod_idP]->carrier.SIB1, @@ -278,29 +272,54 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1; } - /* CCCH */ + // CCCH if( (Srb_id & RAB_OFFSET ) == CCCH) { - //struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP],rnti); - //if (ue_context_p == NULL) return(0); - //eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; - LOG_D(RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); - // srb_info=&ue_p->Srb0; + char *payload_pP; + uint8_t Sdu_size = 0; + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[Mod_idP], rnti); - payload_size = srb_info->Tx_buffer.payload_size; + LOG_D(NR_RRC,"[gNB %d] Frame %d CCCH request (Srb_id %ld)\n", Mod_idP, frameP, Srb_id); + + char payload_size = ue_context_p->ue_context.Srb0.Tx_buffer.payload_size; // check if data is there for MAC if (payload_size > 0) { - payload_pP = srb_info->Tx_buffer.Payload; - LOG_D(RRC,"[gNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n", Mod_idP, srb_info, payload_size, buffer_pP, payload_pP); + payload_pP = ue_context_p->ue_context.Srb0.Tx_buffer.Payload; + LOG_D(NR_RRC,"[gNB %d] CCCH has %d bytes (dest: %p, src %p)\n", Mod_idP, payload_size, buffer_pP, payload_pP); // Fill buffer memcpy((void *)buffer_pP, (void*)payload_pP, payload_size); Sdu_size = payload_size; - srb_info->Tx_buffer.payload_size = 0; + ue_context_p->ue_context.Srb0.Tx_buffer.payload_size = 0; } return Sdu_size; } return(0); +} + +int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, + const int CC_id, + const frame_t frameP, + const sub_frame_t sub_frameP, + const int UE_id, + const rnti_t rntiP, + const rb_id_t srb_idP, + const uint8_t *sduP, + const sdu_size_t sdu_lenP, + const boolean_t brOption) { + + protocol_ctxt_t ctxt; + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, GNB_FLAG_YES, rntiP, frameP, sub_frameP,0); + + if((srb_idP & RAB_OFFSET) == CCCH) { + LOG_D(NR_RRC, "[gNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP); + ctxt.brOption = brOption; + if (sdu_lenP > 0) { + nr_rrc_gNB_decode_ccch(&ctxt, sduP, sdu_lenP, CC_id); + } + } + + return 0; } \ No newline at end of file diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 82855365c8..39222f814d 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -326,7 +326,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, // cellSelectionInfo sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo)); - sib1->cellSelectionInfo->q_RxLevMin = -50; + sib1->cellSelectionInfo->q_RxLevMin = -65; // cellAccessRelatedInfo struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo)); @@ -418,7 +418,8 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i]; ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo); } - sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + //sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = 86; for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) { ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]); } @@ -561,14 +562,14 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap: sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap; break; - /* - groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1. - The first/leftmost bit corresponds to the SS/PBCH index 0-7, the second bit corresponds to SS/PBCH block 8-15, and so on. - Value 0 in the bitmap indicates that the SSBs according to inOneGroup are absent. Value 1 indicates that the SS/PBCH blocks are transmitted in accordance with inOneGroup. - inOneGroup: When maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1, all 8 bit are valid; - The first/ leftmost bit corresponds to the first SS/PBCH block index in the group (i.e., to SSB index 0, 8, and so on); the second bit corresponds to the second SS/PBCH block index in the group - (i.e., to SSB index 1, 9, and so on), and so on. Value 0 in the bitmap indicates that the corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted. - */ + /* + groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1. + The first/leftmost bit corresponds to the SS/PBCH index 0-7, the second bit corresponds to SS/PBCH block 8-15, and so on. + Value 0 in the bitmap indicates that the SSBs according to inOneGroup are absent. Value 1 indicates that the SS/PBCH blocks are transmitted in accordance with inOneGroup. + inOneGroup: When maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1, all 8 bit are valid; + The first/ leftmost bit corresponds to the first SS/PBCH block index in the group (i.e., to SSB index 0, 8, and so on); the second bit corresponds to the second SS/PBCH block index in the group + (i.e., to SSB index 1, 9, and so on), and so on. Value 0 in the bitmap indicates that the corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted. + */ case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap: sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.size = 1; sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.bits_unused = 0; @@ -1286,7 +1287,8 @@ uint16_t do_RRCReconfiguration( // 1, // 1, // carrier->pdsch_AntennaPorts, - // carrier->initial_csi_index[gnb_rrc_inst->Nb_ue]); + // carrier->initial_csi_index[ue_context_p->local_uid + 1], + // ue_context_pP->local_uid); /******************** Meas Config ********************/ // measConfig diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 36d9bdee60..7fd9e5d53a 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -127,7 +127,7 @@ typedef enum UE_STATE_NR_e { #define MAX_MEAS_ID 6 #define PAYLOAD_SIZE_MAX 1024 -#define RRC_BUF_SIZE 255 +#define RRC_BUF_SIZE 8192 #define UNDEF_SECURITY_MODE 0xff #define NO_SECURITY_MODE 0x20 @@ -238,13 +238,13 @@ typedef struct RB_INFO_TABLE_ENTRY_NR_s { NR_RB_INFO Rb_info; uint8_t Active; uint32_t Next_check_frame; - uint8_t Status; + uint8_t status; } NR_RB_INFO_TABLE_ENTRY; typedef struct SRB_INFO_TABLE_ENTRY_NR_s { NR_SRB_INFO Srb_info; uint8_t Active; - uint8_t Status; + uint8_t status; uint32_t Next_check_frame; } NR_SRB_INFO_TABLE_ENTRY; @@ -315,7 +315,7 @@ typedef struct gNB_RRC_UE_s { NR_CipheringAlgorithm_t ciphering_algorithm; e_NR_IntegrityProtAlgorithm integrity_algorithm; - uint8_t Status; + uint8_t status; rnti_t rnti; uint64_t random_ue_identity; @@ -431,6 +431,7 @@ typedef struct { NR_BCCH_BCH_Message_t mib; int ssb_SubcarrierOffset; int pdsch_AntennaPorts; + int pusch_AntennaPorts; int pusch_TargetSNRx10; int pucch_TargetSNRx10; NR_BCCH_DL_SCH_Message_t *siblock1; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 5aafbaee4c..7923cf6e05 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -51,6 +51,7 @@ int8_t mac_rrc_nr_data_req(const module_id_t Mod_idP, const int CC_id, const frame_t frameP, const rb_id_t Srb_id, + const rnti_t rnti, const uint8_t Nb_tb, uint8_t *const buffer_pP ); @@ -84,14 +85,16 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int scg_id, int servCellIndex, int n_physical_antenna_ports, - int initial_csi_index); + int initial_csi_index, + int uid); void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_ServingCellConfig_t *servingcellconfigdedicated, NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, int n_physical_antenna_ports, - int initial_csi_index); + int initial_csi_index, + int uid); void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig, int eps_bearer_id, int rb_id, @@ -158,6 +161,24 @@ int nr_rrc_mac_remove_ue(module_id_t mod_idP, rnti_t rntiP); +int8_t nr_mac_rrc_data_ind( + const module_id_t module_idP, + const int CC_id, + const frame_t frameP, + const sub_frame_t sub_frameP, + const int UE_id, + const rnti_t rntiP, + const rb_id_t srb_idP, + const uint8_t *sduP, + const sdu_size_t sdu_lenP, + const boolean_t brOption +); + +int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, + const uint8_t *buffer, + int buffer_length, + const int CC_id); + void rrc_gNB_generate_dedicatedRRCReconfiguration_release( const protocol_ctxt_t *const ctxt_pP, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 802337257b..bbaff81698 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -224,6 +224,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration rrc_mac_config_req_gNB(rrc->module_id, rrc->carrier.ssb_SubcarrierOffset, rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, rrc->carrier.pusch_TargetSNRx10, rrc->carrier.pucch_TargetSNRx10, (NR_ServingCellConfigCommon_t *)rrc->carrier.servingcellconfigcommon, @@ -309,6 +310,7 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu rrc->carrier.servingcellconfigcommon = configuration->scc; rrc->carrier.ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset; rrc->carrier.pdsch_AntennaPorts = configuration->pdsch_AntennaPorts; + rrc->carrier.pusch_AntennaPorts = configuration->pusch_AntennaPorts; rrc->carrier.pusch_TargetSNRx10 = configuration->pusch_TargetSNRx10; rrc->carrier.pucch_TargetSNRx10 = configuration->pucch_TargetSNRx10; /// System Information INIT @@ -462,6 +464,7 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( rrc_mac_config_req_gNB(rrc_instance_p->module_id, rrc_instance_p->carrier.ssb_SubcarrierOffset, rrc_instance_p->carrier.pdsch_AntennaPorts, + rrc_instance_p->carrier.pusch_AntennaPorts, rrc_instance_p->carrier.pusch_TargetSNRx10, rrc_instance_p->carrier.pucch_TargetSNRx10, (NR_ServingCellConfigCommon_t *)rrc_instance_p->carrier.servingcellconfigcommon, @@ -559,7 +562,7 @@ rrc_gNB_process_RRCSetupComplete( LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing NR_RRCSetupComplete from UE (SRB1 Active)\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP)); ue_context_pP->ue_context.Srb1.Active = 1; - ue_context_pP->ue_context.Status = NR_RRC_CONNECTED; + ue_context_pP->ue_context.status = NR_RRC_CONNECTED; if (AMF_MODE_ENABLED) { rrc_gNB_send_NGAP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcSetupComplete); @@ -1108,7 +1111,7 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( uint8_t next_xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id); int ret = 0; - ue_context_pP->ue_context.Status = NR_RRC_CONNECTED; + ue_context_pP->ue_context.status = NR_RRC_CONNECTED; ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity when UE goes into RRC_CONNECTED ue_context_pP->ue_context.reestablishment_xid = next_xid; SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; @@ -1385,7 +1388,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, break; case NR_UL_CCCH_MessageType__c1_PR_rrcSetupRequest: - LOG_I(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %x)\n", ctxt_pP->rnti); + LOG_D(NR_RRC, "Received RRCSetupRequest on UL-CCCH-Message (UE rnti %x)\n", ctxt_pP->rnti); ue_context_p = rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti); if (ue_context_p != NULL) { rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_p); @@ -1492,15 +1495,16 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, CC_id); break; } - } - if (ue_context_p != NULL) { ue_context_p->ue_context.establishment_cause = rrcSetupRequest->establishmentCause; - } - rrc_gNB_generate_RRCSetup(ctxt_pP, - rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti), - CC_id); + rrc_gNB_generate_RRCSetup(ctxt_pP, + rrc_gNB_get_ue_context(gnb_rrc_inst, ctxt_pP->rnti), + CC_id); + + // FIXME: Check the best place to perform this DRB configuration + nr_DRB_preconfiguration(ctxt_pP->rnti); + } break; case NR_UL_CCCH_MessageType__c1_PR_rrcResumeRequest: @@ -1598,7 +1602,7 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, } #endif //c-plane not end - if((ue_context_p->ue_context.Status != NR_RRC_RECONFIGURED) && (ue_context_p->ue_context.reestablishment_cause == NR_ReestablishmentCause_spare1)) { + if((ue_context_p->ue_context.status != NR_RRC_RECONFIGURED) && (ue_context_p->ue_context.reestablishment_cause == NR_ReestablishmentCause_spare1)) { LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" NR_RRCReestablishmentRequest (UE %x c-plane is not end), RRC establishment failed \n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP),c_rnti); @@ -1610,9 +1614,9 @@ int nr_rrc_gNB_decode_ccch(protocol_ctxt_t *const ctxt_pP, LOG_E(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT" RRRCReconfigurationComplete(Previous) don't receive, delete the Previous UE,\nprevious Status %d, new Status NR_RRC_RECONFIGURED\n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.Status + ue_context_p->ue_context.status ); - ue_context_p->ue_context.Status = NR_RRC_RECONFIGURED; + ue_context_p->ue_context.status = NR_RRC_RECONFIGURED; protocol_ctxt_t ctxt_old_p; PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt_old_p, ctxt_pP->instance, diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index c6778729ec..5bb44205c4 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -569,7 +569,7 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( } // in case, send the S1SP initial context response if it is not sent with the attach complete message - if (ue_context_p->ue_context.Status == NR_RRC_RECONFIGURED) { + if (ue_context_p->ue_context.status == NR_RRC_RECONFIGURED) { LOG_I(NR_RRC, "Sending rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP, cause %ld\n", ue_context_p->ue_context.reestablishment_cause); rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p); } diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index e9741aaf78..7861f2166c 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -39,6 +39,7 @@ #include "openair2/RRC/LTE/rrc_eNB_GTPV1U.h" #include "executables/softmodem-common.h" #include +#include #include "UTIL/OSA/osa_defs.h" extern boolean_t nr_rrc_pdcp_config_asn1_req( @@ -151,7 +152,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ ue_context_p->ue_context.reconfig->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration; NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t)); ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies; - carrier->initial_csi_index[rrc->Nb_ue] = 0; + carrier->initial_csi_index[ue_context_p->local_uid + 1] = 0; ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t)); if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1 || get_softmodem_params()->sa == 1){ fill_default_rbconfig(ue_context_p->ue_context.rb_config, @@ -244,14 +245,16 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ reconfig_ies, ue_context_p->ue_context.secondaryCellGroup, carrier->pdsch_AntennaPorts, - carrier->initial_csi_index[rrc->Nb_ue]); + carrier->initial_csi_index[ue_context_p->local_uid + 1], + ue_context_p->local_uid); } else { fill_default_reconfig(carrier->servingcellconfigcommon, NULL, reconfig_ies, ue_context_p->ue_context.secondaryCellGroup, carrier->pdsch_AntennaPorts, - carrier->initial_csi_index[rrc->Nb_ue]); + carrier->initial_csi_index[ue_context_p->local_uid + 1], + ue_context_p->local_uid); } ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); @@ -346,6 +349,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_ rrc_mac_config_req_gNB(rrc->module_id, rrc->carrier.ssb_SubcarrierOffset, rrc->carrier.pdsch_AntennaPorts, + rrc->carrier.pusch_AntennaPorts, rrc->carrier.pusch_TargetSNRx10, rrc->carrier.pucch_TargetSNRx10, NULL, @@ -424,7 +428,7 @@ void rrc_remove_nsa_user(gNB_RRC_INST *rrc, int rnti) { ue_context->ue_context.gnb_gtp_ebi[e_rab] = 0; } - itti_send_msg_to_task(TASK_GTPV1_U, rrc->module_id, msg_delete_tunnels_p); + itti_send_msg_to_task(TASK_VARIABLE, rrc->module_id, msg_delete_tunnels_p); /* remove context */ rrc_gNB_remove_ue_context(&ctxt, rrc, ue_context); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 8f3993229e..8ed19e9d82 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -149,7 +149,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco int scg_id, int servCellIndex, int n_physical_antenna_ports, - int initial_csi_index) { + int initial_csi_index, + int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); @@ -184,10 +185,20 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ASN_SEQUENCE_ADD(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig); secondaryCellGroup->mac_CellGroupConfig=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig)); secondaryCellGroup->mac_CellGroupConfig->drx_Config = NULL; - secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig = NULL; + + secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig)); + secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList)); + NR_SchedulingRequestToAddMod_t *SchedulingRequestConf = calloc(1,sizeof(*SchedulingRequestConf)); + SchedulingRequestConf->schedulingRequestId = 0; //Could be changed + SchedulingRequestConf->sr_ProhibitTimer = calloc(1,sizeof(*SchedulingRequestConf->sr_ProhibitTimer)); + *SchedulingRequestConf->sr_ProhibitTimer = NR_SchedulingRequestToAddMod__sr_ProhibitTimer_ms16; + SchedulingRequestConf->sr_TransMax = NR_SchedulingRequestToAddMod__sr_TransMax_n32; + ASN_SEQUENCE_ADD(&secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList->list,SchedulingRequestConf); + secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToReleaseList = NULL; + secondaryCellGroup->mac_CellGroupConfig->bsr_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->bsr_Config)); - secondaryCellGroup->mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf80; - secondaryCellGroup->mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf320; + secondaryCellGroup->mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf10; + secondaryCellGroup->mac_CellGroupConfig->bsr_Config->retxBSR_Timer = NR_BSR_Config__retxBSR_Timer_sf160; secondaryCellGroup->mac_CellGroupConfig->tag_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config)); secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToReleaseList = NULL; secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList)); @@ -228,61 +239,43 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco secondaryCellGroup->spCellConfig->reconfigurationWithSync->t304=NR_ReconfigurationWithSync__t304_ms2000; secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = NULL; secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1 = NULL; - /* contention free ra */ - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1,sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->present= NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra= calloc(1,sizeof(struct NR_CFRA)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization= NULL; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions)); - memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric, - &servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long)); - *secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb; - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb)); - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; - struct NR_CFRA_SSB_Resource *ssbElem[8]; - ssbElem[0] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[0]->ssb = 0; - ssbElem[0]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[0]); -#if 0 - ssbElem[1] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[1]->ssb = 1; - ssbElem[1]->ra_PreambleIndex = 62; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[1]); - ssbElem[2] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[2]->ssb = 2; - ssbElem[2]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[2]); - ssbElem[3] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[3]->ssb = 3; - ssbElem[3]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[3]); - ssbElem[4] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[4]->ssb = 4; - ssbElem[4]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[4]); - ssbElem[5] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[5]->ssb = 5; - ssbElem[5]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[5]); - ssbElem[6] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[6]->ssb = 6; - ssbElem[6]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[6]); - ssbElem[7] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); - ssbElem[7]->ssb = 7; - ssbElem[7]->ra_PreambleIndex = 63; - ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[7]); -#endif - secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL; + + // For 2-step contention-free random access procedure + if(get_softmodem_params()->sa == 0) { + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = calloc(1,sizeof(struct NR_ReconfigurationWithSync__rach_ConfigDedicated)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->present= NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink= calloc(1,sizeof(struct NR_RACH_ConfigDedicated)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra= calloc(1,sizeof(struct NR_CFRA)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->ra_Prioritization= NULL; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions= calloc(1,sizeof(struct NR_CFRA__occasions)); + memcpy(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->rach_ConfigGeneric, + &servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric, sizeof(NR_RACH_ConfigGeneric_t)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion= calloc(1,sizeof(long)); + *secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->occasions->ssb_perRACH_Occasion = NR_CFRA__occasions__ssb_perRACH_Occasion_one; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.present = NR_CFRA__resources_PR_ssb; + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb = calloc(1,sizeof(struct NR_CFRA__resources__ssb)); + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ra_ssb_OccasionMaskIndex = 0; + + int n_ssb = 0; + struct NR_CFRA_SSB_Resource *ssbElem[64]; + for (int i=0;i<64;i++) { + if ((bitmap>>(63-i))&0x01){ + ssbElem[n_ssb] = calloc(1,sizeof(struct NR_CFRA_SSB_Resource)); + ssbElem[n_ssb]->ssb = i; + ssbElem[n_ssb]->ra_PreambleIndex = 63 - (uid % 64); + ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->resources.choice.ssb->ssb_ResourceList.list,ssbElem[n_ssb]); + n_ssb++; + } + } + + secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink->cfra->ext1 = NULL; + } + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants)); secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->present = NR_SetupRelease_RLF_TimersAndConstants_PR_setup; secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup)); - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->t310 = NR_RLF_TimersAndConstants__t310_ms2000; - secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n310 = NR_RLF_TimersAndConstants__n310_n10; + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->t310 = NR_RLF_TimersAndConstants__t310_ms4000; + secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n310 = NR_RLF_TimersAndConstants__n310_n20; secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n311 = NR_RLF_TimersAndConstants__n311_n1; secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1 = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1)); secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311 = NR_RLF_TimersAndConstants__ext1__t311_ms30000; @@ -560,7 +553,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss); - + bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1)); *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=0; @@ -651,7 +644,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco } bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL; - bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL; + bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;//calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type)); bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL; bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL; @@ -967,22 +960,16 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_PUCCH_ResourceSet_t *pucchresset1=calloc(1,sizeof(*pucchresset1)); pucchresset0->pucch_ResourceSetId = 0; NR_PUCCH_ResourceId_t *pucchresset0id0=calloc(1,sizeof(*pucchresset0id0)); - NR_PUCCH_ResourceId_t *pucchresset0id1=calloc(1,sizeof(*pucchresset0id1)); *pucchresset0id0=1; ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id0); - *pucchresset0id1=2; - ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id1); pucchresset0->maxPayloadSize=NULL; ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0); pucchresset1->pucch_ResourceSetId = 1; NR_PUCCH_ResourceId_t *pucchresset1id0=calloc(1,sizeof(*pucchresset1id0)); - NR_PUCCH_ResourceId_t *pucchresset1id1=calloc(1,sizeof(*pucchresset1id1)); - *pucchresset1id0=3; + *pucchresset1id0=2; ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id0); - *pucchresset1id1=4; - ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id1); pucchresset1->maxPayloadSize=NULL; ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset1); @@ -992,8 +979,9 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_PUCCH_Resource_t *pucchres1=calloc(1,sizeof(*pucchres1)); NR_PUCCH_Resource_t *pucchres2=calloc(1,sizeof(*pucchres2)); NR_PUCCH_Resource_t *pucchres3=calloc(1,sizeof(*pucchres3)); + pucchres0->pucch_ResourceId=1; - pucchres0->startingPRB=8; + pucchres0->startingPRB= (8 + uid) % curr_bwp; pucchres0->intraSlotFrequencyHopping=NULL; pucchres0->secondHopPRB=NULL; pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0; @@ -1003,18 +991,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pucchres0->format.choice.format0->startingSymbolIndex=13; ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0); - pucchres1->pucch_ResourceId=2; - pucchres1->startingPRB=8; - pucchres1->intraSlotFrequencyHopping=NULL; - pucchres1->secondHopPRB=NULL; - pucchres1->format.present= NR_PUCCH_Resource__format_PR_format0; - pucchres1->format.choice.format0=calloc(1,sizeof(*pucchres1->format.choice.format0)); - pucchres1->format.choice.format0->initialCyclicShift=0; - pucchres1->format.choice.format0->nrofSymbols=1; - pucchres1->format.choice.format0->startingSymbolIndex=12; - ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres1); - - pucchres2->pucch_ResourceId=3; + pucchres2->pucch_ResourceId=2; pucchres2->startingPRB=0; pucchres2->intraSlotFrequencyHopping=NULL; pucchres2->secondHopPRB=NULL; @@ -1025,17 +1002,6 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pucchres2->format.choice.format2->startingSymbolIndex=13; ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres2); - pucchres3->pucch_ResourceId=4; - pucchres3->startingPRB=0; - pucchres3->intraSlotFrequencyHopping=NULL; - pucchres3->secondHopPRB=NULL; - pucchres3->format.present= NR_PUCCH_Resource__format_PR_format2; - pucchres3->format.choice.format2=calloc(1,sizeof(*pucchres3->format.choice.format2)); - pucchres3->format.choice.format2->nrofPRBs=8; - pucchres3->format.choice.format2->nrofSymbols=1; - pucchres3->format.choice.format2->startingSymbolIndex=12; - ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres3); - pucch_Config->format2=calloc(1,sizeof(*pucch_Config->format2)); pucch_Config->format2->present=NR_SetupRelease_PUCCH_FormatConfig_PR_setup; NR_PUCCH_FormatConfig_t *pucchfmt2 = calloc(1,sizeof(*pucchfmt2)); @@ -1043,18 +1009,31 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pucchfmt2->interslotFrequencyHopping=NULL; pucchfmt2->additionalDMRS=NULL; pucchfmt2->maxCodeRate=calloc(1,sizeof(*pucchfmt2->maxCodeRate)); - *pucchfmt2->maxCodeRate=NR_PUCCH_MaxCodeRate_zeroDot25; + *pucchfmt2->maxCodeRate=NR_PUCCH_MaxCodeRate_zeroDot35; pucchfmt2->nrofSlots=NULL; pucchfmt2->pi2BPSK=NULL; - pucchfmt2->simultaneousHARQ_ACK_CSI=NULL; - pucch_Config->schedulingRequestResourceToAddModList=NULL; + pucchfmt2->simultaneousHARQ_ACK_CSI=calloc(1,sizeof(*pucchfmt2->simultaneousHARQ_ACK_CSI)); + *pucchfmt2->simultaneousHARQ_ACK_CSI=NR_PUCCH_FormatConfig__simultaneousHARQ_ACK_CSI_true; + + // for scheduling requestresource + pucch_Config->schedulingRequestResourceToAddModList = calloc(1,sizeof(*pucch_Config->schedulingRequestResourceToAddModList)); + NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig = calloc(1,sizeof(*schedulingRequestResourceConfig)); + schedulingRequestResourceConfig->schedulingRequestResourceId = 1; + schedulingRequestResourceConfig->schedulingRequestID = 0; + schedulingRequestResourceConfig->periodicityAndOffset = calloc(1,sizeof(*schedulingRequestResourceConfig->periodicityAndOffset)); + schedulingRequestResourceConfig->periodicityAndOffset->present = NR_SchedulingRequestResourceConfig__periodicityAndOffset_PR_sl10; + schedulingRequestResourceConfig->periodicityAndOffset->choice.sl10 = 7; + schedulingRequestResourceConfig->resource = calloc(1,sizeof(*schedulingRequestResourceConfig->resource)); + *schedulingRequestResourceConfig->resource = 1; + ASN_SEQUENCE_ADD(&pucch_Config->schedulingRequestResourceToAddModList->list,schedulingRequestResourceConfig); + pucch_Config->schedulingRequestResourceToReleaseList=NULL; pucch_Config->multi_CSI_PUCCH_ResourceList=NULL; pucch_Config->dl_DataToUL_ACK = calloc(1,sizeof(*pucch_Config->dl_DataToUL_ACK)); long *delay[8]; for (int i=0;i<8;i++) { delay[i] = calloc(1,sizeof(*delay[i])); - *delay[i] = (i<6) ? (i+2) : 0; + *delay[i] = i+2; ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); } pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList)); @@ -1195,10 +1174,10 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic)); csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 49; + csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 9 + (10 * uid) % 320; NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1,sizeof(*pucchcsires1)); pucchcsires1->uplinkBandwidthPartId=1; - pucchcsires1->pucch_Resource=3; + pucchcsires1->pucch_Resource=2; ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; csirep1->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; @@ -1259,14 +1238,22 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, int n_physical_antenna_ports, - int initial_csi_index) { + int initial_csi_index, + int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(reconfig!=NULL,"reconfig is null\n"); AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n"); // radioBearerConfig reconfig->radioBearerConfig=NULL; // secondaryCellGroup - fill_default_secondaryCellGroup(servingcellconfigcommon,servingcellconfigdedicated,secondaryCellGroup,1,1,n_physical_antenna_ports,initial_csi_index); + fill_default_secondaryCellGroup(servingcellconfigcommon, + servingcellconfigdedicated, + secondaryCellGroup, + 1, + 1, + n_physical_antenna_ports, + initial_csi_index, + uid); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); char scg_buffer[1024]; diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index e21859ded8..c78a1caf37 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -42,17 +42,71 @@ nr_mac_rrc_data_ind_ue( const module_id_t module_id, const int CC_id, const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len){ + sdu_size_t sdu_size = 0; switch(channel){ case NR_BCCH_BCH: AssertFatal( nr_rrc_ue_decode_NR_BCCH_BCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len) == 0, "UE decode BCCH-BCH error!\n"); break; + case NR_BCCH_DL_SCH: - AssertFatal( nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id, gNB_index, (uint8_t*)pduP, pdu_len, 0, 0) == 0, "UE decode BCCH-DL-SCH error!\n"); + if (pdu_len>0) { + LOG_T(NR_RRC, "[UE %d] Received SDU for NR-BCCH-DL-SCH on SRB %u from gNB %d\n", module_id, channel & RAB_OFFSET, + gNB_index); + + MessageDef *message_p; + int msg_sdu_size = BCCH_SDU_SIZE; + + if (pdu_len > msg_sdu_size) { + LOG_E(NR_RRC, "SDU larger than NR-BCCH-DL-SCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size); + sdu_size = msg_sdu_size; + } else { + sdu_size = pdu_len; + } + + message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_BCCH_DATA_IND); + memset(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE); + memcpy(NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu, pduP, sdu_size); + NR_RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; //frameP + NR_RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP + NR_RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size; + NR_RRC_MAC_BCCH_DATA_IND (message_p).gnb_index = gNB_index; + itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(module_id), message_p); + } break; + + case CCCH: + if (pdu_len>0) { + LOG_T(NR_RRC,"[UE %d] Received SDU for CCCH on SRB %u from gNB %d\n",module_id,channel & RAB_OFFSET,gNB_index); + + MessageDef *message_p; + int msg_sdu_size = CCCH_SDU_SIZE; + + if (pdu_len > msg_sdu_size) { + LOG_E(NR_RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size); + sdu_size = msg_sdu_size; + } else { + sdu_size = pdu_len; + } + + message_p = itti_alloc_new_message (TASK_MAC_UE, 0, NR_RRC_MAC_CCCH_DATA_IND); + memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + memcpy (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, pduP, sdu_size); + NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; //frameP + NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frame; //sub_frameP + NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; + NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = gNB_index; + NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti; //rntiP + itti_send_msg_to_task (TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE( module_id ), message_p); + } + break; + default: break; } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index f373d74230..86948230a5 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -72,6 +72,7 @@ #include "nr_nas_msg_sim.h" #endif +NR_UE_RRC_INST_t *NR_UE_rrc_inst; /* NAS Attach request with IMSI */ static const char nr_nas_attach_req_imsi[] = { 0x07, 0x41, @@ -1365,10 +1366,10 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB (void **)&dl_ccch_msg, (uint8_t *)Srb_info->Rx_buffer.Payload, 100,0,0); - - // if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout,&asn_DEF_NR_DL_CCCH_Message,(void *)dl_ccch_msg); - // } + } if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { LOG_E(RRC,"[UE %d] Frame %d : Failed to decode DL-CCCH-Message (%zu bytes)\n",ctxt_pP->module_id,ctxt_pP->frame,dec_rval.consumed); @@ -1735,13 +1736,13 @@ void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB MessageDef *message_p; uint8_t *message_buffer; message_buffer = itti_malloc (TASK_RRC_NRUE,TASK_RRC_GNB_SIM, - NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); - memcpy (message_buffer, (uint8_t*)NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.Payload, - NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size); + NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size); + memcpy (message_buffer, (uint8_t*)NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.Payload, + NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size); message_p = itti_alloc_new_message (TASK_RRC_NRUE, 0, UE_RRC_CCCH_DATA_IND); GNB_RRC_CCCH_DATA_IND (message_p).sdu = message_buffer; - GNB_RRC_CCCH_DATA_IND (message_p).size = NR_UE_rrc_inst[ctxt_pP->module_id].Srb0[gNB_index].Tx_buffer.payload_size; - itti_send_msg_to_task (TASK_RRC_GNB_SIM, ctxt_pP->instance, message_p); + GNB_RRC_CCCH_DATA_IND (message_p).size = NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size; + itti_send_msg_to_task (TASK_RRC_GNB_SIM, gNB_index, message_p); #endif } } @@ -1758,7 +1759,7 @@ nr_rrc_ue_establish_srb1( { // add descriptor from RRC PDU NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Active = 1; - NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG + NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].status = RADIO_CONFIG_OK;//RADIO CFG NR_UE_rrc_inst[ue_mod_idP].Srb1[gNB_index].Srb_info.Srb_id = 1; LOG_I(NR_RRC, "[UE %d], CONFIG_SRB1 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH, gNB_index); return(0); @@ -1776,7 +1777,7 @@ nr_rrc_ue_establish_srb2( { // add descriptor from RRC PDU NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Active = 1; - NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG + NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].status = RADIO_CONFIG_OK;//RADIO CFG NR_UE_rrc_inst[ue_mod_idP].Srb2[gNB_index].Srb_info.Srb_id = 2; LOG_I(NR_RRC, "[UE %d], CONFIG_SRB2 %d corresponding to gNB_index %d\n", ue_mod_idP, DCCH1, gNB_index); return(0); @@ -2472,7 +2473,6 @@ void *rrc_nrue_task( void *args_p ) { case NR_RRC_MAC_BCCH_DATA_IND: LOG_D(NR_RRC, "[UE %d] Received %s: frameP %d, gNB %d\n", ue_mod_id, ITTI_MSG_NAME (msg_p), NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); - // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0); PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, GNB_FLAG_NO, NOT_A_RNTI, NR_RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index); nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message (ctxt.module_id, NR_RRC_MAC_BCCH_DATA_IND (msg_p).gnb_index, @@ -2480,6 +2480,7 @@ void *rrc_nrue_task( void *args_p ) { NR_RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size, NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrq, NR_RRC_MAC_BCCH_DATA_IND (msg_p).rsrp); + break; case NR_RRC_MAC_CCCH_DATA_IND: LOG_D(NR_RRC, "[UE %d] RNTI %x Received %s: frameP %d, gNB %d\n", @@ -2568,7 +2569,7 @@ void *rrc_nrue_task( void *args_p ) { LOG_E(NR_RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, ITTI_MSG_NAME (msg_p)); break; } - LOG_I(NR_RRC, "[UE %d] RRC Status %d\n", ue_mod_id, nr_rrc_get_state(ue_mod_id)); + LOG_D(NR_RRC, "[UE %d] RRC Status %d\n", ue_mod_id, nr_rrc_get_state(ue_mod_id)); result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); msg_p = NULL; diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 0acf6db634..534da0112b 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -109,7 +109,15 @@ int8_t nr_rrc_ue_decode_NR_DL_DCCH_Message(const module_id_t module_id, const ui \param channel indicator for channel of the pdu \param pduP pointer to pdu \param pdu_len data length of pdu*/ -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const channel_t channel, const uint8_t* pduP, const sdu_size_t pdu_len); +int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, + const int CC_id, + const uint8_t gNB_index, + const frame_t frame, + const sub_frame_t sub_frame, + const rnti_t rnti, + const channel_t channel, + const uint8_t* pduP, + const sdu_size_t pdu_len); /**\brief \param module_id module id diff --git a/openair2/RRC/NR_UE/rrc_vars.h b/openair2/RRC/NR_UE/rrc_vars.h index 5c74e5b5a8..30c74debdd 100644 --- a/openair2/RRC/NR_UE/rrc_vars.h +++ b/openair2/RRC/NR_UE/rrc_vars.h @@ -36,6 +36,6 @@ #include "rrc_defs.h" -NR_UE_RRC_INST_t *NR_UE_rrc_inst; +extern NR_UE_RRC_INST_t *NR_UE_rrc_inst; #endif diff --git a/openair2/SIMULATION/NR_RRC/itti_sim.c b/openair2/SIMULATION/NR_RRC/itti_sim.c index 9b35ea6721..82906b45f8 100644 --- a/openair2/SIMULATION/NR_RRC/itti_sim.c +++ b/openair2/SIMULATION/NR_RRC/itti_sim.c @@ -81,14 +81,13 @@ unsigned short config_frames[4] = {2,9,11,13}; #include "RRC/NR_UE/rrc_proto.h" #include "RRC/NR_UE/rrc_vars.h" #include "openair3/NAS/UE/nas_ue_task.h" +#include +#include pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex -uint8_t nfapi_mode = 0; // Default to monolithic mode -uint32_t target_dl_mcs = 28; -uint32_t target_ul_mcs = 20; uint32_t timing_advance = 0; uint64_t num_missed_slots=0; @@ -96,7 +95,18 @@ int split73=0; void sendFs6Ul(PHY_VARS_eNB *eNB, int UE_id, int harq_pid, int segmentID, int16_t *data, int dataLen, int r_offset) { AssertFatal(false, "Must not be called in this context\n"); } +void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI *uci, int frame, int subframe, uint8_t *harq_ack, uint8_t tdd_mapping_mode, uint16_t tdd_multiplexing_mask, uint16_t rnti, int32_t stat) { + AssertFatal(false, "Must not be called in this context\n"); +} +nrUE_params_t nrUE_params; +nrUE_params_t *get_nrUE_params(void) { + return &nrUE_params; +} + +void processSlotTX(void *arg) {} + +THREAD_STRUCT thread_struct; pthread_cond_t sync_cond; pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. @@ -120,7 +130,6 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; //Temp fix for inexistent NR upper layer unsigned char NB_gNB_INST = 1; -static char *itti_dump_file = NULL; int UE_scan = 1; int UE_scan_carrier = 0; @@ -148,7 +157,6 @@ extern void *udp_eNB_task(void *args_p); int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; double cpuf; diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h index 34190f7d15..58cc7184e7 100644 --- a/openair2/UTIL/OCG/OCG.h +++ b/openair2/UTIL/OCG/OCG.h @@ -667,7 +667,6 @@ typedef struct { unsigned char omv_enabled; // openair mobility visulizer unsigned char opp_enabled; // openair performance profiler unsigned char oeh_enabled; // openair event handler, with CLI this could provide a remote event management - char *itti_dump_file; unsigned char vcd_enabled; char *vcd_file; unsigned char eMBMS_active_state; @@ -717,12 +716,6 @@ typedef struct { */ unsigned char slot_isr; int slot_sfd; - rnti_t eNB_ue_module_id_to_rnti[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];/*!< \brief used by eNB, this array can be filled: - by local virtualization: set directly by UE, or by remote UEs: TODO add signalisation on ethernet emulation link from UE to eNB*/ - - module_id_t eNB_ue_local_uid_to_ue_module_id[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];/*!< \brief used by eNB, this array can be filled: - by local virtualization: set directly by UE, or by remote UEs: TODO add signalisation on ethernet emulation link from UE to eNB*/ - } Info; /* @}*/ diff --git a/openair2/UTIL/OSA/osa_defs.h b/openair2/UTIL/OSA/osa_defs.h index 6334658683..e845315922 100644 --- a/openair2/UTIL/OSA/osa_defs.h +++ b/openair2/UTIL/OSA/osa_defs.h @@ -48,7 +48,8 @@ typedef enum { NAS_INT_ALG = 0x02, RRC_ENC_ALG = 0x03, RRC_INT_ALG = 0x04, - UP_ENC_ALG = 0x05 + UP_ENC_ALG = 0x05, + UP_INT_ALG = 0x06 } algorithm_type_dist_t; //int derive_keNB(const uint8_t kasme[32], const uint32_t nas_count, uint8_t **keNB); diff --git a/openair2/UTIL/OTG/otg_defs.h b/openair2/UTIL/OTG/otg_defs.h index 6c9944014f..af0260587f 100644 --- a/openair2/UTIL/OTG/otg_defs.h +++ b/openair2/UTIL/OTG/otg_defs.h @@ -34,13 +34,8 @@ # define __OTG_DEFS_H__ /* \brief To define the NUMBER_OF_eNB_MAX and MAX_MOBILES_PER_ENB */ -#if STANDALONE==1 - #include "openairinterface5g_limits.h" -#else - // impl_defs_top.h includes openairinterface5g_limits.h - #include "PHY/impl_defs_top.h" -#endif - +#include "openairinterface5g_limits.h" +#include #include "otg_config.h" /** diff --git a/openair2/X2AP/x2ap_eNB.c b/openair2/X2AP/x2ap_eNB.c index 58535646fd..0474d417df 100644 --- a/openair2/X2AP/x2ap_eNB.c +++ b/openair2/X2AP/x2ap_eNB.c @@ -116,9 +116,7 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa /* some sanity check - to be refined at some point */ if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { X2AP_ERROR("x2ap_enb_data_p not NULL and sctp state not SCTP_STATE_ESTABLISHED, what to do?\n"); - // Allow for a gracious exit when we kill first the gNB, then the eNB - //abort(); - return; + exit(1); } x2ap_enb_data_p->in_streams = sctp_new_association_resp->in_streams; @@ -132,6 +130,18 @@ void x2ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa DevAssert(x2ap_enb_data_p != NULL); dump_trees(); + /* gNB: exit if connection to eNB failed - to be modified if needed. + * We may want to try to connect over and over again until we succeed + * but the modifications to the code to get this behavior are complex. + * Exit on error is a simple solution that can be caught by a script + * for example. + */ + if (instance_p->cell_type == CELL_MACRO_GNB + && sctp_new_association_resp->sctp_state == SCTP_STATE_UNREACHABLE) { + X2AP_ERROR("association with eNB failed, is it running? If no, run it first. If yes, check IP addresses in your configuration file.\n"); + exit(1); + } + if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { X2AP_WARN("Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", sctp_new_association_resp->sctp_state, diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index 1fb28ea05b..d60f7654ad 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -690,9 +690,11 @@ int x2ap_eNB_handle_x2_setup_failure(instance_t instance, // need a FSM to handle all cases if ((ie->value.choice.Cause.present == X2AP_Cause_PR_misc) && (ie->value.choice.Cause.choice.misc == X2AP_CauseMisc_unspecified)) { - X2AP_WARN("Received X2 setup failure for eNB ... eNB is not ready\n"); + X2AP_ERROR("Received X2 setup failure for eNB ... eNB is not ready\n"); + exit(1); } else { X2AP_ERROR("Received x2 setup failure for eNB... please check your parameters\n"); + exit(1); } x2ap_eNB_data->state = X2AP_ENB_STATE_WAITING; diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c index 847002ab44..0fe2741d7b 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ b/openair3/GTPV1-U/gtpv1u_eNB.c @@ -51,6 +51,7 @@ #include "gtpv1u_eNB_defs.h" #include "gtpv1u_eNB_task.h" #include "rrc_eNB_GTPV1U.h" +#include #undef GTP_DUMP_SOCKET @@ -280,7 +281,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( (ue_context_p->ue_context.handover_info->state < HO_FORWARDING_COMPLETE)) { if(msgType == NW_GTP_END_MARKER) { /* in the source enb, UE in RRC_HO_EXECUTION mode */ - if (ue_context_p->ue_context.Status == RRC_HO_EXECUTION && ue_context_p->ue_context.handover_info->state == HO_COMPLETE) { + if (ue_context_p->ue_context.StatusRrc == RRC_HO_EXECUTION && ue_context_p->ue_context.handover_info->state == HO_COMPLETE) { /* set handover state */ //ue_context_p->ue_context.handover_info->state = HO_END_MARKER; MessageDef *msg; @@ -298,17 +299,17 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( } } - if (ue_context_p->ue_context.Status == RRC_HO_EXECUTION || ue_context_p->ue_context.Status == RRC_RECONFIGURED) { + if (ue_context_p->ue_context.StatusRrc == RRC_HO_EXECUTION || ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED) { int msgsrc = gtpv1u_eNB_get_msgsource(ue_context_p, teid); LOG_D(GTPU,"UE INFO.ueStatus %d, handover state %d, forwarding state %d, from %s. message type %s\n", - ue_context_p->ue_context.Status, + ue_context_p->ue_context.StatusRrc, ue_context_p->ue_context.handover_info->state, ue_context_p->ue_context.handover_info->forwarding_state, msgsrc == GTPV1U_MSG_FROM_SOURCE_ENB?"Source eNB":"EPC", msgsrc != GTPV1U_MSG_FROM_SOURCE_ENB? "UDP DATA" : msgType == NW_GTP_END_MARKER?"END MARKER":"DATA FORWARDING"); - /* target enb */ + /* target enb */ if(msgType == NW_GTP_END_MARKER) { LOG_I(GTPU, "target end receive END MARKER\n"); ue_context_p->ue_context.handover_info->state = HO_END_MARKER; @@ -1497,15 +1498,15 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { stack_req.apiInfo.sendtoInfo.teid = tenb_x2u_teid; stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->rab_id - GTPV1U_BEARER_OFFSET].tenb_ip_addr;// target enb ip rc = nwGtpv1uGpduMsgNew( - RC.gtpv1u_data_g->gtpv1u_stack, - tenb_x2u_teid, - NW_FALSE, - RC.gtpv1u_data_g->seq_num++, - data_req_p->buffer, - data_req_p->length, - data_req_p->offset, - &(stack_req.apiInfo.sendtoInfo.hMsg)); - + RC.gtpv1u_data_g->gtpv1u_stack, + tenb_x2u_teid, + NW_FALSE, + RC.gtpv1u_data_g->seq_num++, + data_req_p->buffer, + data_req_p->length, + data_req_p->offset, + &(stack_req.apiInfo.sendtoInfo.hMsg)); + if (rc != NW_GTPV1U_OK) { LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", @@ -1515,7 +1516,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { pMsg = (NwGtpv1uMsgT *) stack_req.apiInfo.sendtoInfo.hMsg; pMsg->msgType = NW_GTP_END_MARKER; rc = nwGtpv1uProcessUlpReq(RC.gtpv1u_data_g->gtpv1u_stack, &stack_req); - + if (rc != NW_GTPV1U_OK) { LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); MSC_LOG_EVENT(MSC_GTPU_ENB,"0 Failed send G-PDU ltid %u rtid %u size %u", @@ -1535,11 +1536,11 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { rc = nwGtpv1uMsgDelete(RC.gtpv1u_data_g->gtpv1u_stack, stack_req.apiInfo.sendtoInfo.hMsg); - + if (rc != NW_GTPV1U_OK) { LOG_E(GTPU, "nwGtpv1uMsgDelete failed: 0x%x\n", rc); } - + gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req; memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req)); delete_tunnel_req.rnti = data_req_p->rnti; @@ -1547,7 +1548,7 @@ void *gtpv1u_eNB_process_itti_msg(void *notUsed) { } } } - + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_OUT); } break; diff --git a/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h b/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h index c173d3b729..4bed349327 100644 --- a/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h +++ b/openair3/NAS/COMMON/EMM/MSG/CsServiceNotification.h @@ -26,7 +26,7 @@ #include "ProtocolDiscriminator.h" #include "SecurityHeaderType.h" #include "MessageType.h" -#include "PagingIdentity.h" +#include "NasPagingIdentity.h" #include "Cli.h" #include "SsCode.h" #include "LcsIndicator.h" diff --git a/openair3/NAS/COMMON/IES/NasPagingIdentity.h b/openair3/NAS/COMMON/IES/NasPagingIdentity.h new file mode 100644 index 0000000000..3e03128006 --- /dev/null +++ b/openair3/NAS/COMMON/IES/NasPagingIdentity.h @@ -0,0 +1,43 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include +#include +#include + +#include "OctetString.h" + +#ifndef NASPAGING_IDENTITY_H_ +#define NASPAGING_IDENTITY_H_ + +#define PAGING_IDENTITY_MINIMUM_LENGTH 2 +#define PAGING_IDENTITY_MAXIMUM_LENGTH 2 + +typedef uint8_t PagingIdentity; + +int encode_paging_identity(PagingIdentity *pagingidentity, uint8_t iei, uint8_t *buffer, uint32_t len); + +void dump_paging_identity_xml(PagingIdentity *pagingidentity, uint8_t iei); + +int decode_paging_identity(PagingIdentity *pagingidentity, uint8_t iei, uint8_t *buffer, uint32_t len); + +#endif /* PAGING IDENTITY_H_ */ + diff --git a/openair3/NAS/TOOLS/ue_sim_ci.conf b/openair3/NAS/TOOLS/ue_sim_ci.conf new file mode 100644 index 0000000000..5d95c9ba3f --- /dev/null +++ b/openair3/NAS/TOOLS/ue_sim_ci.conf @@ -0,0 +1,45 @@ +# List of known PLMNS +PLMN: { + PLMN0: { + FULLNAME="OpenAirInterface"; + SHORTNAME="OAICN"; + MNC="96"; + MCC="208"; + }; +}; + +UE0: +{ + USER: { + IMEI="356113022094149"; + MANUFACTURER="OAI"; + MODEL="LTE SoftModem"; + PIN="0000"; + }; + + SIM: { + MSIN="0100001111"; + USIM_API_K="8baf473f2f8fd09487cccbd7097c6862"; + OPC="e734f8734007d6c5ce7a0508809e7e9c"; + MSISDN="33611123456"; + }; + + # Home PLMN Selector with Access Technology + HPLMN= "20896"; + + # User controlled PLMN Selector with Access Technology + UCPLMN_LIST = (); + + # Operator PLMN List + OPLMN_LIST = ("20896"); + + # Operator controlled PLMN Selector with Access Technology + OCPLMN_LIST = (); + + # Forbidden plmns + FPLMN_LIST = (); + + # Equivalent home plmns + EHPLMN_LIST = (); + +}; diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index 178f21a44a..be887623bb 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -33,6 +33,7 @@ # include "memory.h" #include "nas_user.h" +#include // FIXME make command line option for NAS_UE_AUTOSTART # define NAS_UE_AUTOSTART 1 diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp new file mode 100644 index 0000000000..29633ba6ae --- /dev/null +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -0,0 +1,783 @@ +#include +using namespace std; + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include +#include +#include + +#include +#include +#include "common/utils/LOG/log.h" +#include +#include +#include +#include +//#include + +#pragma pack(1) + +typedef struct Gtpv1uMsgHeader { + uint8_t PN:1; + uint8_t S:1; + uint8_t E:1; + uint8_t spare:1; + uint8_t PT:1; + uint8_t version:3; + uint8_t msgType; + uint16_t msgLength; + teid_t teid; +} __attribute__((packed)) Gtpv1uMsgHeaderT; + +#pragma pack() + +// TS 29.060, table 7.1 defines the possible message types +// here are all the possible messages (3GPP R16) +#define GTP_ECHO_REQ (1) +#define GTP_ECHO_RSP (2) +#define GTP_ERROR_INDICATION (26) +#define GTP_SUPPORTED_EXTENSION_HEADER_INDICATION (31) +#define GTP_END_MARKER (254) +#define GTP_GPDU (255) + + +typedef struct ocp_gtpv1u_bearer_s { + /* TEID used in dl and ul */ + teid_t teid_incoming; ///< eNB TEID + teid_t teid_outgoing; ///< Remote TEID + in_addr_t outgoing_ip_addr; + struct in6_addr outgoing_ip6_addr; + tcp_udp_port_t outgoing_port; + uint16_t seqNum; + uint8_t npduNum; +} ocp_gtpv1u_bearer_t; + +typedef struct { + map bearers; +} teidData_t; + +typedef struct { + rnti_t rnti; + ebi_t rb_id; + gtpCallback callBack; +} rntiData_t; + +class gtpEndPoint { + public: + openAddr_t addr; + uint8_t foundAddr[20]; + int foundAddrLen; + int ipVersion; + map ue2te_mapping; + map te2ue_mapping; +}; + +class gtpEndPoints { + public: + pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER; + // the instance id will be the Linux socket handler, as this is uniq + map instances; +}; + +gtpEndPoints globGtp; + + // note TEid 0 is reserved for specific usage: echo req/resp, error and supported extensions +static uint32_t gtpv1uNewTeid(void) { +#ifdef GTPV1U_LINEAR_TEID_ALLOCATION + g_gtpv1u_teid = g_gtpv1u_teid + 1; + return g_gtpv1u_teid; +#else + return random() + random() % (RAND_MAX - 1) + 1; +#endif +} + +int legacyInstanceMapping=0; +#define compatInst(a) ((a)==0 || (a)==INSTANCE_DEFAULT?legacyInstanceMapping:a) + +#define GTPV1U_HEADER_SIZE (8) +static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, teid_t teid, uint8_t *Msg,int msgLen, + bool seqNumFlag, bool npduNumFlag, bool extHdrFlag, int seqNum, int npduNum, int extHdrType) { + AssertFatal(extHdrFlag==false,"Not developped"); + int headerAdditional=0; + + if ( seqNumFlag || npduNumFlag || extHdrFlag) + headerAdditional=4; + + uint8_t *buffer; + int fullSize=GTPV1U_HEADER_SIZE+headerAdditional+msgLen; + AssertFatal((buffer=(uint8_t *) malloc(fullSize)) != NULL, ""); + Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *)buffer ; + // N should be 0 for us (it was used only in 2G and 3G) + msgHdr->PN=npduNumFlag; + msgHdr->S=seqNumFlag; + msgHdr->E=extHdrFlag; + msgHdr->spare=0; + //PT=0 is for GTP' TS 32.295 (charging) + msgHdr->PT=1; + msgHdr->version=1; + msgHdr->msgType=GTP_GPDU; + msgHdr->msgLength=htons(msgLen); + if ( seqNumFlag || extHdrFlag || npduNumFlag) + msgHdr->msgLength+=4; + msgHdr->teid=htonl(teid); + + if(seqNumFlag || extHdrFlag || npduNumFlag) { + *((uint16_t *) (buffer+8)) = seqNumFlag ? htons(seqNum) : 0x0000; + *((uint8_t *) (buffer+10)) = npduNumFlag ? htons(npduNum) : 0x00; + *((uint8_t *) (buffer+11)) = extHdrFlag ? htons(extHdrType) : 0x00; + } + + memcpy(buffer+GTPV1U_HEADER_SIZE+headerAdditional, Msg, msgLen); + // Fix me: add IPv6 support, using flag ipVersion + static struct sockaddr_in to= {0}; + to.sin_family = AF_INET; + to.sin_port = htons(peerPort); + to.sin_addr.s_addr = peerIp ; + LOG_D(GTPU,"sending packet size: %d to %s\n",fullSize, inet_ntoa(to.sin_addr) ); + + if (sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) ) != fullSize ) { + LOG_E(GTPU, + "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u\n", + h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize); + free(buffer); + return GTPNOK; + } + + free(buffer); + return !GTPNOK; +} + +static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, bool seqNumFlag, bool npduNumFlag) { + uint8_t *buffer=req->buffer+req->offset; + size_t length=req->length; + uint64_t rnti=req->rnti; + int rab_id=req->rab_id; + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + auto ptrRnti=inst->ue2te_mapping.find(rnti); + + if ( ptrRnti==inst->ue2te_mapping.end() ) { + LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %lx in hashtable ue_mapping\n", rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } + + auto ptr=ptrRnti->second.bearers; + + if ( ptr.find(rab_id) == ptr.end() ) { + LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %lx/%x\n", rnti, rab_id); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } else + LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %lx/%x/%x, len %lu, oldseq %d, oldnum %d\n", + rnti, rab_id,ptr[rab_id].teid_outgoing,length, ptr[rab_id].seqNum,ptr[rab_id].npduNum ); + + if(seqNumFlag) + ptr[rab_id].seqNum++; + + if(npduNumFlag) + ptr[rab_id].npduNum++; + + // We will release the lock, let's copy data before + ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + pthread_mutex_unlock(&globGtp.gtp_lock); + gtpv1uCreateAndSendMsg(compatInst(instance), + tmp.outgoing_ip_addr, + tmp.outgoing_port, + tmp.teid_outgoing, + buffer, length, seqNumFlag, npduNumFlag, false, tmp.seqNum, tmp.npduNum, 0) ; +} + +static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req) { + uint64_t rnti=req->rnti; + int rab_id=req->rab_id; + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + auto ptrRnti=inst->ue2te_mapping.find(rnti); + + if ( ptrRnti==inst->ue2te_mapping.end() ) { + LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %lx in hashtable ue_mapping\n", rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } + + auto ptr=ptrRnti->second.bearers; + + if ( ptr.find(rab_id) == ptr.end() ) { + LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %lx/%x\n", rnti, rab_id); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } else + LOG_D(GTPU,"sending a end packet packet to RNTI:RAB:teid %lx/%x/%x\n", + rnti, rab_id,ptr[rab_id].teid_outgoing); + ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + pthread_mutex_unlock(&globGtp.gtp_lock); + + Gtpv1uMsgHeaderT msgHdr; + // N should be 0 for us (it was used only in 2G and 3G) + msgHdr.PN=0; + msgHdr.S=0; + msgHdr.E=0; + msgHdr.spare=0; + //PT=0 is for GTP' TS 32.295 (charging) + msgHdr.PT=1; + msgHdr.version=1; + msgHdr.msgType=GTP_END_MARKER; + msgHdr.msgLength=htons(0); + msgHdr.teid=htonl(tmp.teid_outgoing); + + // Fix me: add IPv6 support, using flag ipVersion + static struct sockaddr_in to= {0}; + to.sin_family = AF_INET; + to.sin_port = htons(tmp.outgoing_port); + to.sin_addr.s_addr = tmp.outgoing_ip_addr; + LOG_D(GTPU,"sending end packet to %s\n", inet_ntoa(to.sin_addr) ); + + if (sendto(compatInst(instance), (void *)&msgHdr, sizeof(msgHdr), 0,(struct sockaddr *)&to, sizeof(to) ) != sizeof(msgHdr)) { + LOG_E(GTPU, + "[SD %ld] Failed to send data to " IPV4_ADDR " on port %d, buffer size %lu\n", + compatInst(instance), IPV4_ADDR_FORMAT(tmp.outgoing_ip_addr), tmp.outgoing_port, sizeof(msgHdr)); + } +} + +static int udpServerSocket(openAddr_s addr) { + LOG_I(GTPU, "Initializing UDP for local address %s with port %s\n", addr.originHost, addr.originService); + int status; + struct addrinfo hints= {0}, *servinfo, *p; + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + + if ((status = getaddrinfo(addr.originHost, addr.originService, &hints, &servinfo)) != 0) { + LOG_E(GTPU,"getaddrinfo error: %s\n", gai_strerror(status)); + return -1; + } + + int sockfd=-1; + + // loop through all the results and bind to the first we can + for(p = servinfo; p != NULL; p = p->ai_next) { + if ((sockfd = socket(p->ai_family, p->ai_socktype, + p->ai_protocol)) == -1) { + LOG_W(GTPU,"socket: %s\n", strerror(errno)); + continue; + } + + if (bind(sockfd, p->ai_addr, p->ai_addrlen) == -1) { + close(sockfd); + LOG_W(GTPU,"bind: %s\n", strerror(errno)); + continue; + } else { + // We create the gtp instance on the socket + globGtp.instances[sockfd].addr=addr; + + if (p->ai_family == AF_INET) { + struct sockaddr_in *ipv4=(struct sockaddr_in *)p->ai_addr; + memcpy(globGtp.instances[sockfd].foundAddr, + &ipv4->sin_addr.s_addr, sizeof(ipv4->sin_addr.s_addr)); + globGtp.instances[sockfd].foundAddrLen=sizeof(ipv4->sin_addr.s_addr); + globGtp.instances[sockfd].ipVersion=4; + break; + } else if (p->ai_family == AF_INET6) { + LOG_W(GTPU,"Local address is IP v6\n"); + struct sockaddr_in6 *ipv6=(struct sockaddr_in6 *)p->ai_addr; + memcpy(globGtp.instances[sockfd].foundAddr, + &ipv6->sin6_addr.s6_addr, sizeof(ipv6->sin6_addr.s6_addr)); + globGtp.instances[sockfd].foundAddrLen=sizeof(ipv6->sin6_addr.s6_addr); + globGtp.instances[sockfd].ipVersion=6; + } else + AssertFatal(false,"Local address is not IPv4 or IPv6"); + } + + break; // if we get here, we must have connected successfully + } + + if (p == NULL) { + // looped off the end of the list with no successful bind + LOG_E(GTPU,"failed to bind socket: %s %s \n", addr.originHost, addr.originService); + return -1; + } + + freeaddrinfo(servinfo); // all done with this structure + + if (strlen(addr.destinationHost)>1) { + struct addrinfo hints; + memset(&hints,0,sizeof(hints)); + hints.ai_family=AF_UNSPEC; + hints.ai_socktype=SOCK_DGRAM; + hints.ai_protocol=0; + hints.ai_flags=AI_PASSIVE|AI_ADDRCONFIG; + struct addrinfo *res=0; + int err=getaddrinfo(addr.destinationHost,addr.destinationService,&hints,&res); + + if (err==0) { + for(p = res; p != NULL; p = p->ai_next) { + if ((err=connect(sockfd, p->ai_addr, p->ai_addrlen))==0) + break; + } + } + + if (err) + LOG_E(GTPU,"Can't filter remote host: %s, %s\n", addr.destinationHost,addr.destinationService); + } + + int sendbuff = 1000*1000*10; + AssertFatal(0==setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sendbuff, sizeof(sendbuff)),""); + LOG_D(GTPU,"Created listener for paquets to: %s:%s, send buffer size: %d\n", addr.originHost, addr.originService,sendbuff); + return sockfd; +} + +instance_t ocp_gtpv1Init(openAddr_t context) { + pthread_mutex_lock(&globGtp.gtp_lock); + int id=udpServerSocket(context); + + if (id>=0) { + itti_subscribe_event_fd(OCP_GTPV1_U, id); + } else + LOG_E(GTPU,"can't create GTP-U instance\n"); + + pthread_mutex_unlock(&globGtp.gtp_lock); + return id; +} + +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid_t teid, transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[instance]; + auto it=inst->ue2te_mapping.find(rnti); + + if ( it != inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Create a config for a already existing GTP tunnel (rnti %x)\n", rnti); + inst->ue2te_mapping.erase(it); + } + + uint32_t s1u_teid=gtpv1uNewTeid(); + + while ( inst->te2ue_mapping.find(s1u_teid) != inst->te2ue_mapping.end() ) { + LOG_W(GTPU, "generated a random Teid that exists, re-generating (%u)\n",s1u_teid); + s1u_teid=gtpv1uNewTeid(); + }; + + inst->te2ue_mapping[s1u_teid].rnti=rnti; + + inst->te2ue_mapping[s1u_teid].rb_id= teid; + + inst->te2ue_mapping[s1u_teid].callBack=callBack; + + auto tmp=&inst->ue2te_mapping[rnti].bearers[bearer_id]; + + int addrs_length_in_bytes = remoteAddr.length / 8; + + switch (addrs_length_in_bytes) { + case 4: + memcpy(&tmp->outgoing_ip_addr,remoteAddr.buffer,4); + break; + + case 16: + memcpy(tmp->outgoing_ip6_addr.s6_addr,remoteAddr.buffer, + 16); + break; + + case 20: + memcpy(&tmp->outgoing_ip_addr,remoteAddr.buffer,4); + memcpy(&tmp->outgoing_ip6_addr.s6_addr, + remoteAddr.buffer+4, + 16); + + default: + AssertFatal(false, "SGW Address size impossible"); + } + + tmp->teid_incoming = s1u_teid; + tmp->outgoing_port=port; + tmp->teid_outgoing= teid; + pthread_mutex_unlock(&globGtp.gtp_lock); + return s1u_teid; +} + +int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, + const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, + gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { + LOG_D(GTPU, "Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %d\n", + create_tunnel_req->rnti, + create_tunnel_req->num_tunnels, + create_tunnel_req->sgw_S1u_teid[0]); + + for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { + teid_t teid=newGtpuCreateTunnel(compatInst(instance), create_tunnel_req->rnti, + create_tunnel_req->eps_bearer_id[i], + create_tunnel_req->sgw_S1u_teid[i], + create_tunnel_req->sgw_addr[i], 2152, + pdcp_data_req); + create_tunnel_resp->status=0; + create_tunnel_resp->rnti=create_tunnel_req->rnti; + create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; + create_tunnel_resp->enb_S1u_teid[i]=teid; + create_tunnel_resp->eps_bearer_id[i] = create_tunnel_req->eps_bearer_id[i]; + memcpy(create_tunnel_resp->enb_addr.buffer,globGtp.instances[compatInst(instance)].foundAddr, + globGtp.instances[compatInst(instance)].foundAddrLen); + create_tunnel_resp->enb_addr.length= globGtp.instances[compatInst(instance)].foundAddrLen; + } + + return !GTPNOK; +} + +int ocp_gtpv1u_update_s1u_tunnel( + const instance_t instance, + const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req, + const rnti_t prior_rnti +) { + LOG_D(GTPU, "Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %d, eps_bearer_id %d\n", + prior_rnti, + create_tunnel_req->rnti, + create_tunnel_req->num_tunnels, + create_tunnel_req->sgw_S1u_teid[0], + create_tunnel_req->eps_bearer_id[0]); + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + + if ( inst->ue2te_mapping.find(create_tunnel_req->rnti) == inst->ue2te_mapping.end() ) { + LOG_E(GTPU,"Update not already existing tunnel (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + } + + auto it=inst->ue2te_mapping.find(prior_rnti); + + if ( it != inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); + gtpv1u_enb_create_tunnel_resp_t tmp; + (void)ocp_gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); + return 0; + } + + inst->ue2te_mapping[create_tunnel_req->rnti]=it->second; + inst->ue2te_mapping.erase(it); + pthread_mutex_unlock(&globGtp.gtp_lock); + return 0; +} + +int ocp_gtpv1u_create_x2u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP) { + AssertFatal( false, "to be developped\n"); +} + +int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { + LOG_D(GTPU, "Start delete tunnels for RNTI %x\n", + rnti); + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + auto it=inst->ue2te_mapping.find(rnti); + + if ( it == inst->ue2te_mapping.end() ) { + LOG_W(GTPU,"Delete a non existing GTP tunnel\n"); + pthread_mutex_unlock(&globGtp.gtp_lock); + return -1; + } + + for (auto j=it->second.bearers.begin(); + j!=it->second.bearers.end(); + ++j) + inst->te2ue_mapping.erase(j->second.teid_incoming); + + inst->ue2te_mapping.erase(it); + pthread_mutex_unlock(&globGtp.gtp_lock); + return !GTPNOK; +} + +// Legacy delete tunnel finish by deleting all the rnti +// so the list of bearer provided is only a design bug +int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, + const gtpv1u_enb_delete_tunnel_req_t *const req_pP) { + return newGtpuDeleteTunnel(instance, req_pP->rnti); +} + +static int Gtpv1uHandleEchoReq(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} + +static int Gtpv1uHandleError(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} + +static int Gtpv1uHandleSupportedExt(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + LOG_E(GTPU,"to be dev\n"); + int rc = GTPNOK; + return rc; +} + + // When end marker arrives, we notify the client with buffer size = 0 + // The client will likely call "delete tunnel" + // nevertheless we don't take the initiative +static int Gtpv1uHandleEndMarker(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; + if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { + LOG_E(GTPU, "Received a packet that is not GTP header\n"); + return GTPNOK; + } + + pthread_mutex_lock(&globGtp.gtp_lock); + // the socket Linux file handler is the instance id + auto inst=&globGtp.instances[h]; + auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); + + if ( tunnel == inst->te2ue_mapping.end() ) { + LOG_E(GTPU,"Received a incoming packet on unknown teid (%d) Dropping!\n", msgHdr->teid); + pthread_mutex_unlock(&globGtp.gtp_lock); + return GTPNOK; + } + // This context is not good for gtp + // frame, ... has no meaning + // manyother attributes may come from create tunnel + protocol_ctxt_t ctxt; + ctxt.module_id = 0; + ctxt.enb_flag = 1; + ctxt.instance = inst->addr.originInstance; + ctxt.rnti = tunnel->second.rnti; + ctxt.frame = 0; + ctxt.subframe = 0; + ctxt.eNB_index = 0; + ctxt.configured = 0; + ctxt.brOption = 0; + const srb_flag_t srb_flag=SRB_FLAG_NO; + const rb_id_t rb_id=tunnel->second.rb_id; + const mui_t mui=RLC_MUI_UNDEFINED; + const confirm_t confirm=RLC_SDU_CONFIRM_NO; + const pdcp_transmission_mode_t mode=PDCP_TRANSMISSION_MODE_DATA; + const uint32_t sourceL2Id=0; + const uint32_t destinationL2Id=0; + pthread_mutex_unlock(&globGtp.gtp_lock); + + if ( !tunnel->second.callBack(&ctxt, + srb_flag, + rb_id, + mui, + confirm, + 0, + NULL, + mode, + &sourceL2Id, + &destinationL2Id) ) + LOG_E(GTPU,"down layer refused incoming packet\n"); + + LOG_D(GTPU,"Received END marker packet for: teid:%x\n", ntohl(msgHdr->teid)); + return !GTPNOK; +} + +static int Gtpv1uHandleGpdu(int h, + uint8_t *msgBuf, + uint32_t msgBufLen, + uint16_t peerPort, + uint32_t peerIp) { + Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; + + if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { + LOG_E(GTPU, "Received a packet that is not GTP header\n"); + return GTPNOK; + } + + pthread_mutex_lock(&globGtp.gtp_lock); + // the socket Linux file handler is the instance id + auto inst=&globGtp.instances[h]; + auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); + + if ( tunnel == inst->te2ue_mapping.end() ) { + LOG_E(GTPU,"Received a incoming packet on unknown teid (%d) Dropping!\n", msgHdr->teid); + pthread_mutex_unlock(&globGtp.gtp_lock); + return GTPNOK; + } + + int offset=8; + + if( msgHdr->E || msgHdr->S ||msgHdr->PN) + offset+=4; + + // This context is not good for gtp + // frame, ... has no meaning + // manyother attributes may come from create tunnel + protocol_ctxt_t ctxt; + ctxt.module_id = 0; + ctxt.enb_flag = 1; + ctxt.instance = inst->addr.originInstance; + ctxt.rnti = tunnel->second.rnti; + ctxt.frame = 0; + ctxt.subframe = 0; + ctxt.eNB_index = 0; + ctxt.configured = 0; + ctxt.brOption = 0; + const srb_flag_t srb_flag=SRB_FLAG_NO; + const rb_id_t rb_id=tunnel->second.rb_id; + const mui_t mui=RLC_MUI_UNDEFINED; + const confirm_t confirm=RLC_SDU_CONFIRM_NO; + const sdu_size_t sdu_buffer_size=msgBufLen-offset; + unsigned char *const sdu_buffer=msgBuf+offset; + const pdcp_transmission_mode_t mode=PDCP_TRANSMISSION_MODE_DATA; + const uint32_t sourceL2Id=0; + const uint32_t destinationL2Id=0; + pthread_mutex_unlock(&globGtp.gtp_lock); + + if ( !tunnel->second.callBack(&ctxt, + srb_flag, + rb_id, + mui, + confirm, + sdu_buffer_size, + sdu_buffer, + mode, + &sourceL2Id, + &destinationL2Id) ) + LOG_E(GTPU,"down layer refused incoming packet\n"); + + LOG_D(GTPU,"Received a %d bytes packet for: teid:%x\n", + msgBufLen-offset, + ntohl(msgHdr->teid)); + return !GTPNOK; +} + +void gtpv1uReceiver(int h) { + uint8_t udpData[65536]; + int udpDataLen; + socklen_t from_len; + struct sockaddr_in addr; + from_len = (socklen_t)sizeof(struct sockaddr_in); + + if ((udpDataLen = recvfrom(h, udpData, sizeof(udpData), 0, + (struct sockaddr *)&addr, &from_len)) < 0) { + LOG_E(GTPU, "Recvfrom failed on %d (%s)\n", h, strerror(errno)); + return; + } else if (udpDataLen == 0) { + LOG_W(GTPU, "Recvfrom returned 0\n"); + return; + } else { + uint8_t msgType = *((uint8_t *)(udpData + 1)); + LOG_D(GTPU, "Received GTP data, msg type: %x\n", msgType); + + switch(msgType) { + case GTP_ECHO_RSP: + break; + + case GTP_ECHO_REQ: + Gtpv1uHandleEchoReq( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_ERROR_INDICATION: + Gtpv1uHandleError( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_SUPPORTED_EXTENSION_HEADER_INDICATION: + Gtpv1uHandleSupportedExt( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_END_MARKER: + Gtpv1uHandleEndMarker( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + case GTP_GPDU: + Gtpv1uHandleGpdu( h, udpData, udpDataLen, htons(addr.sin_port), addr.sin_addr.s_addr); + break; + + default: + LOG_E(GTPU, "Received a GTP packet of unknown type: %d\n",msgType); + break; + } + } +} + +#include + +void *ocp_gtpv1uTask(void *args) { + while(1) { + /* Trying to fetch a message from the message queue. + If the queue is empty, this function will block till a + message is sent to the task. + */ + MessageDef *message_p = NULL; + itti_receive_msg(OCP_GTPV1_U, &message_p); + + if (message_p != NULL ) { + openAddr_t addr= {0}; + + switch (ITTI_MSG_ID(message_p)) { + // DATA TO BE SENT TO UDP + case GTPV1U_ENB_TUNNEL_DATA_REQ: { + gtpv1uSend(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), + >PV1U_ENB_TUNNEL_DATA_REQ(message_p), false, false); + itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); + } + break; + + case TERMINATE_MESSAGE: + break; + + case TIMER_HAS_EXPIRED: + LOG_E(GTPU, "Received unexpected timer expired (no need of timers in this version) %s\n", ITTI_MSG_NAME(message_p)); + break; + + case GTPV1U_ENB_END_MARKER_REQ: + gtpv1uEndTunnel(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), + >PV1U_ENB_TUNNEL_DATA_REQ(message_p)); + itti_free(OCP_GTPV1_U, GTPV1U_ENB_TUNNEL_DATA_REQ(message_p).buffer); + break; + + case GTPV1U_ENB_DATA_FORWARDING_REQ: + case GTPV1U_ENB_DATA_FORWARDING_IND: + case GTPV1U_ENB_END_MARKER_IND: + LOG_E(GTPU, "to be developped %s\n", ITTI_MSG_NAME(message_p)); + abort(); + break; + + case GTPV1U_ENB_S1_REQ: + // to be dev: should be removed, to use API + strcpy(addr.originHost, GTPV1U_ENB_S1_REQ(message_p).addrStr); + strcpy(addr.originService, GTPV1U_ENB_S1_REQ(message_p).portStr); + AssertFatal((legacyInstanceMapping=ocp_gtpv1Init(addr))!=0,"Instance 0 reserved for legacy\n"); + break; + + default: + LOG_E(GTPU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p)); + abort(); + break; + } + + AssertFatal(EXIT_SUCCESS==itti_free(OCP_GTPV1_U, message_p), "Failed to free memory!\n"); + } + + struct epoll_event *events; + + int nb_events = itti_get_events(OCP_GTPV1_U, &events); + + for (int i = 0; i < nb_events; i++) + if ((events[i].events&EPOLLIN)) + gtpv1uReceiver(events[i].data.fd); + } + + return NULL; +} + +#ifdef __cplusplus +} +#endif diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h new file mode 100644 index 0000000000..507aa1338e --- /dev/null +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -0,0 +1,71 @@ +#ifndef __GTPUNEW_ITF_H__ +#define __GTPUNEW_ITF_H__ +#define GTPNOK -1 + +# define GTPU_HEADER_OVERHEAD_MAX 64 +#ifdef __cplusplus +extern "C" { +#endif + +#include +#if defined(NEW_GTPU) +#define gtpv1u_create_s1u_tunnel ocp_gtpv1u_create_s1u_tunnel +#define gtpv1u_update_s1u_tunnel ocp_gtpv1u_update_s1u_tunnel +#define gtpv1u_delete_s1u_tunnel ocp_gtpv1u_delete_s1u_tunnel +#define gtpv1u_create_x2u_tunnel ocp_gtpv1u_create_x2u_tunnel +#define gtpv1u_eNB_task ocp_gtpv1uTask +#define gtpv1u_gNB_task ocp_gtpv1uTask +#define TASK_VARIABLE OCP_GTPV1_U +#else +#define TASK_VARIABLE TASK_GTPV1_U +#endif + +typedef boolean_t (*gtpCallback)( + protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id); + +typedef struct openAddr_s { + char originHost[HOST_NAME_MAX]; + char originService[HOST_NAME_MAX]; + char destinationHost[HOST_NAME_MAX]; + char destinationService[HOST_NAME_MAX]; + instance_t originInstance; +} openAddr_t; + +// the init function create a gtp instance and return the gtp instance id +// the parameter originInstance will be sent back in each message from gtp to the creator +void ocp_gtpv1uReceiver(int h); +void ocp_gtpv1uProcessTimeout(int handle,void *arg); +int ocp_gtpv1u_create_s1u_tunnel(const instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, + gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp); +int ocp_gtpv1u_update_s1u_tunnel(const instance_t instanceP, + const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req_pP, + const rnti_t prior_rnti + ); +int ocp_gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); +int gtpv1u_delete_s1u_tunnel( const instance_t instance, const gtpv1u_enb_delete_tunnel_req_t *const req_pP); + +int ocp_gtpv1u_create_x2u_tunnel( + const instance_t instanceP, + const gtpv1u_enb_create_x2u_tunnel_req_t *const create_tunnel_req_pP, + gtpv1u_enb_create_x2u_tunnel_resp_t *const create_tunnel_resp_pP); + + +// New API +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int bearer_id, teid_t teid, + transport_layer_addr_t remoteAddr, int port, gtpCallback callBack); +instance_t ocp_gtpv1Init(openAddr_t context); +void *ocp_gtpv1uTask(void *args); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/openshift/oai-physim-image-stream.yml b/openshift/oai-physim-image-stream.yml new file mode 100644 index 0000000000..9ef338f139 --- /dev/null +++ b/openshift/oai-physim-image-stream.yml @@ -0,0 +1,29 @@ +#/* +# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# * contributor license agreements. See the NOTICE file distributed with +# * this work for additional information regarding copyright ownership. +# * The OpenAirInterface Software Alliance licenses this file to You under +# * the OAI Public License, Version 1.1 (the "License"); you may not use this file +# * except in compliance with the License. +# * You may obtain a copy of the License at +# * +# * http://www.openairinterface.org/?page_id=698 +# * +# * Unless required by applicable law or agreed to in writing, software +# * distributed under the License is distributed on an "AS IS" BASIS, +# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# * See the License for the specific language governing permissions and +# * limitations under the License. +# *------------------------------------------------------------------------------- +# * For more information about the OpenAirInterface (OAI) Software Alliance: +# * contact@openairinterface.org +# */ +#--------------------------------------------------------------------- +# +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + name: oai-physim +spec: + lookupPolicy: + local: true diff --git a/targets/ARCH/COMMON/common_lib.c b/targets/ARCH/COMMON/common_lib.c index 3a69d4c991..2758d01de3 100644 --- a/targets/ARCH/COMMON/common_lib.c +++ b/targets/ARCH/COMMON/common_lib.c @@ -40,7 +40,8 @@ #include "assertions.h" #include "common/utils/load_module_shlib.h" #include "common/utils/LOG/log.h" -#include "targets/RT/USER/lte-softmodem.h" +//#include "targets/RT/USER/lte-softmodem.h" +#include "executables/softmodem-common.h" char *get_devname(int devtype) { char *devnames[MAX_RF_DEV_TYPE]=DEVTYPE_NAMES; diff --git a/targets/ARCH/COMMON/common_lib.h b/targets/ARCH/COMMON/common_lib.h index 93e9ffb52f..7b934822ea 100644 --- a/targets/ARCH/COMMON/common_lib.h +++ b/targets/ARCH/COMMON/common_lib.h @@ -33,6 +33,7 @@ #ifndef COMMON_LIB_H #define COMMON_LIB_H #include +#include #include #include #include "record_player.h" @@ -560,7 +561,10 @@ extern int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **r extern void iqrecorder_end(openair0_device *device); +#include +#ifndef gettid #define gettid() syscall(__NR_gettid) +#endif /*@}*/ diff --git a/targets/ARCH/COMMON/record_player.c b/targets/ARCH/COMMON/record_player.c index 2dcd61e479..522f6b6d16 100644 --- a/targets/ARCH/COMMON/record_player.c +++ b/targets/ARCH/COMMON/record_player.c @@ -68,8 +68,10 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_ *recplay_conf=NULL; } - if (u_sf_replay == 1) return RECPLAY_REPLAYMODE; - else if (u_sf_record == 1) return RECPLAY_RECORDMODE; + if (u_sf_replay == 1) + return RECPLAY_REPLAYMODE; + else if (u_sf_record == 1) + return RECPLAY_RECORDMODE; return 0; } @@ -80,7 +82,7 @@ int read_recplayconfig(recplay_conf_t **recplay_conf, recplay_state_t **recplay_ */ void iqrecorder_end(openair0_device *device) { if (device->recplay_state != NULL) { // subframes store - iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,OAIIQFILE_ID}; + iqfile_header_t fh = {device->type,device->openair0_cfg->tx_sample_advance, device->openair0_cfg->rx_bw,0,OAIIQFILE_ID}; recplay_state_t *rs = device->recplay_state; recplay_conf_t *rc = device->openair0_cfg[0].recplay_conf; rs->pFile = fopen (rc->u_sf_filename,"wb+"); @@ -91,16 +93,20 @@ void iqrecorder_end(openair0_device *device) { unsigned int i = 0; unsigned int modu = 0; - if ((modu = rs->nb_samples % 10) != 0) { - rs->nb_samples -= modu; // store entire number of frames + if ((modu = rs->nbSamplesBlocks % 10) != 0) { + rs->nbSamplesBlocks -= modu; // store entire number of frames } + fh.nbSamplesBlocks=rs->nbSamplesBlocks; LOG_I(HW,"Writing file header to %s \n", rc->u_sf_filename ); fwrite(&fh, sizeof(fh), 1, rs->pFile); - LOG_UI(HW,"Writing %u subframes to %s \n",rs->nb_samples, rc->u_sf_filename ); + LOG_UI(HW,"Writing %u subframes to %s \n",rs->nbSamplesBlocks, rc->u_sf_filename ); + uint8_t *ptr=(uint8_t *)rs->ms_sample; - for (i = 0; i < rs->nb_samples; i++) { - fwrite(rs->ms_sample+i, sizeof(unsigned char), sizeof(iqrec_t), rs->pFile); + for (i = 0; i < rs->nbSamplesBlocks; i++) { + int blockBytes=sizeof(iqrec_t)+((iqrec_t *)ptr)->nbBytes; + fwrite(ptr, sizeof(unsigned char), blockBytes, rs->pFile); + ptr+=blockBytes; } fclose (rs->pFile); @@ -112,4 +118,4 @@ void iqrecorder_end(openair0_device *device) { rs->ms_sample = NULL; } } -} \ No newline at end of file +} diff --git a/targets/ARCH/COMMON/record_player.h b/targets/ARCH/COMMON/record_player.h index 500acdd709..d91da68323 100644 --- a/targets/ARCH/COMMON/record_player.h +++ b/targets/ARCH/COMMON/record_player.h @@ -46,21 +46,22 @@ extern "C" #define BELL_LABS_IQ_HEADER 0xabababababababab #define BELL_LABS_IQ_PER_SF 7680 // Up to 5MHz bw for now #define BELL_LABS_IQ_BYTES_PER_SF (BELL_LABS_IQ_PER_SF * 4) +#define MAX_BELL_LABS_IQ_BYTES_PER_SF BELL_LABS_IQ_BYTES_PER_SF*10 -#define OAIIQFILE_ID "OIQF" +#define OAIIQFILE_ID {'O', 'I','Q','F'} typedef struct { uint64_t devtype; uint64_t tx_sample_advance; double bw; + unsigned int nbSamplesBlocks; char oaiid[4]; } iqfile_header_t; typedef struct { int64_t header; int64_t ts; - int64_t rfu1; + int64_t nbBytes; int64_t rfu2; // pad for 256 bits alignement required by AVX2 - unsigned char samples[BELL_LABS_IQ_BYTES_PER_SF]; // iq's for one subframe } iqrec_t; #define DEF_NB_SF 120000 // default nb of sf or ms to capture (2 minutes at 5MHz) #define DEF_SF_FILE "/tmp/iqfile" // default subframes file name @@ -114,14 +115,16 @@ typedef struct { int use_mmap; // default is to use mmap size_t mapsize; FILE *pFile; - int mmapfd; - int iqfd; + int fd; iqrec_t *ms_sample; // memory for all subframes - unsigned int nb_samples; + unsigned int nbSamplesBlocks; + uint8_t *currentPtr; + uint64_t currentTs; + unsigned int curSamplesBlock; + int64_t wrap_count; + size_t maxSizeBytes; } recplay_state_t; - - #ifdef __cplusplus } #endif diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c index 2dfb4a7bf1..ee0dce48f0 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c @@ -45,7 +45,6 @@ #include "common_lib.h" #include "ethernet_lib.h" -#include "common/ran_context.h" //#define DEBUG 1 @@ -414,7 +413,7 @@ int trx_eth_read_udp(openair0_device *device, openair0_timestamp *timestamp, voi char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES; #endif #elif defined(__arm__) || defined(__aarch64__) - int nsamps2 = (payload_size>>4)+1 + int nsamps2 = (payload_size>>4)+1; int16x8_t temp_rx[nsamps2]; char *temp_rx0 = ((char *)&temp_rx[1])-APP_HEADER_SIZE_BYTES; #else diff --git a/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c b/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c index 88f4ecb4cd..9b398e9bd9 100644 --- a/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c +++ b/targets/ARCH/ETHERNET/benetel/5g/dpdk_driver.c @@ -312,14 +312,13 @@ l2fwd_simple_forward(struct rte_mbuf *m, unsigned portid, benetel_t *bs) oai_slot = tx_subframe * 2 + tx_slot; lock_dl_buffer(bs->buffers, oai_slot); if (!(bs->buffers->dl_busy[a][oai_slot] & (1 << tx_symbol))) { - printf("%s: warning, DL underflow (antenna %d sl.symbol %d.%d)\n", __FUNCTION__, - a, oai_slot, tx_symbol); + //printf("%s: warning, DL underflow (antenna %d sl.symbol %d.%d)\n", __FUNCTION__,a, oai_slot, tx_symbol); memset(IQ_ptr, 0, 1272 * 4); } else { memcpy(IQ_ptr, bs->buffers->dl[a][oai_slot] + tx_symbol * 1272*4, 1272*4); } -//printf("DL buffer f sf slot symbol %d %d %d %d (sf %d)\n", tx_frame, tx_subframe, tx_slot, tx_symbol, (int)sf); + //printf("DL buffer f sf slot symbol %d %d %d %d (sf %d)\n", tx_frame, tx_subframe, tx_slot, tx_symbol, (int)sf); bs->buffers->dl_busy[a][oai_slot] &= ~(1 << tx_symbol); unlock_dl_buffer(bs->buffers, oai_slot); } diff --git a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp index 61a742af65..1de76bb257 100644 --- a/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp +++ b/targets/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp @@ -153,7 +153,7 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) { } static int sync_to_gps(openair0_device *device) { - uhd::set_thread_priority_safe(); + //uhd::set_thread_priority_safe(); //std::string args; //Set up program options //po::options_description desc("Allowed options"); @@ -276,7 +276,7 @@ static int trx_usrp_start(openair0_device *device) { // setup GPIO for TDD, GPIO(4) = ATR_RX //set data direction register (DDR) to output s->usrp->set_gpio_attr("FP0", "DDR", 0xfff, 0xfff); - //set lower 7 bits to be controlled automatically by ATR (the rest 5 bits are controlled manually) + //set lower 7 bits to be controlled automatically by ATR (the rest 5 bits are controlled manually) s->usrp->set_gpio_attr("FP0", "CTRL", 0x7f,0xfff); //set pins 4 (RX_TX_Switch) and 6 (Shutdown PA) to 1 when the radio is only receiving (ATR_RX) s->usrp->set_gpio_attr("FP0", "ATR_RX", (1<<4)|(1<<6), 0x7f); @@ -301,7 +301,7 @@ static int trx_usrp_start(openair0_device *device) { } uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); - cmd.time_spec = uhd::time_spec_t(1.0); + cmd.time_spec = uhd::time_spec_t(1.0); cmd.stream_now = false; // start at constant delay s->rx_stream->issue_stream_cmd(cmd); @@ -315,7 +315,7 @@ static void trx_usrp_end(openair0_device *device) { return; usrp_state_t *s = (usrp_state_t *)device->priv; - + if (s == NULL) return; iqrecorder_end(device); @@ -436,7 +436,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHI buff_ptrs.push_back(&(((int16_t *)buff_tx[i])[0])); ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md); - } + } else { ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md); } @@ -464,6 +464,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHI write_package[end].buff[i] = buff[i]; write_thread->count_write++; write_thread->end = (write_thread->end + 1)% MAX_WRITE_THREAD_PACKAGE; + LOG_D(HW,"Signaling TX TS %llu\n",(unsigned long long)timestamp); pthread_cond_signal(&write_thread->cond_write); pthread_mutex_unlock(&write_thread->mutex_write); return 0; @@ -480,7 +481,7 @@ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_BEAM_SWITCHI @param antenna_id index of the antenna if the device has multiple antennas @param flags flags must be set to TRUE if timestamp parameter needs to be applied */ -void *trx_usrp_write_thread(void * arg){ +void *trx_usrp_write_thread(void * arg){ int ret=0; openair0_device *device=(openair0_device *)arg; openair0_thread_t *write_thread = &device->write_thread; @@ -549,7 +550,7 @@ void *trx_usrp_write_thread(void * arg){ } } - + s->tx_md.has_time_spec = true; s->tx_md.start_of_burst = (s->tx_count==0) ? true : first_packet; s->tx_md.end_of_burst = last_packet; @@ -572,7 +573,7 @@ void *trx_usrp_write_thread(void * arg){ buff_ptrs.push_back(&(((int16_t *)buff_tx[i])[0])); ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md); - } + } else { ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md); } @@ -589,7 +590,7 @@ void *trx_usrp_write_thread(void * arg){ int trx_usrp_write_init(openair0_device *device){ - uhd::set_thread_priority_safe(1.0); + //uhd::set_thread_priority_safe(1.0); openair0_thread_t *write_thread = &device->write_thread; printf("initializing tx write thread\n"); @@ -597,7 +598,8 @@ int trx_usrp_write_init(openair0_device *device){ write_thread->end = 0; write_thread->count_write = 0; printf("end of tx write thread\n"); - + pthread_mutex_init(&write_thread->mutex_write, NULL); + pthread_cond_init(&write_thread->cond_write, NULL); pthread_create(&write_thread->pthread_write,NULL,trx_usrp_write_thread,(void *)device); return(0); @@ -623,24 +625,48 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp #if defined(__x86_64) || defined(__i386__) #ifdef __AVX2__ nsamps2 = (nsamps+7)>>3; - __m256i buff_tmp[2][nsamps2]; + __m256i buff_tmp[4][nsamps2]; #else nsamps2 = (nsamps+3)>>2; - __m128i buff_tmp[2][nsamps2]; + __m128i buff_tmp[4][nsamps2]; #endif #elif defined(__arm__) nsamps2 = (nsamps+3)>>2; - int16x8_t buff_tmp[2][nsamps2]; + int16x8_t buff_tmp[4][nsamps2]; #endif - if (cc>1) { + int rxshift; + switch (device->type) { + case USRP_B200_DEV: + rxshift=4; + break; + case USRP_X300_DEV: + case USRP_N300_DEV: + rxshift=2; + break; + default: + AssertFatal(1==0,"Shouldn't be here\n"); + } + if (cc>1) { // receive multiple channels (e.g. RF A and RF B) std::vector buff_ptrs; - for (int i=0; irx_stream->recv(buff_ptrs, nsamps, s->rx_md); - } else { + while (samples_received != nsamps) { + for (int i=0; irx_stream->recv(buff_ptrs,nsamps-samples_received, s->rx_md); + + + if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE)) + break; + + if ((s->wait_for_first_pps == 1) && (samples_received != nsamps)) { + printf("sleep...\n"); //usleep(100); + } + } + if (samples_received == nsamps) s->wait_for_first_pps=0; + } else { // receive a single channel (e.g. from connector RF A) samples_received=0; @@ -666,17 +692,17 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp // FK: in some cases the buffer might not be 32 byte aligned, so we cannot use avx2 if ((((uintptr_t) buff[i])&0x1F)==0) { - ((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4); + ((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],rxshift); } else { - ((__m128i *)buff[i])[2*j] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j],4); - ((__m128i *)buff[i])[2*j+1] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j+1],4); + ((__m128i *)buff[i])[2*j] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j],rxshift); + ((__m128i *)buff[i])[2*j+1] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j+1],rxshift); } #else - ((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4); + ((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],rxshift); #endif #elif defined(__arm__) - ((int16x8_t *)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],4); + ((int16x8_t *)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],rxshift); #endif } } @@ -697,15 +723,23 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp s->usrp->set_gpio_attr("FP0", "OUT", gpio789<<7, 0x380); s->usrp->clear_command_time(); gpio789 = (gpio789+1)&7;*/ + recplay_state_t *recPlay=device->recplay_state; - if (device->recplay_state != NULL) { // record mode + if ( recPlay != NULL) { // record mode // Copy subframes to memory (later dump on a file) - if (device->recplay_state->nb_samples < device->openair0_cfg->recplay_conf->u_sf_max) { - (device->recplay_state->ms_sample+device->recplay_state->nb_samples)->header = BELL_LABS_IQ_HEADER; - (device->recplay_state->ms_sample+device->recplay_state->nb_samples)->ts = *ptimestamp; - memcpy((device->recplay_state->ms_sample+device->recplay_state->nb_samples)->samples, buff[0], nsamps*4); - device->recplay_state->nb_samples++; - } else exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n"); + if (recPlay->nbSamplesBlocks < device->openair0_cfg->recplay_conf->u_sf_max && + recPlay->maxSizeBytes > (recPlay->currentPtr-(uint8_t *)recPlay->ms_sample) + + sizeof(iqrec_t) + nsamps*4 ) { + iqrec_t *hdr=(iqrec_t *)recPlay->currentPtr; + hdr->header = BELL_LABS_IQ_HEADER; + hdr->ts = *ptimestamp; + hdr->nbBytes=nsamps*4; + memcpy(hdr+1, buff[0], nsamps*4); + recPlay->currentPtr+=sizeof(iqrec_t)+nsamps*4; + recPlay->nbSamplesBlocks++; + LOG_D(HW,"recorded %d samples, for TS %lu, shift in buffer %ld\n", nsamps, hdr->ts, recPlay->currentPtr-(uint8_t *)recPlay->ms_sample); + } else + exit_function(__FILE__, __FUNCTION__, __LINE__,"Recording reaches max iq limit\n"); } return samples_received; @@ -940,29 +974,29 @@ extern "C" { // hotfix! to be checked later - uhd::set_thread_priority_safe(1.0); + //uhd::set_thread_priority_safe(1.0); // Initialize USRP device int vers=0,subvers=0,subsubvers=0; int bw_gain_adjust=0; - + if (device->openair0_cfg->recplay_mode == RECPLAY_RECORDMODE) { std::cerr << "USRP device initialized in subframes record mode" << std::endl; } - + sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers); LOG_I(HW,"UHD version %s (%d.%d.%d)\n", uhd::get_version_string().c_str(),vers,subvers,subsubvers); std::string args; - + if (openair0_cfg[0].sdr_addrs == NULL) { args = "type=b200"; } else { args = openair0_cfg[0].sdr_addrs; LOG_I(HW,"Checking for USRP with args %s\n",openair0_cfg[0].sdr_addrs); } - + uhd::device_addrs_t device_adds = uhd::device::find(args); - + if (device_adds.size() == 0) { LOG_E(HW,"No USRP Device Found.\n "); free(s); @@ -972,38 +1006,38 @@ extern "C" { free(s); return -1; } - + LOG_I(HW,"Found USRP %s\n", device_adds[0].get("type").c_str()); double usrp_master_clock; - + if (device_adds[0].get("type") == "b200") { device->type = USRP_B200_DEV; usrp_master_clock = 30.72e6; args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680" ; } - + if (device_adds[0].get("type") == "n3xx") { printf("Found USRP n300\n"); - device->type=USRP_N300_DEV; + device->type=USRP_N300_DEV; usrp_master_clock = 122.88e6; args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); //args += ", send_buff_size=33554432"; } - + if (device_adds[0].get("type") == "x300") { printf("Found USRP x300\n"); device->type=USRP_X300_DEV; usrp_master_clock = 184.32e6; args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); - + // USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html if ( 0 != system("sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432") ) LOG_W(HW,"Can't set kernel parameters for X3xx\n"); } - + s->usrp = uhd::usrp::multi_usrp::make(args); - + if (args.find("clock_source")==std::string::npos) { if (openair0_cfg[0].clock_source == internal) { s->usrp->set_clock_source("internal"); @@ -1017,7 +1051,7 @@ extern "C" { s->usrp->set_clock_source("gpsdo"); LOG_D(HW,"Setting clock source to gpsdo\n"); } - else { + else { LOG_W(HW,"Clock source set neither in usrp_args nor on command line, using default!\n"); } } @@ -1040,7 +1074,7 @@ extern "C" { s->usrp->set_time_source("gpsdo"); LOG_D(HW,"Setting time source to gpsdo\n"); } - else { + else { LOG_W(HW,"Time source set neither in usrp_args nor on command line, using default!\n"); } } @@ -1050,10 +1084,10 @@ extern "C" { } } - + if (s->usrp->get_clock_source(0) == "gpsdo") { s->use_gps = 1; - + if (sync_to_gps(device)==EXIT_SUCCESS) { LOG_I(HW,"USRP synced with GPS!\n"); } else { @@ -1068,15 +1102,15 @@ extern "C" { exit(EXIT_FAILURE); } } - + if (device->type==USRP_X300_DEV) { openair0_cfg[0].rx_gain_calib_table = calib_table_x310; - std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; + std::cerr << "-- Using calibration table: calib_table_x310" << std::endl; } if (device->type==USRP_N300_DEV) { openair0_cfg[0].rx_gain_calib_table = calib_table_n310; - std::cerr << "-- Using calibration table: calib_table_n310" << std::endl; + std::cerr << "-- Using calibration table: calib_table_n310" << std::endl; } @@ -1091,7 +1125,7 @@ extern "C" { openair0_cfg[0].tx_bw = 80e6; openair0_cfg[0].rx_bw = 80e6; break; - + case 92160000: // from usrp_time_offset //openair0_cfg[0].samples_per_packet = 2048; @@ -1099,7 +1133,7 @@ extern "C" { openair0_cfg[0].tx_bw = 80e6; openair0_cfg[0].rx_bw = 80e6; break; - + case 61440000: // from usrp_time_offset //openair0_cfg[0].samples_per_packet = 2048; @@ -1107,14 +1141,14 @@ extern "C" { openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6; break; - + case 46080000: //openair0_cfg[0].samples_per_packet = 2048; openair0_cfg[0].tx_sample_advance = 65; openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6; break; - + case 30720000: // from usrp_time_offset //openair0_cfg[0].samples_per_packet = 2048; @@ -1122,35 +1156,35 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 15360000: //openair0_cfg[0].samples_per_packet = 2048; openair0_cfg[0].tx_sample_advance = 40; openair0_cfg[0].tx_bw = 10e6; openair0_cfg[0].rx_bw = 10e6; break; - + case 7680000: //openair0_cfg[0].samples_per_packet = 2048; openair0_cfg[0].tx_sample_advance = 50; openair0_cfg[0].tx_bw = 5e6; openair0_cfg[0].rx_bw = 5e6; break; - + case 1920000: //openair0_cfg[0].samples_per_packet = 2048; openair0_cfg[0].tx_sample_advance = 50; openair0_cfg[0].tx_bw = 1.25e6; openair0_cfg[0].rx_bw = 1.25e6; break; - + default: LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate); exit(-1); break; } } - + if (device->type == USRP_B200_DEV) { if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) { openair0_cfg[0].rx_gain_calib_table = calib_table_b210; @@ -1161,7 +1195,7 @@ extern "C" { bw_gain_adjust=1; std::cerr << "-- Using calibration table: calib_table_b210_38" << std::endl; // Bell Labs info } - + switch ((int)openair0_cfg[0].sample_rate) { case 46080000: s->usrp->set_master_clock_rate(46.08e6); @@ -1170,7 +1204,7 @@ extern "C" { openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6; break; - + case 30720000: s->usrp->set_master_clock_rate(30.72e6); //openair0_cfg[0].samples_per_packet = 1024; @@ -1178,7 +1212,7 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 23040000: s->usrp->set_master_clock_rate(23.04e6); //to be checked //openair0_cfg[0].samples_per_packet = 1024; @@ -1186,7 +1220,7 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 15360000: s->usrp->set_master_clock_rate(30.72e06); //openair0_cfg[0].samples_per_packet = 1024; @@ -1194,7 +1228,7 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 7680000: s->usrp->set_master_clock_rate(30.72e6); //openair0_cfg[0].samples_per_packet = 1024; @@ -1202,7 +1236,7 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + case 1920000: s->usrp->set_master_clock_rate(30.72e6); //openair0_cfg[0].samples_per_packet = 1024; @@ -1210,20 +1244,20 @@ extern "C" { openair0_cfg[0].tx_bw = 20e6; openair0_cfg[0].rx_bw = 20e6; break; - + default: LOG_E(HW,"Error: unknown sampling rate %f\n",openair0_cfg[0].sample_rate); exit(-1); break; } } - + /* device specific */ //openair0_cfg[0].txlaunch_wait = 1;//manage when TX processing is triggered //openair0_cfg[0].txlaunch_wait_slotcount = 1; //manage when TX processing is triggered openair0_cfg[0].iq_txshift = 4;//shift openair0_cfg[0].iq_rxrescale = 15;//rescale iqs - + for(int i=0; i<((int) s->usrp->get_rx_num_channels()); i++) { if (iusrp->set_rx_rate(openair0_cfg[0].sample_rate,i); @@ -1240,13 +1274,13 @@ extern "C" { openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i],gain_range.stop()); } } - + LOG_D(HW, "usrp->get_tx_num_channels() == %zd\n", s->usrp->get_tx_num_channels()); LOG_D(HW, "openair0_cfg[0].tx_num_channels == %d\n", openair0_cfg[0].tx_num_channels); - + for(int i=0; i<((int) s->usrp->get_tx_num_channels()); i++) { ::uhd::gain_range_t gain_range_tx = s->usrp->get_tx_gain_range(i); - + if (iusrp->set_tx_rate(openair0_cfg[0].sample_rate,i); s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i); @@ -1254,7 +1288,7 @@ extern "C" { LOG_I(HW,"USRP TX_GAIN:%3.2lf gain_range:%3.2lf tx_gain:%3.2lf\n", gain_range_tx.stop()-openair0_cfg[0].tx_gain[i], gain_range_tx.stop(), openair0_cfg[0].tx_gain[i]); } } - + //s->usrp->set_clock_source("external"); //s->usrp->set_time_source("external"); // display USRP settings @@ -1268,32 +1302,34 @@ extern "C" { int max=s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps(); samples/=10000; LOG_I(HW,"RF board max packet size %u, size for 100µs jitter %d \n", max, samples); - + if ( samples < max ) { stream_args_rx.args["spp"] = str(boost::format("%d") % samples ); } - + LOG_I(HW,"rx_max_num_samps %zu\n", s->usrp->get_rx_stream(stream_args_rx)->get_max_num_samps()); - for (int i = 0; irx_stream = s->usrp->get_rx_stream(stream_args_rx); uhd::stream_args_t stream_args_tx("sc16", "sc16"); - + for (int i = 0; itx_stream = s->usrp->get_tx_stream(stream_args_tx); - + /* Setting TX/RX BW after streamers are created due to USRP calibration issue */ for(int i=0; i<((int) s->usrp->get_tx_num_channels()) && iusrp->set_tx_bandwidth(openair0_cfg[0].tx_bw,i); - + for(int i=0; i<((int) s->usrp->get_rx_num_channels()) && iusrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i); - + for (int i=0; iusrp->get_rx_rate(i)/1e6); @@ -1302,7 +1338,7 @@ extern "C" { LOG_I(HW," Actual RX bandwidth: %fM...\n", s->usrp->get_rx_bandwidth(i)/1e6); LOG_I(HW," Actual RX antenna: %s...\n", s->usrp->get_rx_antenna(i).c_str()); } - + for (int i=0; iusrp->get_tx_rate(i)/1e6); @@ -1312,33 +1348,35 @@ extern "C" { LOG_I(HW," Actual TX antenna: %s...\n", s->usrp->get_tx_antenna(i).c_str()); LOG_I(HW," Actual TX packet size: %lu\n",s->tx_stream->get_max_num_samps()); } - + LOG_I(HW,"Device timestamp: %f...\n", s->usrp->get_time_now().get_real_secs()); device->trx_write_func = trx_usrp_write; device->trx_read_func = trx_usrp_read; s->sample_rate = openair0_cfg[0].sample_rate; - + // TODO: // init tx_forward_nsamps based usrp_time_offset ex if(is_equal(s->sample_rate, (double)30.72e6)) s->tx_forward_nsamps = 176; - + if(is_equal(s->sample_rate, (double)15.36e6)) s->tx_forward_nsamps = 90; - + if(is_equal(s->sample_rate, (double)7.68e6)) s->tx_forward_nsamps = 50; - - - if (device->recplay_state != NULL) { // record mode - device->recplay_state->ms_sample = (iqrec_t *) malloc(openair0_cfg[0].recplay_conf->u_sf_max * sizeof(iqrec_t)); - - if (device->recplay_state->ms_sample == NULL) { + + recplay_state_t *recPlay=device->recplay_state; + + if (recPlay != NULL) { // record mode + recPlay->maxSizeBytes=openair0_cfg[0].recplay_conf->u_sf_max * + (sizeof(iqrec_t)+BELL_LABS_IQ_BYTES_PER_SF); + recPlay->ms_sample = (iqrec_t *) malloc(recPlay->maxSizeBytes); + recPlay->currentPtr= (uint8_t *)recPlay->ms_sample; + + if (recPlay->ms_sample == NULL) { std::cerr<< "Memory allocation failed for subframe record or replay mode." << std::endl; exit(-1); } - - memset(device->recplay_state->ms_sample, 0, openair0_cfg[0].recplay_conf->u_sf_max * BELL_LABS_IQ_BYTES_PER_SF); } return 0; } diff --git a/targets/ARCH/iqplayer/iqplayer_lib.c b/targets/ARCH/iqplayer/iqplayer_lib.c index c4133d1b11..8b6844f9d3 100644 --- a/targets/ARCH/iqplayer/iqplayer_lib.c +++ b/targets/ARCH/iqplayer/iqplayer_lib.c @@ -25,7 +25,6 @@ */ #define _LARGEFILE_SOURCE #define _FILE_OFFSET_BITS 64 -#define NB_ANTENNAS_RX 2 #include #include #include @@ -40,18 +39,15 @@ #include "assertions.h" #include "common/utils/LOG/log.h" - - - - - static void parse_iqfile_header(openair0_device *device, iqfile_header_t *iq_fh) { - AssertFatal((memcmp(iq_fh->oaiid,OAIIQFILE_ID,sizeof(OAIIQFILE_ID)) == 0), - "iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n", - iq_fh->oaiid); + char tmp[4]=OAIIQFILE_ID; + AssertFatal((memcmp(iq_fh->oaiid,tmp,sizeof(iq_fh->oaiid)) == 0), + "iqfile doesn't seem to be compatible with oai (invalid id %.4s in header)\n", + iq_fh->oaiid); device->type = iq_fh->devtype; device->openair0_cfg[0].tx_sample_advance=iq_fh->tx_sample_advance; device->openair0_cfg[0].tx_bw = device->openair0_cfg[0].rx_bw = iq_fh->bw; + device->recplay_state->nbSamplesBlocks=iq_fh->nbSamplesBlocks; LOG_UI(HW,"Replay iqs from %s device, bandwidth %e\n",get_devname(iq_fh->devtype),iq_fh->bw); } @@ -63,89 +59,73 @@ static int iqplayer_loadfile(openair0_device *device, openair0_config_t *openair recplay_state_t *s = device->recplay_state; recplay_conf_t *c = openair0_cfg->recplay_conf; + struct stat sb; + s->fd = open(c->u_sf_filename, O_RDONLY ); + if (s->fd >= 0 ) { + fstat(s->fd, &sb); + } else { + LOG_E( HW,"Cannot open %s exiting.\n", c->u_sf_filename ); + exit(-1); + } + if (s->use_mmap) { // use mmap - s->mmapfd = open(c->u_sf_filename, O_RDONLY ); - - if (s->mmapfd != 0) { - struct stat sb; - fstat(s->mmapfd, &sb); s->mapsize=sb.st_size; LOG_I(HW,"Loading subframes using mmap() from %s size=%lu bytes ...\n",c->u_sf_filename, (uint64_t)sb.st_size ); - void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) ; - s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->mmapfd, 0) + sizeof(iqfile_header_t)); + void *mptr = mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) ; + s->ms_sample = (iqrec_t *) ( mmap(NULL, sb.st_size, PROT_WRITE, MAP_PRIVATE, s->fd, 0) + sizeof(iqfile_header_t)); if (mptr != MAP_FAILED) { parse_iqfile_header(device, (iqfile_header_t *)mptr); s->ms_sample = (iqrec_t *)((char *)mptr + sizeof(iqfile_header_t)); - s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t)) / sizeof(iqrec_t)); - int aligned = (((unsigned long)s->ms_sample & 31) == 0)? 1:0; - LOG_I(HW,"Loaded %u subframes.\n",s->nb_samples ); - - if (aligned == 0) { - LOG_E(HW, "mmap address is not 32 bytes aligned, exiting.\n" ); - close(s->mmapfd); - exit(-1); - } + LOG_I(HW,"Loaded %u subframes.\n",s->nbSamplesBlocks ); } else { LOG_E(HW,"Cannot mmap file, exiting.\n"); - close(s->mmapfd); + close(s->fd); exit(-1); } - } else { - LOG_E( HW,"Cannot open %s exiting.\n", c->u_sf_filename ); - exit(-1); - } } else { - s->iqfd = open(c->u_sf_filename, O_RDONLY); + iqfile_header_t fh; + size_t hs = read(s->fd,&fh,sizeof(fh)); - if (s->iqfd != 0) { - struct stat sb; - iqfile_header_t fh; - size_t hs = read(s->iqfd,&fh,sizeof(fh)); - - if (hs == sizeof(fh)) { - parse_iqfile_header(device, &fh); - fstat(s->iqfd, &sb); + if (hs == sizeof(fh)) { + parse_iqfile_header(device, &fh); + fstat(s->fd, &sb); s->mapsize=sb.st_size; - s->nb_samples = ((sb.st_size-sizeof(iqfile_header_t))/ sizeof(iqrec_t)); - LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nb_samples, c->u_sf_filename,(uint64_t)sb.st_size); + LOG_I(HW, "Loading %u subframes from %s,size=%lu bytes ...\n",s->nbSamplesBlocks, c->u_sf_filename,(uint64_t)sb.st_size); // allocate buffer for 1 sample at a time - s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t)); + s->ms_sample = (iqrec_t *) malloc(sizeof(iqrec_t)+MAX_BELL_LABS_IQ_BYTES_PER_SF*4); if (s->ms_sample == NULL) { LOG_E(HW,"Memory allocation failed for individual subframe replay mode.\n" ); - close(s->iqfd); + close(s->fd); exit(-1); } memset(s->ms_sample, 0, sizeof(iqrec_t)); // point at beginning of iqs in file - if (lseek(s->iqfd,sizeof(iqfile_header_t), SEEK_SET) == 0) { + if (lseek(s->fd,sizeof(iqfile_header_t), SEEK_SET) == 0) { LOG_I(HW,"Initial seek at beginning of the file\n" ); } else { LOG_I(HW,"Problem initial seek at beginning of the file\n"); } } else { LOG_E(HW,"Cannot read header in %s exiting.\n",c->u_sf_filename ); - close(s->iqfd); + close(s->fd); exit(-1); } - } else { - LOG_E(HW,"Cannot open %s exiting.\n",c->u_sf_filename ); - exit(-1); - } } + s->currentPtr=(uint8_t *)s->ms_sample; return 0; } /*! \brief start the oai iq player * \param device, the hardware used */ -static int trx_iqplayer_start(openair0_device *device){ - return 0; +static int trx_iqplayer_start(openair0_device *device) { + return 0; } /*! \brief Terminate operation of the oai iq player @@ -157,28 +137,22 @@ static void trx_iqplayer_end(openair0_device *device) { if (device->recplay_state == NULL) return; - + if (device->recplay_state->use_mmap) { if (device->recplay_state->ms_sample != MAP_FAILED) { munmap(device->recplay_state->ms_sample, device->recplay_state->mapsize); - device->recplay_state->ms_sample = NULL; - } - - if (device->recplay_state->mmapfd != 0) { - close(device->recplay_state->mmapfd); - device->recplay_state->mmapfd = 0; - } + } } else { if (device->recplay_state->ms_sample != NULL) { free(device->recplay_state->ms_sample); - device->recplay_state->ms_sample = NULL; - } - - if (device->recplay_state->iqfd != 0) { - close(device->recplay_state->iqfd); - device->recplay_state->iqfd = 0; - } + } } + device->recplay_state->ms_sample = NULL; + if (device->recplay_state->fd >= 0) { + close(device->recplay_state->fd); + device->recplay_state->fd = -1; + } + } /*! \brief Write iqs function when in replay mode, just introduce a delay, as configured at init time, @param device pointer to the device structure specific to the RF hardware target @@ -208,93 +182,68 @@ static int trx_iqplayer_write(openair0_device *device, openair0_timestamp timest * \returns the number of sample read */ static int trx_iqplayer_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc) { - int samples_received=0; - static unsigned int cur_samples; - static int64_t wrap_count; - static int64_t wrap_ts; recplay_state_t *s = device->recplay_state; - if (cur_samples == s->nb_samples) { - cur_samples = 0; - wrap_count++; + if (s->curSamplesBlock==0 && s->wrap_count==0 ) + s->currentTs=s->ms_sample->ts; + + if (s->curSamplesBlock == s->nbSamplesBlocks) { + LOG_I(HW, "wrapping on iq file (%ld)\n", s->wrap_count); + s->curSamplesBlock = 0; + s->wrap_count++; - if (wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) { - LOG_W(HW, "iqplayer device terminating subframes replay after %u iteration\n",device->openair0_cfg->recplay_conf->u_sf_loops); + if (s->wrap_count == device->openair0_cfg->recplay_conf->u_sf_loops) { + LOG_W(HW, "iqplayer device terminating subframes replay after %u iteration\n", + device->openair0_cfg->recplay_conf->u_sf_loops); exit_function(__FILE__, __FUNCTION__, __LINE__,"replay ended, triggering process termination\n"); } - wrap_ts = wrap_count * (s->nb_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000)); + LOG_I(HW,"go back at the beginning of IQ file"); + device->recplay_state->currentPtr=(uint8_t *)device->recplay_state->ms_sample; - if (!device->recplay_state->use_mmap) { - if (lseek(device->recplay_state->iqfd, 0, SEEK_SET) == 0) { - LOG_I(HW,"Seeking at the beginning of IQ file"); - } else { - LOG_I(HW, "Problem seeking at the beginning of IQ file"); + if (!s->use_mmap) { + if (lseek(device->recplay_state->fd, 0, SEEK_SET) != 0) { + LOG_E(HW, "Problem seeking at the beginning of IQ file"); } } } - if (s->use_mmap) { - if (cur_samples < s->nb_samples) { - *ptimestamp = (s->ms_sample[0].ts + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000))) + wrap_ts; - - if (cur_samples == 0) { - LOG_I(HW,"starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu\n", wrap_count,wrap_ts,*ptimestamp); - } - - memcpy(buff[0], &s->ms_sample[cur_samples].samples[0], nsamps*4); - cur_samples++; - } - } else { + if (!s->use_mmap) { // read sample from file - if (read(s->iqfd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) { - LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*cur_samples ); - close(s->iqfd); - free(s->ms_sample); - s->ms_sample = NULL; - s->iqfd = 0; + if (read(s->fd, s->ms_sample, sizeof(iqrec_t)) != sizeof(iqrec_t)) { + LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock ); exit(-1); - } - - if (cur_samples < s->nb_samples) { - static int64_t ts0 = 0; - - if ((cur_samples == 0) && (wrap_count == 0)) { - ts0 = s->ms_sample->ts; - } - - *ptimestamp = ts0 + (cur_samples * (((int)(device->openair0_cfg[0].sample_rate)) / 1000)) + wrap_ts; - - if (cur_samples == 0) { - LOG_I(HW, "starting subframes file with wrap_count=%lu wrap_ts=%lu ts=%lu ",wrap_count,wrap_ts, *ptimestamp); - } - - memcpy(buff[0], &s->ms_sample->samples[0], nsamps*4); - cur_samples++; - // Prepare for next read - off_t where = lseek(s->iqfd, cur_samples * sizeof(iqrec_t), SEEK_SET); - - if (where < 0) { - LOG_E(HW,"Cannot lseek in iqfile: %s\n",strerror(errno)); + } else { + if (read(s->fd, s->ms_sample+1, s->ms_sample->nbBytes) != s->ms_sample->nbBytes) { + LOG_E(HW,"pb reading iqfile at index %lu\n",sizeof(iqrec_t)*s->curSamplesBlock ); exit(-1); } } } + iqrec_t *curHeader=(iqrec_t *)s->currentPtr; + AssertFatal(curHeader->header==BELL_LABS_IQ_HEADER,"" ); + // the current timestamp is the stored timestamp until we wrap on input + // USRP shifts 1 sample time to time + AssertFatal(s->wrap_count !=0 || abs(curHeader->ts-s->currentTs) < 5 ,""); + AssertFatal(nsamps*4==curHeader->nbBytes,""); + *ptimestamp = s->currentTs; + memcpy(buff[0], curHeader+1, nsamps*4); + s->curSamplesBlock++; + // Prepare for next read + s->currentTs+=nsamps; + + if (s->use_mmap) + s->currentPtr+=sizeof(iqrec_t)+s->ms_sample->nbBytes; + struct timespec req; - req.tv_sec = 0; - req.tv_nsec = (device->openair0_cfg[0].recplay_conf->u_sf_read_delay) * 1000; - nanosleep(&req, NULL); - + LOG_D(HW, "returning %d samples at ts %lu\n", nsamps, *ptimestamp); return nsamps; - - return samples_received; } - int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { device->openair0_cfg = openair0_cfg; device->trx_start_func = trx_iqplayer_start; @@ -313,5 +262,4 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { LOG_UI(HW,"iqplayer device initialized, replay %s for %i iterations",openair0_cfg->recplay_conf->u_sf_filename,openair0_cfg->recplay_conf->u_sf_loops); return 0; } - /*@}*/ diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c index 3f4c0e1517..ab8ae77edd 100644 --- a/targets/ARCH/rfsimulator/apply_channelmod.c +++ b/targets/ARCH/rfsimulator/apply_channelmod.c @@ -65,17 +65,8 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si // Fixme: not sure when it is "volts" so dB is 20*log10(...) or "power", so dB is 10*log10(...) const double pathLossLinear = pow(10,channelDesc->path_loss_dB/20.0); // Energy in one sample to calibrate input noise - //Fixme: modified the N0W computation, not understand the origin value - const double KT=1.38e-23*290; //Boltzman*temperature - // sampling rate is linked to acquisition band (the input pass band filter) - const double noise_figure_watt = KT*channelDesc->sampling_rate; - // Fixme: how to convert a noise in Watt into a 12 bits value out of the RF ADC ? - // the parameter "-s" is declared as SNR, but the input power is not well defined - // −132.24 dBm is a LTE subcarrier noise, that was used in origin code (15KHz BW thermal noise) - const double rxGain= 132.24 - channelmod_get_snr_dB(); - // sqrt(4*noise_figure_watt) is the thermal noise factor (volts) - // fixme: the last constant is pure trial results to make decent noise - const double noise_per_sample = sqrt(4*noise_figure_watt) * pow(10,rxGain/20) *10; + // the normalized OAI value seems to be 256 as average amplitude (numerical amplification = 1) + const double noise_per_sample = pow(10,channelDesc->noise_power_dB/10.0) * 256; // Fixme: we don't fill the offset length samples at begining ? // anyway, in today code, channel_offset=0 const int dd = abs(channelDesc->channel_offset); diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index cd35c46a15..3bd4285cff 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -54,22 +54,21 @@ #include #define PORT 4043 //default TCP port for this simulator -#define CirSize 307200 // 100ms is enough +#define CirSize 6144000 // 100ms is enough #define sampleToByte(a,b) ((a)*(b)*sizeof(sample_t)) #define byteToSample(a,b) ((a)/(sizeof(sample_t)*(b))) #define MAX_SIMULATION_CONNECTED_NODES 5 #define GENERATE_CHANNEL 10 //each frame in DL -// Fixme: datamodel, external variables in .h files, ... -#include -extern RAN_CONTEXT_t RC; // #define RFSIMU_SECTION "rfsimulator" #define RFSIMU_OPTIONS_PARAMNAME "options" -# define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\ + + +#define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\ " chanmod: enable channel modelisation\n"\ " saviq: enable saving written iqs to a file\n" /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ @@ -78,21 +77,21 @@ extern RAN_CONTEXT_t RC; /*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define simOpt PARAMFLAG_NOFREE|PARAMFLAG_CMDLINE_NOPREFIXENABLED #define RFSIMULATOR_PARAMS_DESC { \ - {"serveraddr", "\n", simOpt , strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\ - {"serverport", "\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ - {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ - {"IQfile", "\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ - {"modelname", "\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\ - {"ploss", "\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ - {"forgetfact", "\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ - {"offset", "\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\ + {"serveraddr", "\n", simOpt, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\ + {"serverport", "\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\ + {RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\ + {"IQfile", "\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\ + {"modelname", "\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\ + {"ploss", "\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\ + {"forgetfact", "\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\ + {"offset", "\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\ }; static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg); static telnetshell_cmddef_t rfsimu_cmdarray[] = { - {"setmodel","",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, + {"setmodel"," ",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ}, {"","",NULL}, }; @@ -133,6 +132,7 @@ typedef struct { double chan_pathloss; double chan_forgetfact; int chan_offset; + float noise_power_dB; void *telnetcmd_qid; poll_telnetcmdq_func_t poll_telnetcmdq; } rfsimulator_state_t; @@ -182,15 +182,9 @@ static void allocCirBuf(rfsimulator_state_t *bridge, int sock) { tableNor(rand); init_done=true; } - - ptr->channel_model=new_channel_desc_scm(bridge->tx_num_channels,bridge->rx_num_channels, - bridge->channelmod, - bridge->sample_rate, - bridge->tx_bw, - 30e-9, // TDL delay-spread parameter - bridge->chan_forgetfact, // forgetting_factor - bridge->chan_offset, // maybe used for TA - bridge->chan_pathloss); // path_loss in dB + char *modelname = (bridge->typeStamp == ENB_MAGICDL) ? "rfsimu_channel_ue0":"rfsimu_channel_enB0"; + ptr->channel_model=find_channel_desc_fromname(modelname); // path_loss in dB + AssertFatal((ptr->channel_model!= NULL),"Channel model %s not found, check config file\n",modelname); set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID); random_channel(ptr->channel_model,false); } @@ -299,7 +293,8 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { break; } else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) { init_channelmod(); - rfsimulator->channelmod=modelid_fromname(modelname); + load_channellist(rfsimulator->tx_num_channels, rfsimulator->rx_num_channels, rfsimulator->sample_rate, rfsimulator->tx_bw); + rfsimulator->channelmod=true; } else { fprintf(stderr,"Unknown rfsimulator option: %s\n",rfsimu_params[p].strlistptr[i]); exit(-1); @@ -320,20 +315,27 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg) { char *modelname=NULL; - int s = sscanf(buff,"%ms\n",&modelname); + char *modeltype=NULL; + if (debug) + prnt("rfsimu_setchanmod_cmd buffer \"%s\"\n",buff); + int s = sscanf(buff,"%m[^ ] %ms\n",&modelname, &modeltype); - if (s == 1) { - int channelmod=modelid_fromname(modelname); + if (s == 2) { + int channelmod=modelid_fromstrtype(modeltype); if (channelmod<0) - prnt("ERROR: model %s unknown\n",modelname); + prnt("ERROR: model type %s unknown\n",modeltype); else { rfsimulator_state_t *t = (rfsimulator_state_t *)arg; - + int found=0; for (int i=0; ibuf[i]; + if ( b->channel_model==NULL) + continue; + if (b->channel_model->model_name==NULL) + continue; + if (b->conn_sock >= 0 && (strcmp(b->channel_model->model_name,modelname)==0)) { - if (b->conn_sock >= 0 ) { channel_desc_t *newmodel=new_channel_desc_scm(t->tx_num_channels,t->rx_num_channels, channelmod, t->sample_rate, @@ -341,21 +343,29 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, 30e-9, // TDL delay-spread parameter t->chan_forgetfact, // forgetting_factor t->chan_offset, // maybe used for TA - t->chan_pathloss); // path_loss in dB + t->chan_pathloss, + t->noise_power_dB + ); // path_loss in dB set_channeldesc_owner(newmodel, RFSIMU_MODULEID); + set_channeldesc_name(newmodel,modelname); random_channel(newmodel,false); channel_desc_t *oldmodel=b->channel_model; b->channel_model=newmodel; free_channel_desc_scm(oldmodel); - prnt("New model %s applied to channel connected to sock %d\n",modelname,i); + prnt("New model type %s applied to channel %s connected to sock %d\n",modeltype,modelname,i); + found=1; + break; } - } + } /* for */ + if (found==0) + prnt("Channel %s not found or not currently used\n",modelname); } } else { - prnt("ERROR: no model specified\n"); + prnt("ERROR: 2 parameters required: model name and model type (%i found)\n",s); } free(modelname); + free(modeltype); return CMDSTATUS_FOUND; } @@ -774,6 +784,11 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { // to change the log level, use this on command line // --log_config.hw_log_level debug rfsimulator_state_t *rfsimulator = (rfsimulator_state_t *)calloc(sizeof(rfsimulator_state_t),1); + // initialize channel simulation + rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels; + rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels; + rfsimulator->sample_rate=openair0_cfg->sample_rate; + rfsimulator->tx_bw=openair0_cfg->tx_bw; rfsimulator_readconfig(rfsimulator); pthread_mutex_init(&Sockmutex, NULL); LOG_I(HW,"rfsimulator: running as %s\n", rfsimulator-> typeStamp == ENB_MAGICDL ? "server waiting opposite rfsimulators to connect" : "client: will connect to a rfsimulator server side"); @@ -798,11 +813,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { rfsimulator->buf[i].conn_sock=-1; AssertFatal((rfsimulator->epollfd = epoll_create1(0)) != -1,""); - // initialize channel simulation - rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels; - rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels; - rfsimulator->sample_rate=openair0_cfg->sample_rate; - rfsimulator->tx_bw=openair0_cfg->tx_bw; + //randominit(0); set_taus_seed(0); /* look for telnet server, if it is loaded, add the channel modeling commands to it */ diff --git a/targets/ARCH/rfsimulator/stored_node.c b/targets/ARCH/rfsimulator/stored_node.c index dcea69b9dd..cf025680cd 100644 --- a/targets/ARCH/rfsimulator/stored_node.c +++ b/targets/ARCH/rfsimulator/stored_node.c @@ -186,14 +186,14 @@ int main(int argc, char *argv[]) { serviceSock=client_start(argv[2],atoi(argv[3])); } - uint64_t typeStamp=ENB_MAGICDL_FDD; + uint64_t typeStamp=ENB_MAGICDL; boolean_t raw=false; if ( argc == 5 ) { raw=true; if (strcmp(argv[4],"UL") == 0 ) - typeStamp=UE_MAGICDL_FDD; + typeStamp=UE_MAGICDL; } samplesBlockHeader_t header; @@ -201,7 +201,6 @@ int main(int argc, char *argv[]) { void *buff=malloc(bufSize); uint64_t timestamp=0; const int blockSize=1920; - // If fileSize is not multiple of blockSize*4 then discard remaining samples fileSize = (fileSize/(blockSize<<2))*(blockSize<<2); diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 4d57ab4e16..3e0d97f60a 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -42,6 +42,7 @@ # include "enb_app.h" # include "openair2/LAYER2/MAC/mac_proto.h" #include +#include extern RAN_CONTEXT_t RC; diff --git a/targets/COMMON/create_tasks_mbms.c b/targets/COMMON/create_tasks_mbms.c index 5f81592b96..579e851ea7 100644 --- a/targets/COMMON/create_tasks_mbms.c +++ b/targets/COMMON/create_tasks_mbms.c @@ -47,6 +47,7 @@ # include "mce_app.h" # include "mme_app.h" +#include //extern RAN_CONTEXT_t RC; int create_tasks_mbms(uint32_t enb_nb) { diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h index ad98a6091b..de1502112b 100644 --- a/targets/COMMON/openairinterface5g_limits.h +++ b/targets/COMMON/openairinterface5g_limits.h @@ -6,23 +6,39 @@ # define NUMBER_OF_gNB_MAX 1 # define NUMBER_OF_RU_MAX 2 # define NUMBER_OF_NR_RU_MAX 2 +# define NUMBER_OF_UCI_MAX 16 +# define NUMBER_OF_ULSCH_MAX 8 +# define NUMBER_OF_DLSCH_MAX 8 +# define NUMBER_OF_SRS_MAX 16 +# define NUMBER_OF_NR_ULSCH_MAX 8 +# define NUMBER_OF_NR_DLSCH_MAX 8 +# define NUMBER_OF_NR_UCI_MAX 16 +# define nUMBER_OF_NR_SRS_MAX 16 +# define NUMBER_OF_SCH_STATS_MAX 16 + +# define NUMBER_OF_NR_SCH_STATS_MAX 16 + +# define NUMBER_OF_NR_PUCCH_MAX 16 +# define NUMBER_OF_NR_SR_MAX 16 +# define NUMBER_OF_NR_PDCCH_MAX 16 + +#define MAX_MANAGED_ENB_PER_MOBILE 2 +#define MAX_MANAGED_GNB_PER_MOBILE 2 + # ifndef PHYSIM # ifndef UE_EXPANSION # define NUMBER_OF_UE_MAX 4 # define NUMBER_OF_NR_UE_MAX 4 -# define NUMBER_OF_UCI_VARS_MAX 14 # define NUMBER_OF_CONNECTED_eNB_MAX 1 # define NUMBER_OF_CONNECTED_gNB_MAX 1 # else # define NUMBER_OF_UE_MAX 256 -# define NUMBER_OF_UCI_VARS_MAX 256 # define NUMBER_OF_CONNECTED_eNB_MAX 1 # define NUMBER_OF_CONNECTED_gNB_MAX 1 # endif # else # define NUMBER_OF_UE_MAX 4 # define NUMBER_OF_NR_UE_MAX 4 -# define NUMBER_OF_UCI_VARS_MAX 56 # define NUMBER_OF_CONNECTED_eNB_MAX 1 # define NUMBER_OF_CONNECTED_gNB_MAX 1 # endif diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf index 504d5e7b34..cc44ffd27b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/benetel-5g.conf @@ -15,7 +15,8 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + #plmn_list = ({mcc = 222; mnc = 01; mnc_length = 2;}); + plmn_list = ({mcc = 208; mnc = 99; mnc_length = 2;}); tr_s_preference = "local_mac" @@ -23,6 +24,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; #pusch_TargetSNRx10 = 200; #pucch_TargetSNRx10 = 200; pusch_TargetSNRx10 = 200; @@ -50,7 +52,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -59,27 +61,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) - initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -92,7 +81,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -104,9 +93,9 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 74; zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -118; + #preambleReceivedTargetPower = -118; #preambleReceivedTargetPower = -104; - #preambleReceivedTargetPower = -108; + preambleReceivedTargetPower = -108; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep @@ -136,20 +125,18 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_2 = 7; + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + msg3_DeltaPreamble = 1; #p0_NominalWithGrant =-90; @@ -210,7 +197,7 @@ gNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.18.99"; + mme_ip_address = ( { ipv4 = "192.168.18.150"; #"192.168.18.99"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band22.tm1.106PRB.adrv9371zc706.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band22.tm1.106PRB.adrv9371zc706.conf deleted file mode 100644 index 5fd4b465b3..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band22.tm1.106PRB.adrv9371zc706.conf +++ /dev/null @@ -1,289 +0,0 @@ -Active_gNBs = ( "gNB-Eurecom-5GNRBox"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -gNBs = -( - { - ////////// Identification parameters: - gNB_ID = 0xe00; - - cell_type = "CELL_MACRO_GNB"; - - gNB_name = "gNB-Eurecom-5GNRBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = 1; - - plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); - - tr_s_preference = "local_mac" - - ////////// Physical parameters: - - component_carriers = ( - { - node_function = "3GPP_gNODEB"; - node_timing = "synch_to_ext_device"; - node_synch_ref = 0; - frame_type = "TDD"; - DL_prefix_type = "NORMAL"; - UL_prefix_type = "NORMAL"; - eutra_band = 78; - downlink_frequency = 3510000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 106; - nb_antenna_ports = 1; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 125; - MIB_subCarrierSpacingCommon = 30; - MIB_ssb_SubcarrierOffset = 0; - MIB_dmrs_TypeA_Position = 2; - pdcch_ConfigSIB1 = 0; - SIB1_frequencyOffsetSSB = "khz5"; - SIB1_ssb_PeriodicityServingCell = 5; - SIB1_ss_PBCH_BlockPower = -60; - absoluteFrequencySSB = 0; - DL_FreqBandIndicatorNR = 15; - DL_absoluteFrequencyPointA = 15; - DL_offsetToCarrier = 15; - DL_SCS_SubcarrierSpacing = "kHz30"; - DL_SCS_SpecificCarrier_k0 = 0; - DL_carrierBandwidth = 15; - DL_locationAndBandwidth = 15; - DL_BWP_SubcarrierSpacing = "kHz30"; - DL_BWP_prefix_type = "NORMAL"; - UL_FreqBandIndicatorNR = 15; - UL_absoluteFrequencyPointA = 13; - UL_additionalSpectrumEmission = 3; - UL_p_Max = -1; - UL_frequencyShift7p5khz = "TRUE"; - UL_offsetToCarrier = 10; - UL_SCS_SubcarrierSpacing = "kHz30"; - UL_SCS_SpecificCarrier_k0 = 0; - UL_carrierBandwidth = 15; - UL_locationAndBandwidth = 15; - UL_BWP_SubcarrierSpacing = "kHz30"; - UL_BWP_prefix_type = "NORMAL"; - UL_timeAlignmentTimerCommon = "infinity"; - ServingCellConfigCommon_n_TimingAdvanceOffset = "n0" - ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x01; - ServingCellConfigCommon_ssb_periodicityServingCell = 10; - ServingCellConfigCommon_dmrs_TypeA_Position = 2; - NIA_SubcarrierSpacing = "kHz15"; - ServingCellConfigCommon_ss_PBCH_BlockPower = -60; - referenceSubcarrierSpacing = "kHz15"; - dl_UL_TransmissionPeriodicity = "ms0p5"; - nrofDownlinkSlots = 10; - nrofDownlinkSymbols = 10; - nrofUplinkSlots = 10; - nrofUplinkSymbols = 10; - rach_totalNumberOfRA_Preambles = 63; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice = "oneEighth"; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth = 4; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth = 8; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf = 16; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one = 24; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two = 32; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four = 8; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight = 4; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen = 2; - rach_groupBconfigured = "ENABLE"; - rach_ra_Msg3SizeGroupA = 56; - rach_messagePowerOffsetGroupB = "dB0"; - rach_numberOfRA_PreamblesGroupA = 32; - rach_ra_ContentionResolutionTimer = 8; - rsrp_ThresholdSSB = 64; - rsrp_ThresholdSSB_SUL = 64; - prach_RootSequenceIndex_choice = "l839"; - prach_RootSequenceIndex_l839 = 0; - prach_RootSequenceIndex_l139 = 0; - prach_msg1_SubcarrierSpacing = "kHz30"; - restrictedSetConfig = "unrestrictedSet"; - msg3_transformPrecoding = "ENABLE"; - prach_ConfigurationIndex = 10; - prach_msg1_FDM = "one"; - prach_msg1_FrequencyStart = 10; - zeroCorrelationZoneConfig = 10; - preambleReceivedTargetPower = -150; - preambleTransMax = 6; - powerRampingStep = "dB0"; - ra_ResponseWindow = 8; - groupHoppingEnabledTransformPrecoding = "ENABLE"; - msg3_DeltaPreamble = 0; - p0_NominalWithGrant = 0; - PUSCH_TimeDomainResourceAllocation_k2 = 0; - PUSCH_TimeDomainResourceAllocation_mappingType = "typeA"; - PUSCH_TimeDomainResourceAllocation_startSymbolAndLength = 0; - pucch_ResourceCommon = 0; - pucch_GroupHopping = "neither"; - hoppingId = 0; - p0_nominal = -30; - PDSCH_TimeDomainResourceAllocation_k0 = 2; - PDSCH_TimeDomainResourceAllocation_mappingType = "typeA"; - PDSCH_TimeDomainResourceAllocation_startSymbolAndLength = 0; - rateMatchPatternId = 0; - RateMatchPattern_patternType = "bitmaps"; - symbolsInResourceBlock = "oneSlot"; - periodicityAndPattern = 2; - RateMatchPattern_controlResourceSet = 5; - RateMatchPattern_subcarrierSpacing = "kHz30"; - RateMatchPattern_mode = "dynamic"; - controlResourceSetZero = 0; - searchSpaceZero = 0; - searchSpaceSIB1 = 10; - searchSpaceOtherSystemInformation = 10; - pagingSearchSpace = 10; - ra_SearchSpace = 10; - PDCCH_common_controlResourceSetId = 5; - PDCCH_common_ControlResourceSet_duration = 2; - PDCCH_cce_REG_MappingType = "nonInterleaved"; - PDCCH_reg_BundleSize = 3; - PDCCH_interleaverSize = 3; - PDCCH_shiftIndex = 10; - PDCCH_precoderGranularity = "sameAsREG-bundle"; - PDCCH_TCI_StateId = 32; - tci_PresentInDCI = "ENABLE"; - PDCCH_DMRS_ScramblingID = 0; - SearchSpaceId = 10; - commonSearchSpaces_controlResourceSetId = 5; - SearchSpace_monitoringSlotPeriodicityAndOffset_choice = "sl1"; - SearchSpace_monitoringSlotPeriodicityAndOffset_value = 0; - SearchSpace_duration = 2; - SearchSpace_nrofCandidates_aggregationLevel1 = 0; - SearchSpace_nrofCandidates_aggregationLevel2 = 0; - SearchSpace_nrofCandidates_aggregationLevel4 = 0; - SearchSpace_nrofCandidates_aggregationLevel8 = 0; - SearchSpace_nrofCandidates_aggregationLevel16 = 0; - SearchSpace_searchSpaceType = "common"; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1 = 1; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2 = 1; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4 = 1; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8 = 1; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16 = 1; - Common_dci_Format2_3_monitoringPeriodicity = 1; - Common_dci_Format2_3_nrofPDCCH_Candidates = 1; - ue_Specific__dci_Formats = "formats0-0-And-1-0"; - RateMatchPatternLTE_CRS_carrierFreqDL = 6; - RateMatchPatternLTE_CRS_carrierBandwidthDL = 6; - RateMatchPatternLTE_CRS_nrofCRS_Ports = 1; - RateMatchPatternLTE_CRS_v_Shift = 0; - RateMatchPatternLTE_CRS_radioframeAllocationPeriod = 1; - RateMatchPatternLTE_CRS_radioframeAllocationOffset = 0; - RateMatchPatternLTE_CRS_subframeAllocation_choice = "oneFrame"; - } - ); - - - srb1_parameters : - { - # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] - timer_poll_retransmit = 80; - - # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] - timer_reordering = 35; - - # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] - timer_status_prohibit = 0; - - # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] - poll_pdu = 4; - - # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] - poll_byte = 99999; - - # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] - max_retx_threshold = 4; - } - - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; - ipv6 = "192:168:30::17"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - - GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; - GNB_INTERFACE_NAME_FOR_S1U = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; - GNB_PORT_FOR_S1U = 2152; # Spec 2152 - }; - } -); - -MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } -); - -L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - } -); - -RUs = ( - { - local_rf = "yes" - nb_tx = 1 - nb_rx = 1 - att_tx = 0 - att_rx = 0; - bands = [7]; - max_pdschReferenceSignalPower = -27; - max_rxgain = 114; - eNB_instances = [0]; - sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2,mgmt_addr=192.168.100.8"; - - } -); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - - log_config : - { - global_log_level ="info"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="info"; - phy_log_verbosity ="medium"; - mac_log_level ="info"; - mac_log_verbosity ="high"; - rlc_log_level ="info"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; - diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf new file mode 100644 index 0000000000..e0b721bf5e --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpn300.conf @@ -0,0 +1,286 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 92; mnc_length = 2;}); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP) + absoluteFrequencySSB = 2071241; + dl_frequencyBand = 257; + # this is 27.900 GHz + dl_absoluteFrequencyPointA = 2070833; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 3; + dl_carrierBandwidth = 32; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=32 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 8525; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 3; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 + + initialDLBWPk0_3 = 0; #for mixed slot + initialDLBWPmappingType_3 = 0; + initialDLBWPstartSymbolAndLength_3 = 57; #this is SS=1,L=5 + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 261; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 3; + ul_carrierBandwidth = 32; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 8525; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 3; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 52; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 7; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 7; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 3, + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 4; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 3; + ssb_PositionsInBurst_Bitmap = 0x0001000100010001L; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 3; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 3; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 3; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = 10; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.18.99"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + ///X2 + enable_x2 = "yes"; + t_reloc_prep = 1000; /* unit: millisecond */ + tx2_reloc_overall = 2000; /* unit: millisecond */ + t_dc_prep = 1000; /* unit: millisecond */ + t_dc_overall = 2000; /* unit: millisecond */ + target_enb_x2_ip_address = ( + { ipv4 = "192.168.18.199"; + ipv6 = "192:168:30::17"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.18.198/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.18.198/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + GNB_IPV4_ADDRESS_FOR_X2C = "192.168.18.198/24"; + GNB_PORT_FOR_X2C = 36422; # Spec 36422 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2"; + if_freq = 5124520000L; + clock_src = "external"; + time_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf index f2e468c71b..bf581f78ba 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf @@ -23,6 +23,9 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; servingCellConfigCommon = ( { @@ -33,10 +36,10 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP) - absoluteFrequencySSB = 2077907; + absoluteFrequencySSB = 2071241; dl_frequencyBand = 257; # this is 27.900 GHz - dl_absoluteFrequencyPointA = 2077499; + dl_absoluteFrequencyPointA = 2070833; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing @@ -55,27 +58,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=2,L=3 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) - initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 257; @@ -110,8 +100,8 @@ gNBs = #1,2,4,8,10,20,40,80 ra_ResponseWindow = 7; #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; #oneHalf (0..15) 4,8,12,16,...60,64 ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 7; #ra_ContentionResolutionTimer @@ -130,20 +120,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 14; + initialULBWPk2_2 = 4; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -157,7 +144,7 @@ gNBs = # ssb_PositionsInBurs_BitmapPR # 1=short, 2=medium, 3=long ssb_PositionsInBurst_PR = 3; - ssb_PositionsInBurst_Bitmap = 0x100000001L; + ssb_PositionsInBurst_Bitmap = 0x0001000100010001L; # ssb_periodicityServingCell # 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 @@ -185,7 +172,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -216,6 +203,7 @@ gNBs = GNB_INTERFACE_NAME_FOR_S1U = "eth0"; GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; } ); @@ -247,9 +235,9 @@ RUs = ( max_rxgain = 75; eNB_instances = [0]; sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2"; - if_freq = 5300000000L; - #time_source = "external"; - clock_source = "external"; + if_freq = 5124520000L; + clock_src = "external"; + time_src = "external"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf index 2737357851..e018aef006 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,22 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=2,L=3 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot (but is not used here) + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 257; @@ -125,15 +118,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + + initialULBWPk2_1 = 2; # used for mixed slot (not used here) initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA + initialULBWPmappingType_2 = 1; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; @@ -176,7 +171,7 @@ gNBs = nrofUplinkSlots = 10; nrofUplinkSymbols = 0; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf index f810dd546c..a2233b72bc 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; @@ -57,27 +58,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=2,L=3 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) - initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 261; @@ -112,8 +100,8 @@ gNBs = #1,2,4,8,10,20,40,80 ra_ResponseWindow = 7; #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; #oneHalf (0..15) 4,8,12,16,...60,64 ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 7; #ra_ContentionResolutionTimer @@ -132,20 +120,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 14; + initialULBWPk2_2 = 4; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -187,7 +172,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -249,6 +234,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; + pusch_proc_threads = 8; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf index 32de0aa4f5..2028f40552 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,27 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 66; @@ -131,20 +119,18 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -185,7 +171,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -238,7 +224,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1; nb_rx = 1; att_tx = 0; @@ -247,15 +233,14 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 75; eNB_instances = [0]; - ##beamforming 1x2 matrix: 1 layer x 2 antennas + ## beamforming 1x2 matrix: 1 layer x 2 antennas bf_weights = [0x00007fff, 0x0000]; - ##beamforming 1x4 matrix: 1 layer x 4 antennas + ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; # if_freq = 3700000000L; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf index 307cf52cb3..35c4924ba1 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,27 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 66; @@ -131,20 +119,18 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -185,7 +171,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -238,7 +224,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1; nb_rx = 1; att_tx = 0; @@ -247,15 +233,14 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - ##beamforming 1x2 matrix: 1 layer x 2 antennas + ## beamforming 1x2 matrix: 1 layer x 2 antennas bf_weights = [0x00007fff, 0x0000]; - ##beamforming 1x4 matrix: 1 layer x 4 antennas + ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "type=x300"; clock_src = "external"; # if_freq = 3700000000L; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf index 1cd16d0831..f90adae46b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 31; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -55,22 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=2,L=3 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -83,7 +76,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -125,16 +118,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA + initialULBWPmappingType_2 = 1; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -176,7 +170,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf index dfae41f0a6..aa61153c93 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.slave.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=0,L=50 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -55,27 +56,13 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 - initialDLBWPstartSymbolAndLength_3 = 57; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 #uplinkConfigCommon #frequencyInfoUL @@ -89,7 +76,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -131,21 +118,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + + initialULBWPk2_1 = 2; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; - + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf index dcdfa003a2..a0ee7f8a6d 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,22 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=2,L=3 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot (but not used here) + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -125,16 +118,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 63; # this is SS=7 L=5 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA + initialULBWPmappingType_2 = 1; + initialULBWPstartSymbolAndLength_2 = 91; # this is SS=7 L=7 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf index deed91c93c..d08234ab16 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.PTRS.usrpx300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,27 +56,13 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 - initialDLBWPstartSymbolAndLength_3 = 57; + initialDLBWPk0_3 = 0; #for mixed slot + initialDLBWPmappingType_3 = 0; + initialDLBWPstartSymbolAndLength_3 = 57; #this is SS=1,L=5 #uplinkConfigCommon #frequencyInfoUL @@ -133,8 +120,7 @@ gNBs = # pusch-ConfigCommon (up to 16 elements) initialULBWPk2_0 = 6; initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; initialULBWPk2_1 = 6; initialULBWPmappingType_1 = 1; @@ -185,7 +171,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -282,6 +268,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; + pusch_proc_threads = 8; } ); @@ -296,8 +283,14 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - #beamforming 1x4 matrix: - bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sdr_addrs = "type=x300"; clock_src = "external"; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.adrv9371zc706.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.adrv9371zc706.conf deleted file mode 100644 index 5610694d7d..0000000000 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.adrv9371zc706.conf +++ /dev/null @@ -1,288 +0,0 @@ -Active_gNBs = ( "gNB-Eurecom-5GNRBox"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -gNBs = -( - { - ////////// Identification parameters: - gNB_ID = 0xe00; - - cell_type = "CELL_MACRO_GNB"; - - gNB_name = "gNB-Eurecom-5GNRBox"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = 1; - - plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); - - tr_s_preference = "local_mac" - - ////////// Physical parameters: - - component_carriers = ( - { - node_function = "3GPP_gNODEB"; - node_timing = "synch_to_ext_device"; - node_synch_ref = 0; - frame_type = "TDD"; - DL_prefix_type = "NORMAL"; - UL_prefix_type = "NORMAL"; - eutra_band = 78; - downlink_frequency = 3510000000L; - uplink_frequency_offset = 0; - Nid_cell = 0; - N_RB_DL = 106; - nb_antenna_ports = 1; - nb_antennas_tx = 1; - nb_antennas_rx = 1; - tx_gain = 90; - rx_gain = 125; - MIB_subCarrierSpacingCommon = 30; - MIB_ssb_SubcarrierOffset = 0; - MIB_dmrs_TypeA_Position = 2; - pdcch_ConfigSIB1 = 0; - SIB1_frequencyOffsetSSB = "khz5"; - SIB1_ssb_PeriodicityServingCell = 5; - SIB1_ss_PBCH_BlockPower = -60; - absoluteFrequencySSB = 0; - DL_FreqBandIndicatorNR = 15; - DL_absoluteFrequencyPointA = 15; - DL_offsetToCarrier = 15; - DL_SCS_SubcarrierSpacing = "kHz30"; - DL_SCS_SpecificCarrier_k0 = 0; - DL_carrierBandwidth = 15; - DL_locationAndBandwidth = 15; - DL_BWP_SubcarrierSpacing = "kHz30"; - DL_BWP_prefix_type = "NORMAL"; - UL_FreqBandIndicatorNR = 15; - UL_absoluteFrequencyPointA = 13; - UL_additionalSpectrumEmission = 3; - UL_p_Max = -1; - UL_frequencyShift7p5khz = "TRUE"; - UL_offsetToCarrier = 10; - UL_SCS_SubcarrierSpacing = "kHz30"; - UL_SCS_SpecificCarrier_k0 = 0; - UL_carrierBandwidth = 15; - UL_locationAndBandwidth = 15; - UL_BWP_SubcarrierSpacing = "kHz30"; - UL_BWP_prefix_type = "NORMAL"; - UL_timeAlignmentTimerCommon = "infinity"; - ServingCellConfigCommon_n_TimingAdvanceOffset = "n0" - ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0x01; - ServingCellConfigCommon_ssb_periodicityServingCell = 10; - ServingCellConfigCommon_dmrs_TypeA_Position = 2; - NIA_SubcarrierSpacing = "kHz15"; - ServingCellConfigCommon_ss_PBCH_BlockPower = -60; - referenceSubcarrierSpacing = "kHz15"; - dl_UL_TransmissionPeriodicity = "ms0p5"; - nrofDownlinkSlots = 10; - nrofDownlinkSymbols = 10; - nrofUplinkSlots = 10; - nrofUplinkSymbols = 10; - rach_totalNumberOfRA_Preambles = 63; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice = "oneEighth"; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth = 4; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth = 8; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf = 16; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one = 24; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two = 32; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four = 8; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight = 4; - rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen = 2; - rach_groupBconfigured = "ENABLE"; - rach_ra_Msg3SizeGroupA = 56; - rach_messagePowerOffsetGroupB = "dB0"; - rach_numberOfRA_PreamblesGroupA = 32; - rach_ra_ContentionResolutionTimer = 8; - rsrp_ThresholdSSB = 64; - rsrp_ThresholdSSB_SUL = 64; - prach_RootSequenceIndex_choice = "l839"; - prach_RootSequenceIndex_l839 = 0; - prach_RootSequenceIndex_l139 = 0; - prach_msg1_SubcarrierSpacing = "kHz30"; - restrictedSetConfig = "unrestrictedSet"; - msg3_transformPrecoding = "ENABLE"; - prach_ConfigurationIndex = 10; - prach_msg1_FDM = "one"; - prach_msg1_FrequencyStart = 10; - zeroCorrelationZoneConfig = 10; - preambleReceivedTargetPower = -150; - preambleTransMax = 6; - powerRampingStep = "dB0"; - ra_ResponseWindow = 8; - groupHoppingEnabledTransformPrecoding = "ENABLE"; - msg3_DeltaPreamble = 0; - p0_NominalWithGrant = 0; - PUSCH_TimeDomainResourceAllocation_k2 = 0; - PUSCH_TimeDomainResourceAllocation_mappingType = "typeA"; - PUSCH_TimeDomainResourceAllocation_startSymbolAndLength = 0; - pucch_ResourceCommon = 0; - pucch_GroupHopping = "neither"; - hoppingId = 0; - p0_nominal = -30; - PDSCH_TimeDomainResourceAllocation_k0 = 2; - PDSCH_TimeDomainResourceAllocation_mappingType = "typeA"; - PDSCH_TimeDomainResourceAllocation_startSymbolAndLength = 0; - rateMatchPatternId = 0; - RateMatchPattern_patternType = "bitmaps"; - symbolsInResourceBlock = "oneSlot"; - periodicityAndPattern = 2; - RateMatchPattern_controlResourceSet = 5; - RateMatchPattern_subcarrierSpacing = "kHz30"; - RateMatchPattern_mode = "dynamic"; - controlResourceSetZero = 0; - searchSpaceZero = 0; - searchSpaceSIB1 = 10; - searchSpaceOtherSystemInformation = 10; - pagingSearchSpace = 10; - ra_SearchSpace = 10; - PDCCH_common_controlResourceSetId = 5; - PDCCH_common_ControlResourceSet_duration = 2; - PDCCH_cce_REG_MappingType = "nonInterleaved"; - PDCCH_reg_BundleSize = 3; - PDCCH_interleaverSize = 3; - PDCCH_shiftIndex = 10; - PDCCH_precoderGranularity = "sameAsREG-bundle"; - PDCCH_TCI_StateId = 32; - tci_PresentInDCI = "ENABLE"; - PDCCH_DMRS_ScramblingID = 0; - SearchSpaceId = 10; - commonSearchSpaces_controlResourceSetId = 5; - SearchSpace_monitoringSlotPeriodicityAndOffset_choice = "sl1"; - SearchSpace_monitoringSlotPeriodicityAndOffset_value = 0; - SearchSpace_duration = 2; - SearchSpace_nrofCandidates_aggregationLevel1 = 0; - SearchSpace_nrofCandidates_aggregationLevel2 = 0; - SearchSpace_nrofCandidates_aggregationLevel4 = 0; - SearchSpace_nrofCandidates_aggregationLevel8 = 0; - SearchSpace_nrofCandidates_aggregationLevel16 = 0; - SearchSpace_searchSpaceType = "common"; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1 = 1; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2 = 1; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4 = 1; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8 = 1; - Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16 = 1; - Common_dci_Format2_3_monitoringPeriodicity = 1; - Common_dci_Format2_3_nrofPDCCH_Candidates = 1; - ue_Specific__dci_Formats = "formats0-0-And-1-0"; - RateMatchPatternLTE_CRS_carrierFreqDL = 6; - RateMatchPatternLTE_CRS_carrierBandwidthDL = 6; - RateMatchPatternLTE_CRS_nrofCRS_Ports = 1; - RateMatchPatternLTE_CRS_v_Shift = 0; - RateMatchPatternLTE_CRS_radioframeAllocationPeriod = 1; - RateMatchPatternLTE_CRS_radioframeAllocationOffset = 0; - RateMatchPatternLTE_CRS_subframeAllocation_choice = "oneFrame"; - } - ); - - - srb1_parameters : - { - # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] - timer_poll_retransmit = 80; - - # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] - timer_reordering = 35; - - # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] - timer_status_prohibit = 0; - - # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] - poll_pdu = 4; - - # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] - poll_byte = 99999; - - # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] - max_retx_threshold = 4; - } - - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; - ipv6 = "192:168:30::17"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - - GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; - GNB_INTERFACE_NAME_FOR_S1U = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; - GNB_PORT_FOR_S1U = 2152; # Spec 2152 - }; - } -); - -MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - } -); - -L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - } -); - -RUs = ( - { - local_rf = "yes" - nb_tx = 1 - nb_rx = 1 - att_tx = 0 - att_rx = 0; - bands = [7]; - max_pdschReferenceSignalPower = -27; - max_rxgain = 114; - eNB_instances = [0]; - sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2,mgmt_addr=192.168.100.8"; - - } -); - -NETWORK_CONTROLLER : -{ - FLEXRAN_ENABLED = "no"; - FLEXRAN_INTERFACE_NAME = "lo"; - FLEXRAN_IPV4_ADDRESS = "127.0.0.1"; - FLEXRAN_PORT = 2210; - FLEXRAN_CACHE = "/mnt/oai_agent_cache"; - FLEXRAN_AWAIT_RECONF = "no"; -}; - - log_config : - { - global_log_level ="info"; - global_log_verbosity ="medium"; - hw_log_level ="info"; - hw_log_verbosity ="medium"; - phy_log_level ="info"; - phy_log_verbosity ="medium"; - mac_log_level ="info"; - mac_log_verbosity ="high"; - rlc_log_level ="info"; - rlc_log_verbosity ="medium"; - pdcp_log_level ="info"; - pdcp_log_verbosity ="medium"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; - }; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf index 862f0e6303..f22d5f781f 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpb210.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,22 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=2,L=3 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -125,16 +118,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA + initialULBWPmappingType_2 = 1; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -176,7 +170,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -228,7 +222,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1 nb_rx = 1 att_tx = 0 @@ -237,7 +231,15 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 114; eNB_instances = [0]; - sdr_addrs = "type=b200"; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + #bf_weights = [0x00007fff, 0x00007fff]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=b200"; #clock_src = "external"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf index c77497dedd..b57cb00779 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -32,7 +33,7 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP), points to Subcarrier 0 of RB#10 of SSB block absoluteFrequencySSB = 641032; dl_frequencyBand = 78; # this is 3600 MHz @@ -45,37 +46,23 @@ gNBs = dl_carrierBandwidth = 106; #initialDownlinkBWP #genericParameters - # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + # this is RBstart=33 (Start RB of SSB block),L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6358; #6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPcontrolResourceSetZero = 0; #12; initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; # used for (full) DL slot + initialDLBWPmappingType_0 = 0; # 0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; # this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; + initialDLBWPk0_1 = 0; # used for DL part mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; # this is SS=1,L=5 #uplinkConfigCommon #frequencyInfoUL @@ -89,7 +76,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6358;#6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -131,20 +118,17 @@ gNBs = restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for (full) UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for UL part mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -158,7 +142,7 @@ gNBs = # ssb_PositionsInBurs_BitmapPR # 1=short, 2=medium, 3=long ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; + ssb_PositionsInBurst_Bitmap = 0x1; # ssb_periodicityServingCell # 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 @@ -186,7 +170,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -239,7 +223,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes" nb_tx = 1 nb_rx = 1 att_tx = 0 @@ -248,15 +232,14 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 50; eNB_instances = [0]; - ##beamforming 1x2 matrix: 1 layer x 2 antennas - bf_weights = [0x00007fff, 0x0000]; - ##beamforming 1x4 matrix: 1 layer x 4 antennas + ## beamforming 1x2 matrix: 1 layer x 2 antennas + #bf_weights = [0x00007fff, 0x00007fff]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; ## beamforming 2x2 matrix: - # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf index b3fdd79475..862185835e 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpx300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -32,7 +33,7 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP). points to Subcarrier 0 of RB#10 of SSB block absoluteFrequencySSB = 641032; dl_frequencyBand = 78; # this is 3600 MHz @@ -45,37 +46,24 @@ gNBs = dl_carrierBandwidth = 106; #initialDownlinkBWP #genericParameters - # this is RBstart=0,L=50 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + # this is RBstart=33 (Start RB of SSB block),L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6358; #6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPcontrolResourceSetZero = 0; initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL @@ -89,7 +77,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 6358; #6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -131,20 +119,17 @@ gNBs = restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -186,7 +171,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; // -25 dBm/RE is the maximum measured power from USRP corresponding to att_tx = 0 dB } ); @@ -256,7 +241,6 @@ RUs = ( # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - sdr_addrs = "type=x300"; clock_src = "external"; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf index 40361aaf4e..335c3d9f0b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -32,7 +33,7 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL - # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP) + # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP). Points to Subcarrier 0 of RB#10 of SSB block absoluteFrequencySSB = 642016;#642364; dl_frequencyBand = 78; # this is 3600 MHz @@ -45,37 +46,24 @@ gNBs = dl_carrierBandwidth = 217; #initialDownlinkBWP #genericParameters - # this is RBstart=84,L=50 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 13559; + # this is RBstart=74 (Start RB of SSB block),L=50 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 13549; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPcontrolResourceSetZero = 0; initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -88,7 +76,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 13559; + initialULBWPlocationAndBandwidth = 13549; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -130,21 +118,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; #2; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 6; #2; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; - + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -186,7 +170,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -249,6 +233,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; + pusch_proc_threads = 8; } ); @@ -291,7 +276,7 @@ log_config : global_log_verbosity ="medium"; hw_log_level ="info"; hw_log_verbosity ="medium"; - phy_log_level ="debug"; + phy_log_level ="info"; phy_log_verbosity ="medium"; mac_log_level ="info"; mac_log_verbosity ="high"; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf index c907dcfe8d..bf75edc360 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.217PRB.usrpx300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -45,37 +46,24 @@ gNBs = dl_carrierBandwidth = 217; #initialDownlinkBWP #genericParameters - # this is RBstart=84,L=50 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 13559; + # this is RBstart=74,L=50 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 13549; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPcontrolResourceSetZero = 0; initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -88,7 +76,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 13559; + initialULBWPlocationAndBandwidth = 13549; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -130,16 +118,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA + initialULBWPmappingType_2 = 1; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -181,7 +170,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -228,6 +217,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; + pusch_proc_threads = 8; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf index 9f69849ace..b4f40d2205 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpb210.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,27 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_3 = 0; #for mixed slot + initialDLBWPmappingType_3 = 0; + initialDLBWPstartSymbolAndLength_3 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL @@ -133,17 +121,14 @@ gNBs = # pusch-ConfigCommon (up to 16 elements) initialULBWPk2_0 = 6; initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 initialULBWPk2_1 = 6; initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 initialULBWPstartSymbolAndLength_1 = 69; initialULBWPk2_2 = 7; initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 initialULBWPstartSymbolAndLength_2 = 52; msg3_DeltaPreamble = 1; @@ -186,7 +171,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -257,8 +242,8 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sdr_addrs = "type=b200"; - #"addr=192.168.18.207"; - #"addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + #"addr=192.168.18.207"; + #"addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; clock_src = "external"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf index 56f07668d7..639b11828b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,27 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_3 = 0; #for mixed slot + initialDLBWPmappingType_3 = 0; + initialDLBWPstartSymbolAndLength_3 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL @@ -133,17 +121,14 @@ gNBs = # pusch-ConfigCommon (up to 16 elements) initialULBWPk2_0 = 6; initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 initialULBWPk2_1 = 6; initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 initialULBWPstartSymbolAndLength_1 = 69; initialULBWPk2_2 = 7; initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 initialULBWPstartSymbolAndLength_2 = 52; msg3_DeltaPreamble = 1; @@ -186,7 +171,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf index 687a188456..b93b530bed 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.24PRB.usrpx300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -55,27 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_3 = 0; #for mixed slot + initialDLBWPmappingType_3 = 0; + initialDLBWPstartSymbolAndLength_3 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL @@ -133,17 +121,14 @@ gNBs = # pusch-ConfigCommon (up to 16 elements) initialULBWPk2_0 = 6; initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 initialULBWPk2_1 = 6; initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 initialULBWPstartSymbolAndLength_1 = 69; initialULBWPk2_2 = 7; initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 initialULBWPstartSymbolAndLength_2 = 52; msg3_DeltaPreamble = 1; @@ -186,7 +171,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf index a899845cb8..50276c3289 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.273PRB.usrpn300.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -45,37 +46,24 @@ gNBs = dl_carrierBandwidth = 273; #initialDownlinkBWP #genericParameters - # this is RBstart=84,L=50 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 13559; + # this is RBstart=74,L=50 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 13549; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPcontrolResourceSetZero = 0; initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -88,7 +76,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 13559; + initialULBWPlocationAndBandwidth = 13549; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -130,21 +118,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6;#2; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 6;#2; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=10 L=2 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; - + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -186,7 +170,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -233,6 +217,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; + pusch_proc_threads = 8; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf index 5f65a2c801..e541607559 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf index c46ea98ec2..bdb8b8518a 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; @@ -48,7 +49,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -57,27 +58,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) - initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -90,7 +78,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -132,20 +120,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_2 = 7; + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 24; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -249,7 +234,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - pusch_proc_threads = 8; + pusch_proc_threads = 8; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf index 12e4525454..febf152387 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_24PRB.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pusch_TargetSNRx10 = 200; pucch_TargetSNRx10 = 200; @@ -134,8 +135,8 @@ gNBs = # pusch-ConfigCommon (up to 16 elements) initialULBWPk2_0 = 2; initialULBWPmappingType_0 = 1 - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_0 = 55; + # this is SS=0 L=13 + initialULBWPstartSymbolAndLength_0 = 41; initialULBWPk2_1 = 2; initialULBWPmappingType_1 = 1; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf index 6a3f008ec1..767459aecb 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/testing_gnb_n310.conf @@ -23,6 +23,7 @@ gNBs = ssb_SubcarrierOffset = 31; //0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; servingCellConfigCommon = ( { @@ -46,7 +47,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=84,L=13 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialDLBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -55,27 +56,14 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=4 //5 (4 is for 43, 5 is for 57) - initialDLBWPstartSymbolAndLength_3 = 57; //43; //57; #uplinkConfigCommon #frequencyInfoUL ul_frequencyBand = 78; @@ -88,7 +76,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; //28875; //6366; #6407; #3384; + initialULBWPlocationAndBandwidth = 6368; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -130,20 +118,17 @@ gNBs = # 0=unrestricted, 1=restricted type A, 2=restricted type B restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 2; + initialULBWPk2_0 = 2; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 2; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_2 = 7; + initialULBWPk2_1 = 2; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 24; # this is SS=10 L=2 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 108cf06033..0f66d2fb92 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -13,7 +13,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({mcc = 222; mnc = 93; mnc_length = 2;}); + plmn_list = ({mcc = 208; mnc = 92; mnc_length = 2;}); tr_s_preference = "local_mac" @@ -21,6 +21,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pdcch_ConfigSIB1 = ( { @@ -51,7 +52,7 @@ gNBs = #initialDownlinkBWP #genericParameters # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; # 6366 12925 12956 28875 + initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -60,32 +61,13 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_0 = 53; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=10 - initialDLBWPstartSymbolAndLength_1 = 81; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 95; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=2,L=7 - initialDLBWPstartSymbolAndLength_3 = 86; - - initialDLBWPk0_4 = 0; - initialDLBWPmappingType_4 = 0; - #this is SS=2,L=5 - initialDLBWPstartSymbolAndLength_4 = 58; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 #uplinkConfigCommon #frequencyInfoUL @@ -99,7 +81,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 12952; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -111,7 +93,7 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -100; + preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep @@ -141,20 +123,17 @@ gNBs = restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=0 L=12 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -196,7 +175,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -255,10 +234,11 @@ MACRLCs = ( ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index d28427dbf3..52805981b8 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -13,7 +13,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({mcc = 222; mnc = 93; mnc_length = 2;}); + plmn_list = ({mcc = 208; mnc = 92; mnc_length = 2;}); tr_s_preference = "local_mac" @@ -21,6 +21,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; pdcch_ConfigSIB1 = ( { @@ -50,8 +51,8 @@ gNBs = dl_carrierBandwidth = 106; #initialDownlinkBWP #genericParameters - # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; # 6366 12925 12956 28875 + # this is RBstart=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 12952 # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -60,27 +61,13 @@ gNBs = initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_0 = 53; + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=10 - initialDLBWPstartSymbolAndLength_1 = 81; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 #uplinkConfigCommon #frequencyInfoUL @@ -94,7 +81,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 12952; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -106,7 +93,7 @@ gNBs = prach_msg1_FDM = 0; prach_msg1_FrequencyStart = 0; zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -100; + preambleReceivedTargetPower = -96; #preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) preambleTransMax = 6; #powerRampingStep @@ -136,20 +123,17 @@ gNBs = restrictedSetConfig = 0, # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; + initialULBWPk2_0 = 6; # used for UL slot initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 - initialULBWPk2_1 = 6; + initialULBWPk2_1 = 6; # used for mixed slot initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 69; # this is SS=0 L=12 - initialULBWPk2_2 = 7; + initialULBWPk2_2 = 7; # used for Msg.3 during RA initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -191,7 +175,7 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; + ssPBCH_BlockPower = -25; } ); @@ -250,10 +234,11 @@ MACRLCs = ( ); L1s = ( - { + { num_cc = 1; tr_n_preference = "local_mac"; - } + pusch_proc_threads = 8; + } ); RUs = ( diff --git a/targets/RT/USER/eNB_usrp.gtkw b/targets/RT/USER/eNB_usrp.gtkw index 074e3b1324..8f3aeaac62 100644 --- a/targets/RT/USER/eNB_usrp.gtkw +++ b/targets/RT/USER/eNB_usrp.gtkw @@ -1,13 +1,13 @@ [*] [*] GTKWave Analyzer v3.3.66 (w)1999-2015 BSI -[*] Sun May 19 21:39:57 2019 +[*] Tue Jan 26 21:45:57 2021 [*] -[dumpfile] "/tmp/openair_dump_eNB.vcd" -[dumpfile_mtime] "Sun May 19 21:30:25 2019" -[dumpfile_size] 11590554 -[savefile] "/home/sphex/raymond/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw" -[timestart] 7629910000 -[size] 1840 795 +[dumpfile] "/home/eurecom/raymond/gtkw/openair_dump_eNB.vcd" +[dumpfile_mtime] "Tue Jan 26 21:26:33 2021" +[dumpfile_size] 180869253 +[savefile] "/home/eurecom/raymond/openairinterface5g_2/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw" +[timestart] 11468800000 +[size] 1693 785 [pos] -1 -1 *-21.832302 7639830000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 [sst_width] 386 @@ -16,17 +16,22 @@ [sst_vpaned_height] 303 @28 functions.trx_read +@29 +functions.trx_write_thread +@28 functions.trx_write @24 variables.trx_ts[63:0] variables.trx_tst[63:0] +variables.trx_write_flags[63:0] @28 functions.eNB_thread_rxtx0 +@420 +variables.l1_proc_tx_ic[63:0] +variables.l1_proc_ic[63:0] @24 variables.frame_number_RX0_RU[63:0] -@25 variables.tti_number_RX0_RU[63:0] -@24 variables.frame_number_TX0_RU[63:0] variables.tti_number_TX0_RU[63:0] @28 diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 5316705809..31c142c8da 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -70,6 +70,7 @@ #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/LTE_TRANSPORT/if5_tools.h" +#include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "PHY/phy_extern.h" @@ -96,6 +97,9 @@ #include "T.h" +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; + //#define DEBUG_THREADS 1 //#define USRP_DEBUG 1 @@ -261,7 +265,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB, eNB->UL_INFO.subframe = proc->subframe_rx; eNB->UL_INFO.module_id = eNB->Mod_id; eNB->UL_INFO.CC_id = eNB->CC_id; - eNB->if_inst->UL_indication(&eNB->UL_INFO, proc); + eNB->if_inst->UL_indication(&eNB->UL_INFO, (void*)proc); AssertFatal((ret= pthread_mutex_unlock(&eNB->UL_INFO_mutex))==0,"error unlocking UL_INFO_mutex, return %d\n",ret); /* this conflict resolution may be totally wrong, to be tested */ /* CONFLICT RESOLUTION: BEGIN */ @@ -323,7 +327,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB, static void *L1_thread_tx(void *param) { L1_proc_t *eNB_proc = (L1_proc_t *)param; L1_rxtx_proc_t *proc = &eNB_proc->L1_proc_tx; - PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id]; + PHY_VARS_eNB *eNB = eNB_proc->eNB; char thread_name[100]; sprintf(thread_name,"TXnp4_%d\n",&eNB->proc.L1_proc == proc ? 0 : 1); thread_top_init(thread_name,1,470000,500000,500000); @@ -331,6 +335,7 @@ static void *L1_thread_tx(void *param) { //wait_sync("tx_thread"); + proc->respEncode = eNB->proc.L1_proc.respEncode; while (!oai_exit) { LOG_D(PHY,"Waiting for TX (IC %d)\n",proc->instance_cnt); @@ -351,21 +356,19 @@ static void *L1_thread_tx(void *param) { LOG_D(PHY,"L1 TX processing %d.%d\n",proc->frame_tx,proc->subframe_tx); phy_procedures_eNB_TX(eNB, proc, 1); AssertFatal((ret= pthread_mutex_lock( &proc->mutex ))==0,"error locking L1_proc_tx mutex, return %d\n",ret); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,proc->instance_cnt); int subframe_tx = proc->subframe_tx; int frame_tx = proc->frame_tx; uint64_t timestamp_tx = proc->timestamp_tx; proc->instance_cnt = -1; + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,proc->instance_cnt); LOG_D(PHY,"L1 TX signaling done for %d.%d\n",proc->frame_tx,proc->subframe_tx); // the thread can now be woken up LOG_D(PHY,"L1_thread_tx: signaling completion in %d.%d\n",proc->frame_tx,proc->subframe_tx); - if (pthread_cond_signal(&proc->cond) != 0) { - LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); - exit_fun( "ERROR pthread_cond_signal" ); - } - + AssertFatal((ret=pthread_cond_signal(&proc->cond))== 0, "ERROR pthread_cond_signal for eNB TXnp4 thread ret %d\n",ret); AssertFatal((ret= pthread_mutex_unlock( &proc->mutex ))==0,"error unlocking L1_proc_tx mutex, return %d\n",ret); + + wakeup_txfh(eNB,proc,frame_tx,subframe_tx,timestamp_tx); } @@ -391,6 +394,8 @@ static void *L1_thread( void *param ) { } PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id]; + + char thread_name[100]; cpu_set_t cpuset; CPU_ZERO(&cpuset); @@ -402,7 +407,7 @@ static void *L1_thread( void *param ) { LOG_I(PHY,"thread rxtx created id=%ld\n", syscall(__NR_gettid)); while (!oai_exit) { - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0, 0 ); T(T_ENB_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx), T_INT(proc->subframe_rx)); LOG_D(PHY,"L1RX waiting for RU RX\n"); @@ -410,7 +415,7 @@ static void *L1_thread( void *param ) { LOG_D(PHY,"L1RX starting in %d.%d\n",proc->frame_rx,proc->subframe_rx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,sched_getcpu()); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 ); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0, 1 ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB,proc->subframe_tx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_ENB,proc->subframe_rx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB,proc->frame_tx); @@ -424,6 +429,8 @@ static void *L1_thread( void *param ) { LOG_D(PHY,"L1 RX %d.%d done\n",proc->frame_rx,proc->subframe_rx); + if (release_thread(&proc->mutex,&proc->instance_cnt,thread_name)<0) break; + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_IC, proc->instance_cnt); if (NFAPI_MODE!=NFAPI_MODE_VNF) { if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(eNB,proc->frame_rx,proc->subframe_rx,proc->frame_tx,proc->subframe_tx,proc->timestamp_tx); else if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) { @@ -432,9 +439,7 @@ static void *L1_thread( void *param ) { } } - if (release_thread(&proc->mutex,&proc->instance_cnt,thread_name)<0) break; } // while !oai_exit - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); LOG_D(PHY, " *** Exiting eNB thread RXn_TXnp4\n"); eNB_thread_rxtx_status = 0; @@ -530,6 +535,7 @@ int wakeup_txfh(PHY_VARS_eNB *eNB, AssertFatal(pthread_cond_signal(&ru_proc->cond_eNBs) == 0, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n"); AssertFatal((ret=pthread_mutex_unlock(&ru_proc->mutex_eNBs))==0,"mutex_unlock returned %d\n",ret); + } return(0); @@ -542,19 +548,19 @@ int wakeup_tx(PHY_VARS_eNB *eNB, int frame_tx, int subframe_tx, uint64_t timestamp_tx) { - L1_rxtx_proc_t *L1_proc = &eNB->proc.L1_proc; L1_rxtx_proc_t *L1_proc_tx = &eNB->proc.L1_proc_tx; int ret; LOG_D(PHY,"ENTERED wakeup_tx (IC %d)\n",L1_proc_tx->instance_cnt); + // check if subframe is a has TX else return + if (subframe_select(&eNB->frame_parms,subframe_tx) == SF_UL) return 0; AssertFatal((ret = pthread_mutex_lock(&L1_proc_tx->mutex))==0,"mutex_lock returns %d\n",ret); - LOG_D(PHY,"L1 RX %d.%d Waiting to wake up L1 TX %d.%d (IC L1TX %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,L1_proc->frame_tx,L1_proc->subframe_tx,L1_proc_tx->instance_cnt); + LOG_D(PHY,"L1 RX %d.%d Waiting to wake up L1 TX %d.%d (IC L1TX %d)\n",frame_rx,subframe_rx,frame_tx,subframe_tx,L1_proc_tx->instance_cnt); while(L1_proc_tx->instance_cnt == 0) { pthread_cond_wait(&L1_proc_tx->cond,&L1_proc_tx->mutex); } LOG_D(PHY,"L1 RX Got signal that TX %d.%d is done\n",L1_proc_tx->frame_tx,L1_proc_tx->subframe_tx); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,L1_proc_tx->instance_cnt); L1_proc_tx->instance_cnt = 0; VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_TX_IC,L1_proc_tx->instance_cnt); L1_proc_tx->subframe_rx = subframe_rx; @@ -563,9 +569,11 @@ int wakeup_tx(PHY_VARS_eNB *eNB, L1_proc_tx->frame_tx = frame_tx; L1_proc_tx->timestamp_tx = timestamp_tx; // the thread can now be woken up - LOG_D(PHY,"L1 RX Waking up L1 TX %d.%d\n",L1_proc->frame_tx,L1_proc->subframe_tx); + LOG_D(PHY,"L1 RX Waking up L1 TX %d.%d\n",frame_tx,subframe_tx); + AssertFatal(pthread_cond_signal(&L1_proc_tx->cond) == 0, "ERROR pthread_cond_signal for eNB L1 thread tx\n"); AssertFatal((ret=pthread_mutex_unlock(&L1_proc_tx->mutex))==0,"mutex_unlock returns %d\n",ret); + return(0); } @@ -585,10 +593,16 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB, if (L1_proc->instance_cnt == 0) { // L1_thread is busy so abort the subframe AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"mutex_unlock return %d\n",ret); LOG_W(PHY,"L1_thread isn't ready in %d.%d, aborting RX processing\n",ru_proc->frame_rx,ru_proc->tti_rx); +/* AssertFatal(1==0,"L1_thread isn't ready in %d.%d (L1RX %d.%d), aborting RX, exiting\n", + ru_proc->frame_rx,ru_proc->tti_rx,L1_proc->frame_rx,L1_proc->subframe_rx); +*/ return(0); + } ++L1_proc->instance_cnt; + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_L1_PROC_IC, L1_proc->instance_cnt); + // We have just received and processed the common part of a subframe, say n. // TS_rx is the last received timestamp (start of 1st slot), TS_tx is the desired // transmitted timestamp of the next TX slot (first). @@ -606,14 +620,12 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB, VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_WAKEUP_RXTX_TX_RU+ru->idx, L1_proc->frame_tx); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_WAKEUP_RXTX_TX_RU+ru->idx, L1_proc->subframe_tx); - // the thread can now be woken up - if (pthread_cond_signal(&L1_proc->cond) != 0) { - LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n"); - exit_fun( "ERROR pthread_cond_signal" ); - return(-1); - } + // the thread can now be woken up + AssertFatal((ret=pthread_cond_signal(&L1_proc->cond))== 0, "ERROR pthread_cond_signal for eNB RXn-TXnp4 thread, ret %d\n",ret); AssertFatal((ret=pthread_mutex_unlock( &L1_proc->mutex))==0,"mutex_unlock return %d\n",ret); + + return(0); } @@ -837,6 +849,21 @@ static void *process_stats_thread(void *param) { return(NULL); } +void *L1_stats_thread(void *param) { + PHY_VARS_eNB *eNB = (PHY_VARS_eNB *)param; + wait_sync("L1_stats_thread"); + FILE *fd; + while (!oai_exit) { + sleep(1); + fd=fopen("L1_stats.log","w"); + AssertFatal(fd!=NULL,"Cannot open L1_stats.log\n"); + dump_I0_stats(fd,eNB); + dump_ulsch_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx); + dump_uci_stats(fd,eNB,eNB->proc.L1_proc_tx.frame_tx); + fclose(fd); + } + return(NULL); +} void init_eNB_proc(int inst) { /*int i=0;*/ @@ -858,6 +885,7 @@ void init_eNB_proc(int inst) { L1_proc_tx->instance_cnt = -1; L1_proc->instance_cnt_RUs = 0; L1_proc_tx->instance_cnt_RUs = 0; + proc->eNB = eNB; proc->instance_cnt_prach = -1; proc->instance_cnt_asynch_rxtx = -1; proc->instance_cnt_synch = -1; @@ -930,6 +958,7 @@ void init_eNB_proc(int inst) { AssertFatal(proc->instance_cnt_prach == -1,"instance_cnt_prach = %d\n",proc->instance_cnt_prach); if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void *)eNB); + pthread_create(&proc->L1_stats_thread,NULL,L1_stats_thread,(void*)eNB); } //for multiple CCs: setup master and slaves @@ -1060,60 +1089,47 @@ void print_opp_meas(void) { void free_transport(PHY_VARS_eNB *eNB) { - for (int i=0; idlsch[i][j]); - - LOG_D(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i); - free_eNB_ulsch(eNB->ulsch[1+i]); } - - free_eNB_ulsch(eNB->ulsch[0]); + for (int i=0;iulsch[i]); + } } void init_transport(PHY_VARS_eNB *eNB) { - int i; - int j; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; LOG_I(PHY, "Initialise transport\n"); if (NFAPI_MODE!=NFAPI_MODE_VNF) { - for (i=0; idlsch[i][j] = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL,0,fp); - + LOG_I(PHY,"eNB->dlsch[%d][%d] %p\n",i,j,eNB->dlsch[i][j]); if (!eNB->dlsch[i][j]) { - LOG_E(PHY,"Can't get eNB dlsch structures for UE %d \n", i); + LOG_E(PHY,"Can't get eNB dlsch structures for DLSCH %d \n", i); exit(-1); } else { eNB->dlsch[i][j]->rnti=0; LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti); } } + } + for (int i=0;iulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0); + LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,NUMBER_OF_ULSCH_MAX); + eNB->ulsch[i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0); - if (!eNB->ulsch[1+i]) { + if (!eNB->ulsch[i]) { LOG_E(PHY,"Can't get eNB ulsch structures\n"); exit(-1); } - - // this is the transmission mode for the signalling channels - // this will be overwritten with the real transmission mode by the RRC once the UE is connected - eNB->transmission_mode[i] = fp->nb_antenna_ports_eNB==1 ? 1 : 2; - } - - // ULSCH for RA - eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS, fp->N_RB_UL, 0); - - if (!eNB->ulsch[0]) { - LOG_E(PHY,"Can't get eNB ulsch structures\n"); - exit(-1); } eNB->dlsch_SI = new_eNB_dlsch(1,8,NSOFT,fp->N_RB_DL, 0, fp); @@ -1126,7 +1142,7 @@ void init_transport(PHY_VARS_eNB *eNB) { eNB->rx_total_gain_dB=130; - for(i=0; imu_mimo_mode[i].dl_pow_off = 2; eNB->check_for_total_transmissions = 0; @@ -1134,11 +1150,13 @@ void init_transport(PHY_VARS_eNB *eNB) { eNB->FULL_MUMIMO_transmissions = 0; eNB->check_for_SUMIMO_transmissions = 0; fp->pucch_config_common.deltaPUCCH_Shift = 1; + if (eNB->use_DTX == 0) fill_subframe_mask(eNB); + } void init_eNB_afterRU(void) { - int inst,CC_id,ru_id,i,aa; + int inst,CC_id,i; PHY_VARS_eNB *eNB; LOG_I(PHY,"%s() RC.nb_inst:%d\n", __FUNCTION__, RC.nb_inst); @@ -1148,13 +1166,14 @@ void init_eNB_afterRU(void) { for (CC_id=0; CC_idnum_RU>0,"Number of RU attached to eNB %d is zero\n",eNB->Mod_id); - + // map antennas and PRACH signals to eNB RX LOG_I(PHY,"Mapping RX ports from %d RUs to eNB %d\n",eNB->num_RU,eNB->Mod_id); eNB->frame_parms.nb_antennas_rx = 0; + LOG_I(PHY,"eNB->num_RU:%d\n", eNB->num_RU); + if (NFAPI_MODE==NFAPI_MODE_PNF) AssertFatal(eNB->num_RU>0,"Number of RU attached to eNB %d is zero\n",eNB->Mod_id); + for (int ru_id=0; ru_idnum_RU; ru_id++) + eNB->frame_parms.nb_antennas_rx += eNB->RU_list[ru_id]->nb_rx; + phy_init_lte_eNB(eNB,0,0); LOG_I(PHY,"Overwriting eNB->prach_vars.rxsigF[0]:%p\n", eNB->prach_vars.rxsigF[0]); eNB->prach_vars.rxsigF[0] = (int16_t **)malloc16(64*sizeof(int16_t *)); @@ -1163,10 +1182,8 @@ void init_eNB_afterRU(void) { eNB->prach_vars_br.rxsigF[ce_level] = (int16_t **)malloc16(64*sizeof(int16_t *)); } - LOG_I(PHY,"eNB->num_RU:%d\n", eNB->num_RU); - for (ru_id=0,aa=0; ru_idnum_RU; ru_id++) { - eNB->frame_parms.nb_antennas_rx += eNB->RU_list[ru_id]->nb_rx; + for (int ru_id=0,aa=0; ru_idnum_RU; ru_id++) { AssertFatal(eNB->RU_list[ru_id]->common.rxdataF!=NULL, "RU %d : common.rxdataF is NULL\n", @@ -1214,7 +1231,7 @@ void init_eNB_afterRU(void) { init_eNB_proc(inst); } - for (ru_id=0; ru_idwakeup_rxtx = wakeup_rxtx; RC.ru[ru_id]->wakeup_prach_eNB = wakeup_prach_eNB; diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 368fd78f9e..86d3a88781 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -51,7 +51,6 @@ #include "assertions.h" #include "msc.h" #include "PHY/defs_common.h" -#include "PHY/phy_extern.h" #include "PHY/types.h" #include "PHY/INIT/phy_init.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" @@ -59,23 +58,11 @@ #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/LTE_TRANSPORT/if5_tools.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" -#include "PHY_INTERFACE/phy_interface.h" -#include "LAYER2/MAC/mac.h" -#include "LAYER2/MAC/mac_extern.h" -#include "LAYER2/MAC/mac_proto.h" -#include "RRC/LTE/rrc_extern.h" -#include "SCHED/sched_eNB.h" -#include "UTIL/OPT/opt.h" -#include "UTIL/OTG/otg_tx.h" -#include "UTIL/OTG/otg_externs.h" -#include "UTIL/MATH/oml.h" +#include "SCHED/sched_common.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" -#include "nfapi/oai_integration/vendor_ext.h" -#include "enb_config.h" #include "targets/ARCH/COMMON/common_lib.h" #include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" -#include "targets/RT/USER/lte-softmodem.h" //#include "PHY/TOOLS/time_meas.h" /* these variables have to be defined before including ENB_APP/enb_paramdef.h */ @@ -86,29 +73,25 @@ static int DEFBFW[] = {0x00007fff}; #include "ENB_APP/enb_paramdef.h" #include "common/config/config_userapi.h" -#ifndef OPENAIR2 - #include "UTIL/OTG/otg_extern.h" -#endif - -#include "s1ap_eNB.h" #include "SIMULATION/ETH_TRANSPORT/proto.h" #include "T.h" -#include "pdcp.h" +#include "executables/softmodem-common.h" #define MBMS_EXPERIMENTAL extern volatile int oai_exit; -extern int emulate_rf; -extern int numerology; extern clock_source_t clock_source; #include "executables/thread-common.h" //extern PARALLEL_CONF_t get_thread_parallel_conf(void); //extern WORKER_CONF_t get_thread_worker_conf(void); extern void phy_init_RU(RU_t *); -void stop_RU(int nb_ru); +void prach_procedures(PHY_VARS_eNB *eNB,int br_flag); + +void stop_RU(RU_t **rup,int nb_ru); + void do_ru_synch(RU_t *ru); void configure_ru(int idx, @@ -124,13 +107,24 @@ void wait_eNBs(void); const char ru_states[6][9] = {"RU_IDLE","RU_CONFIG","RU_READY","RU_RUN","RU_ERROR","RU_SYNC"}; +extern const char NB_functions[7][20]; +extern const char NB_timing[2][20]; + extern uint16_t sf_ahead; +extern const char ru_if_types[MAX_RU_IF_TYPES][20]; + + #if defined(PRE_SCD_THREAD) +#include "common/ran_context.h" +#include "nfapi/oai_integration/vendor_ext.h" +#include "openair2/LAYER2/MAC/mac_extern.h" extern uint8_t dlsch_ue_select_tbl_in_use; void init_ru_vnf(void); + extern RAN_CONTEXT_t RC; #endif +RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mask,pthread_mutex_t *ru_mutex,pthread_cond_t *ru_cond); /*************************************************************/ /* Functions to attach and configure RRU */ @@ -141,7 +135,7 @@ extern uint16_t sf_ahead; // southbound IF5 fronthaul for 16-bit OAI format static inline void fh_if5_south_out(RU_t *ru,int frame, int subframe, uint64_t timestamp) { - if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); + if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); ru->south_out_cnt++; @@ -149,14 +143,12 @@ static inline void fh_if5_south_out(RU_t *ru,int frame, int subframe, uint64_t t } - - // southbound IF4p5 fronthaul static inline void fh_if4p5_south_out(RU_t *ru, int frame, int subframe, uint64_t timestamp) { - if (ru == RC.ru[0]) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); + if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, ru->proc.timestamp_tx&0xffffffff ); LOG_D(PHY,"ENTERED fh_if4p5_south_out Sending IF4p5 for frame %d subframe %d ru %d\n",ru->proc.frame_tx,ru->proc.tti_tx,ru->idx); @@ -166,7 +158,7 @@ static inline void fh_if4p5_south_out(RU_t *ru, LOG_D(PHY,"south_out_cnt %d\n",ru->south_out_cnt); } - /*if (ru == RC.ru[0] || ru == RC.ru[1]) { + /*if (ru->idx == 0 || ru->idx == ru) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU+ru->idx, ru->proc.frame_tx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_RU+ru->idx, ru->proc.subframe_tx ); }*/ @@ -227,31 +219,30 @@ void fh_if4p5_south_in(RU_t *ru, symbol_mask_full = (1<symbols_per_tti)-1; LOG_D(PHY,"fh_if4p5_south_in: RU %d, frame %d, subframe %d, ru %d, mask %x\n",ru->idx,*frame,*subframe,ru->idx,proc->symbol_mask[*subframe]); - AssertFatal(proc->symbol_mask[*subframe]==0 || proc->symbol_mask[*subframe]==symbol_mask_full,"rx_fh_if4p5: proc->symbol_mask[%d] = %x\n",*subframe,proc->symbol_mask[*subframe]); + //AssertFatal(proc->symbol_mask[*subframe]==0 || proc->symbol_mask[*subframe]>=symbol_mask_full,"rx_fh_if4p5: proc->symbol_mask[%d] = %x\n",*subframe,proc->symbol_mask[*subframe]); // >= because PULTICK for S-subframe could have been received during normal subframe - if (proc->symbol_mask[*subframe]==0) { // this is normal case, if not true then we received a PULTICK before the previous subframe was finished + if (proc->symbol_mask[*subframe]idx,*frame,*subframe,f,sf); + LOG_D(PHY,"fh_if4p5_south_in (%s/%d): RU %d, frame %d, subframe %d, f %d, sf %d, symbol %d\n",packet_type == IF4p5_PULFFT ? "PULFFT" : "PULTICK",packet_type,ru->idx,*frame,*subframe,f,sf,symbol_number); if (oai_exit == 1 || ru->cmd== STOP_RU) break; if (packet_type == IF4p5_PULFFT) proc->symbol_mask[sf] = proc->symbol_mask[sf] | (1<symbol_mask[sf] = symbol_mask_full; + proc->symbol_mask[sf] = 0xffff; pultick_received++; - /* if ((proc->first_rx==0) && (f!=*frame)) LOG_E(PHY,"rx_fh_if4p5: PULTICK received frame %d != expected %d (RU %d) \n",f,*frame, ru->idx); else if ((proc->first_rx==0) && (sf!=*subframe)) LOG_E(PHY,"rx_fh_if4p5: PULTICK received subframe %d != expected %d (first_rx %d)\n",sf,*subframe,proc->first_rx); else break; */ - if (f==*frame || sf==*subframe) break; + //if (f==*frame || sf==*subframe) break; } else if (packet_type == IF4p5_PRACH) { // nothing in RU for RAU } - LOG_D(PHY,"rx_fh_if4p5 for RU %d: subframe %d, sf %d, symbol mask %x\n",ru->idx,*subframe,sf,proc->symbol_mask[sf]); - } while(proc->symbol_mask[sf] != symbol_mask_full); + LOG_D(PHY,"rx_fh_if4p5 for RU %d: subframe %d, sf %d, symbol %d, symbol mask %x\n",ru->idx,*subframe,sf,symbol_number,proc->symbol_mask[sf]); + } while(proc->symbol_mask[*subframe] < symbol_mask_full); } else { f = *frame; sf = *subframe; @@ -263,7 +254,7 @@ void fh_if4p5_south_in(RU_t *ru, proc->timestamp_rx = ((proc->frame_rx * 10) + proc->tti_rx ) * fp->samples_per_tti ; // proc->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti); - if (get_nprocs()<=4) { + if (get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD) { proc->tti_tx = (sf+sf_ahead)%10; proc->frame_tx = (sf>(9-sf_ahead)) ? (f+1)&1023 : f; } @@ -291,7 +282,7 @@ void fh_if4p5_south_in(RU_t *ru, *subframe = proc->tti_rx; } - /*if (ru == RC.ru[0] || ru == RC.ru[1]) { + /*if (ru->idx == 0 || ru->idx == 1) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU+ru->idx, f ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_RU+ru->idx, sf ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU, f ); @@ -399,7 +390,7 @@ void fh_if4p5_north_in(RU_t *ru, ru->north_in_cnt++; // dump VCD output for first RU in list - if (ru == RC.ru[0]) { + if (ru->idx == 0) { VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, *frame ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, *subframe ); } @@ -491,7 +482,7 @@ void fh_if4p5_north_asynch_in(RU_t *ru, LOG_D(PHY,"RU %d/%d TST %llu, frame %d, subframe %d\n",ru->idx,0,(long long unsigned int)proc->timestamp_tx,frame_tx,tti_tx); // dump VCD output for first RU in list - if (ru == RC.ru[0]) { + if (ru->idx == 0) { /*VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame_tx ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, tti_tx );*/ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_IF4P5_NORTH_ASYNCH_IN, frame_tx); @@ -557,8 +548,8 @@ volatile late_control_e late_control=STATE_BURST_NORMAL; static void *emulatedRF_thread(void *param) { RU_proc_t *proc = (RU_proc_t *) param; int microsec = 500; // length of time to sleep, in miliseconds + int numerology = 0 ; struct timespec req = {0}; - int numerology = get_softmodem_params()->numerology; req.tv_sec = 0; req.tv_nsec = (numerology>0)? ((microsec * 1000L)/numerology):(microsec * 1000L)*2; cpu_set_t cpuset; @@ -609,7 +600,7 @@ void rx_rf(RU_t *ru, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 ); old_ts = proc->timestamp_rx; - if(get_softmodem_params()->emulate_rf) { + if(ru->emulate_rf) { wait_on_condition(&proc->mutex_emulateRF,&proc->cond_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread"); release_thread(&proc->mutex_emulateRF,&proc->instance_cnt_emulateRF,"emulatedRF_thread"); rxs = fp->samples_per_tti; @@ -662,7 +653,7 @@ void rx_rf(RU_t *ru, proc->tti_rx = (proc->timestamp_rx / fp->samples_per_tti)%10; // synchronize first reception to frame 0 subframe 0 - if (ru->fh_north_asynch_in == NULL) { + if (get_thread_parallel_conf() == PARALLEL_SINGLE_THREAD && ru->fh_north_asynch_in == NULL) { #ifdef PHY_TX_THREAD proc->timestamp_phy_tx = proc->timestamp_rx+((sf_ahead-1)*fp->samples_per_tti); proc->subframe_phy_tx = (proc->tti_rx+(sf_ahead-1))%10; @@ -690,16 +681,12 @@ void rx_rf(RU_t *ru, proc->frame_rx, proc->tti_rx); - // dump VCD output for first RU in list - if (ru == RC.ru[0]) { - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU, proc->frame_rx ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_RX0_RU, proc->tti_rx ); + } - if (ru->fh_north_asynch_in == NULL) { - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, proc->frame_tx ); - VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, proc->tti_tx ); - } - } + // dump VCD output for first RU in list + if (ru->idx == 0) { + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_RU, proc->frame_rx ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_RX0_RU, proc->tti_rx ); } if (proc->first_rx == 0) { @@ -790,6 +777,7 @@ void tx_rf(RU_t *ru, /* add fail safe for late command */ if(late_control!=STATE_BURST_NORMAL) { //stop burst + LOG_E(PHY,"%d.%d late_control : %d\n",frame,subframe,late_control); switch (late_control) { case STATE_BURST_TERMINATE: flags=10; // end of burst and no time spec @@ -818,12 +806,13 @@ void tx_rf(RU_t *ru, break; } } - - /* add fail safe for late command end */ VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_RU, frame); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TTI_NUMBER_TX0_RU, subframe); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp-ru->openair0_cfg.tx_sample_advance)&0xffffffff ); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_WRITE_FLAGS,flags); + + /* add fail safe for late command end */ + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); // prepare tx buffer pointers txs = ru->rfdevice.trx_write_func(&ru->rfdevice, timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension, @@ -841,7 +830,7 @@ void tx_rf(RU_t *ru, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); // AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen); - if( (txs != siglen+sf_extension) && (late_control==STATE_BURST_NORMAL) ) { /* add fail safe for late command */ + if( usrp_tx_thread == 0 && (txs != siglen+sf_extension) && (late_control==STATE_BURST_NORMAL) ) { /* add fail safe for late command */ late_control=STATE_BURST_TERMINATE; LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs, siglen,late_control); } @@ -869,7 +858,6 @@ static void *ru_thread_asynch_rxtx( void *param ) { LOG_I(PHY, "devices ok (ru_thread_asynch_rxtx)\n"); while (!oai_exit) { - if (oai_exit) break; if (ru->state != RU_RUN) { subframe=0; @@ -955,7 +943,7 @@ void *ru_thread_prach( void *param ) { thread_top_init("ru_thread_prach",1,500000,1000000,20000000); //wait_sync("ru_thread_prach"); - while (RC.ru_mask>0 && ru->function!=eNodeB_3GPP) { + while (*ru->ru_mask>0 && ru->function!=eNodeB_3GPP) { usleep(1e6); LOG_D(PHY,"%s() RACH waiting for RU to be configured\n", __FUNCTION__); } @@ -1168,7 +1156,7 @@ void wakeup_L1s(RU_t *ru) { if (ru == eNB->RU_list[i] && eNB->RU_list[i]->wait_cnt == 0) { //AssertFatal((proc->RU_mask&(1<Mod_id,ru->proc.frame_rx,ru->proc.tti_rx,ru->idx,eNB->num_RU,proc->RU_mask); proc->RU_mask[ru->proc.tti_rx] |= (1<RU_list[i]->state == RU_SYNC ||*/(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i] && ru->is_slave==0) ) { + } else if (eNB->RU_list[i]->state == RU_SYNC ||(eNB->RU_list[i]->is_slave==1 && eNB->RU_list[i]->wait_cnt>0 && ru!=eNB->RU_list[i] /*&& ru->is_slave==0*/) ) { proc->RU_mask[ru->proc.tti_rx] |= (1<numerology; if(fp->N_RB_DL == 100) { - if(numerology == 0) { + if(ru->numerology == 0) { if (fp->threequarter_fs) { cfg->sample_rate=23.04e6; cfg->samples_per_frame = 230400; @@ -1320,12 +1308,12 @@ void fill_rf_config(RU_t *ru, cfg->tx_bw = 10e6; cfg->rx_bw = 10e6; } - } else if(numerology == 1) { + } else if(ru->numerology == 1) { cfg->sample_rate=61.44e6; cfg->samples_per_frame = 307200; cfg->tx_bw = 20e6; cfg->rx_bw = 20e6; - } else if(numerology == 2) { + } else if(ru->numerology == 2) { cfg->sample_rate=122.88e6; cfg->samples_per_frame = 307200; cfg->tx_bw = 40e6; @@ -1524,36 +1512,43 @@ static void *ru_thread_tx( void *param ) { LOG_D(PHY,"ru_thread_tx (ru %d): Waiting for TX processing\n",ru->idx); // wait until eNBs are finished subframe RX n and TX n+4 wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx"); - LOG_D(PHY,"ru_thread_tx: TX in %d.%d\n",ru->proc.frame_tx,ru->proc.tti_tx); + ret = pthread_mutex_lock(&proc->mutex_eNBs); + AssertFatal(ret == 0,"mutex_lock return %d\n",ret); + int frame_tx=proc->frame_tx; + int tti_tx =proc->tti_tx; + uint64_t timestamp_tx = proc->timestamp_tx; + ret = pthread_mutex_unlock(&proc->mutex_eNBs); + AssertFatal(ret == 0,"mutex_lock returns %d\n",ret); + if (oai_exit) break; // do TX front-end processing if needed (precoding and/or IDFTs) - if (ru->feptx_prec) ru->feptx_prec(ru,proc->frame_tx,proc->tti_tx); + if (ru->feptx_prec) ru->feptx_prec(ru,frame_tx,tti_tx); // do OFDM if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,proc->frame_tx,proc->tti_tx); + if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,frame_tx,tti_tx); - if(!(get_softmodem_params()->emulate_rf)) { //if(!emulate_rf){ + if(!(ru->emulate_rf)) { //if(!emulate_rf){ // do outgoing fronthaul (south) if needed - if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,proc->frame_tx,proc->tti_tx,proc->timestamp_tx); + if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,frame_tx,tti_tx,timestamp_tx); if (ru->fh_north_out) ru->fh_north_out(ru); } else { for (int i=0; inb_tx; i++) { - if(proc->frame_tx == 2) { - sprintf(filename,"txdataF%d_frame%d_sf%d.m",i,proc->frame_tx,proc->tti_tx); + if(frame_tx == 2) { + sprintf(filename,"txdataF%d_frame%d_sf%d.m",i,frame_tx,tti_tx); LOG_M(filename,"txdataF_frame",ru->common.txdataF_BF[i],fp->symbols_per_tti*fp->ofdm_symbol_size, 1, 1); } - if(proc->frame_tx == 2 && proc->tti_tx==0) { - sprintf(filename,"txdata%d_frame%d.m",i,proc->frame_tx); + if(frame_tx == 2 && tti_tx==0) { + sprintf(filename,"txdata%d_frame%d.m",i,frame_tx); LOG_M(filename,"txdata_frame",ru->common.txdata[i],fp->samples_per_tti*10, 1, 1); } } } - LOG_D(PHY,"ru_thread_tx: releasing RU TX in %d.%d\n", proc->frame_tx, proc->tti_tx); + LOG_D(PHY,"ru_thread_tx: releasing RU TX in %d.%d\n", frame_tx, tti_tx); release_thread(&proc->mutex_eNBs,&proc->instance_cnt_eNBs,"ru_thread_tx"); for(int i = 0; inum_eNB; i++) { @@ -1569,7 +1564,7 @@ static void *ru_thread_tx( void *param ) { eNB->Mod_id,eNB_proc->frame_rx,eNB_proc->subframe_rx,ru->idx,eNB->num_RU,eNB_proc->RU_mask_tx); eNB_proc->RU_mask_tx |= (1<RU_list[j]->state==RU_SYNC ||*/ (eNB->RU_list[j]->is_slave==1 && eNB->RU_list[j]->wait_cnt>0 && ru!=eNB->RU_list[j] && ru->is_slave==0)) { + } else if (eNB->RU_list[j]->state==RU_SYNC ||(eNB->RU_list[j]->is_slave==1 && eNB->RU_list[j]->wait_cnt>0 && ru!=eNB->RU_list[j])) { eNB_proc->RU_mask_tx |= (1<mutex_RU_tx))==0,"mutex_unlock returns %d\n",ret); AssertFatal((ret=pthread_mutex_lock( &L1_proc->mutex_RUs))==0,"mutex_lock returns %d\n",ret); L1_proc->instance_cnt_RUs = 0; - LOG_D(PHY,"ru_thread_tx: Signaling RU TX done in %d.%d\n", proc->frame_tx, proc->tti_tx); + LOG_D(PHY,"ru_thread_tx: Signaling RU TX done in %d.%d\n", frame_tx, tti_tx); // the thread can now be woken up LOG_D(PHY,"ru_thread_tx: clearing mask and Waking up L1 thread\n"); @@ -1638,10 +1633,10 @@ static void *ru_thread( void *param ) { } LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx); - AssertFatal((ret=pthread_mutex_lock(&RC.ru_mutex))==0,"mutex_lock returns %d\n",ret); - RC.ru_mask &= ~(1<idx); - pthread_cond_signal(&RC.ru_cond); - AssertFatal((ret=pthread_mutex_unlock(&RC.ru_mutex))==0,"mutex_unlock returns %d\n",ret); + AssertFatal((ret=pthread_mutex_lock(ru->ru_mutex))==0,"mutex_lock returns %d\n",ret); + *ru->ru_mask &= ~(1<idx); + pthread_cond_signal(ru->ru_cond); + AssertFatal((ret=pthread_mutex_unlock(ru->ru_mutex))==0,"mutex_unlock returns %d\n",ret); ru->state = RU_RUN; } else if (ru->has_ctrl_prt == 0) { // There is no control port: start everything here @@ -1661,10 +1656,10 @@ static void *ru_thread( void *param ) { exit(-1); } - AssertFatal((ret=pthread_mutex_lock(&RC.ru_mutex))==0,"mutex_lock returns %d\n",ret); - RC.ru_mask &= ~(1<idx); - pthread_cond_signal(&RC.ru_cond); - AssertFatal((ret=pthread_mutex_unlock(&RC.ru_mutex))==0,"mutex_unlock returns %d\n",ret); + AssertFatal((ret=pthread_mutex_lock(ru->ru_mutex))==0,"mutex_lock returns %d\n",ret); + *ru->ru_mask &= ~(1<idx); + pthread_cond_signal(ru->ru_cond); + AssertFatal((ret=pthread_mutex_unlock(ru->ru_mutex))==0,"mutex_unlock returns %d\n",ret); ru->state = RU_RUN; } @@ -1673,6 +1668,17 @@ static void *ru_thread( void *param ) { pthread_cond_signal(&proc->cond_FH1); AssertFatal((ret=pthread_mutex_unlock(&proc->mutex_FH1))==0,"mutex_unlock returns %d\n",ret); + if(usrp_tx_thread == 1){ + if (ru->start_write_thread){ + if(ru->start_write_thread(ru) != 0){ + LOG_E(HW,"Could not start tx write thread\n"); + } + else{ + LOG_I(PHY,"tx write thread ready\n"); + } + } + } + while (!oai_exit) { if (ru->if_south != LOCAL_RF && ru->is_slave==1) { ru->wait_cnt = 100; @@ -1683,10 +1689,12 @@ static void *ru_thread( void *param ) { // wait to be woken up if (ru->function!=eNodeB_3GPP && ru->has_ctrl_prt == 1) { + LOG_D(PHY,"RU %d: Waiting for control thread to say go\n",ru->idx); if (wait_on_condition(&ru->proc.mutex_ru,&ru->proc.cond_ru_thread,&ru->proc.instance_cnt_ru,"ru_thread")<0) break; - } else wait_sync("ru_thread"); + } else wait_sync("ru_thread"); + LOG_D(PHY,"RU %d: Got start from control thread\n",ru->idx); - if(!(get_softmodem_params()->emulate_rf)) { + if(!(ru->emulate_rf)) { if (ru->is_slave == 0) AssertFatal(ru->state == RU_RUN,"ru-%d state = %s != RU_RUN\n",ru->idx,ru_states[ru->state]); else if (ru->is_slave == 1) AssertFatal(ru->state == RU_SYNC || ru->state == RU_RUN || ru->state == RU_CHECK_SYNC,"ru %d state = %s != RU_SYNC or RU_RUN or RU_CHECK_SYNC\n",ru->idx,ru_states[ru->state]); @@ -1712,7 +1720,7 @@ static void *ru_thread( void *param ) { // if this is a slave RRU, try to synchronize on the DL frequency if ((ru->is_slave == 1) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru); - LOG_D(PHY,"Starting steady-state operation\n"); + if (ru->state == RU_RUN || ru->state == RU_CHECK_SYNC) LOG_I(PHY,"RU %d Starting steady-state operation\n",ru->idx); // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices while (ru->state == RU_RUN || ru->state == RU_CHECK_SYNC) { @@ -1773,14 +1781,14 @@ static void *ru_thread( void *param ) { ru->wait_cnt--; LOG_D(PHY,"RU thread %d, frame %d, subframe %d, wait_cnt %d \n",ru->idx, frame, subframe, ru->wait_cnt); - if (ru->if_south!=LOCAL_RF && ru->wait_cnt <=20 && subframe == 5 && frame != RC.ru[0]->proc.frame_rx && resynch_done == 0) { + if (ru->if_south!=LOCAL_RF && ru->wait_cnt <=20 && subframe == 5 && frame != ru->ru0->proc.frame_rx && resynch_done == 0) { // Send RRU_frame adjust RRU_CONFIG_msg_t rru_config_msg; rru_config_msg.type = RRU_frame_resynch; rru_config_msg.len = sizeof(RRU_CONFIG_msg_t); // TODO: set to correct msg len - ((uint16_t *)&rru_config_msg.msg[0])[0] = RC.ru[0]->proc.frame_rx; + ((uint16_t *)&rru_config_msg.msg[0])[0] = ru->ru0->proc.frame_rx; ru->cmd=WAIT_RESYNCH; - LOG_I(PHY,"Sending Frame Resynch %d to RRU %d\n", RC.ru[0]->proc.frame_rx,ru->idx); + LOG_I(PHY,"Sending Frame Resynch %d to RRU %d\n", ru->ru0->proc.frame_rx,ru->idx); AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1),"Failed to send msg to RAU\n"); resynch_done=1; } @@ -1838,9 +1846,9 @@ static void *ru_thread( void *param ) { #ifdef MBMS_EXPERIMENTAL //Workaround ... this must be properly handled - if(ru->if_south==LOCAL_RF && ru->function==eNodeB_3GPP && RC.eNB[0][0]!=NULL){ - if(ru->frame_parms->num_MBSFN_config!=RC.eNB[0][0]->frame_parms.num_MBSFN_config){ - ru->frame_parms = &RC.eNB[0][0]->frame_parms;//->frame_parms; + if(ru->if_south==LOCAL_RF && ru->function==eNodeB_3GPP && ru->eNB_list[0]!=NULL){ + if(ru->frame_parms->num_MBSFN_config!=ru->eNB_list[0]->frame_parms.num_MBSFN_config){ + ru->frame_parms = &ru->eNB_list[0]->frame_parms;//->frame_parms; LOG_W(PHY,"RU MBSFN SF PARAMS Updated\n"); } } @@ -1855,7 +1863,7 @@ static void *ru_thread( void *param ) { // do OFDM if needed if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru, proc->frame_tx, proc->tti_tx); - if(!(get_softmodem_params()->emulate_rf)) { //if(!emulate_rf){ + if(!(ru->emulate_rf)) { //if(!emulate_rf){ // do outgoing fronthaul (south) if needed if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru, proc->frame_tx, proc->tti_tx, proc->timestamp_tx); @@ -1889,12 +1897,12 @@ static void *ru_thread( void *param ) { #endif } // else wait_cnt == 0 - } // ru->state = RU_RUN + } // ru->state = RU_RUN || RU_CHECK_SYNC } // while !oai_exit LOG_I(PHY, "Exiting ru_thread \n"); - if (!(get_softmodem_params()->emulate_rf)) { + if (!(ru->emulate_rf)) { if (ru->stop_rf != NULL) { if (ru->stop_rf(ru) != 0) LOG_E(HW,"Could not stop the RF device\n"); @@ -1909,7 +1917,7 @@ static void *ru_thread( void *param ) { // This thread run the initial synchronization like a UE void *ru_thread_synch(void *arg) { RU_t *ru = (RU_t *)arg; - LTE_DL_FRAME_PARMS *fp = ru->frame_parms; + LTE_DL_FRAME_PARMS *fp; int64_t peak_val, avg; static int ru_thread_synch_status = 0; int cnt=0; @@ -1918,6 +1926,8 @@ void *ru_thread_synch(void *arg) { // initialize variables for PSS detection ru_sync_time_init(ru); //lte_sync_time_init(ru->frame_parms); + fp = ru->frame_parms; + int last_rxoff=0; while (!oai_exit) { // wait to be woken up if (wait_on_condition(&ru->proc.mutex_synch,&ru->proc.cond_synch,&ru->proc.instance_cnt_synch,"ru_thread_synch")<0) break; @@ -1931,17 +1941,18 @@ void *ru_thread_synch(void *arg) { &avg); LOG_I(PHY,"RU synch cnt %d: %d, val %llu (%d dB,%d dB)\n",cnt,ru->rx_offset,(unsigned long long)peak_val,dB_fixed64(peak_val),dB_fixed64(avg)); cnt++; - - //if (/*ru->rx_offset >= 0*/dB_fixed(peak_val)>=85 && cnt>10) { - if (ru->rx_offset >= 0 && avg>0 && dB_fixed(peak_val/avg)>=15 && cnt>10) { + int abs_diff= ru->rx_offset - last_rxoff; + if (abs_diff<0) abs_diff=-abs_diff; + if (ru->rx_offset >= 0 && abs_diff<6 && avg>0 && dB_fixed(peak_val/avg)>=15 && cnt>10) { LOG_I(PHY,"Estimated peak_val %d dB, avg %d => timing offset %llu\n",dB_fixed(peak_val),dB_fixed(avg),(unsigned long long int)ru->rx_offset); ru->in_synch = 1; - /* + /* LOG_M("ru_sync_rx.m","rurx",&ru->common.rxdata[0][0],LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti,1,1); LOG_M("ru_sync_corr.m","sync_corr",ru->dmrs_corr,LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti,1,6); LOG_M("ru_dmrs.m","rudmrs",&ru->dmrssync[0],fp->ofdm_symbol_size,1,1); - */ - //exit(-1); + + exit(-1); + */ } // sync_pos > 0 else { //AssertFatal(cnt<1000,"Cannot find synch reference\n"); if (cnt>200) { @@ -1951,6 +1962,7 @@ void *ru_thread_synch(void *arg) { exit(-1); } } + last_rxoff=ru->rx_offset; } // ru->in_synch==0 if (release_thread(&ru->proc.mutex_synch,&ru->proc.instance_cnt_synch,"ru_synch_thread") < 0) break; @@ -2114,7 +2126,7 @@ static void *rf_tx( void *param ) { // do OFDM if needed if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru,proc->frame_tx,proc->tti_tx); - if(!emulate_rf) { + if(!ru->emulate_rf) { // do outgoing fronthaul (south) if needed if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru,proc->frame_tx,proc->tti_tx,proc->timestamp_tx); @@ -2186,6 +2198,9 @@ void reset_proc(RU_t *ru) { for (i=0; i<10; i++) proc->symbol_mask[i]=0; } +int start_write_thread(RU_t *ru) { + return(ru->rfdevice.trx_write_init(&ru->rfdevice)); +} void init_RU_proc(RU_t *ru) { int i=0; @@ -2283,7 +2298,7 @@ void init_RU_proc(RU_t *ru) { pthread_create( &proc->pthread_rf_tx, NULL, rf_tx, (void *)ru ); #endif - if (get_softmodem_params()->emulate_rf) + if (ru->emulate_rf) pthread_create( &proc->pthread_emulateRF, attr_emulateRF, emulatedRF_thread, (void *)proc ); if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) @@ -2318,10 +2333,10 @@ void init_RU_proc(RU_t *ru) { if (ru->function == eNodeB_3GPP) { usleep(10000); LOG_I(PHY, "Signaling main thread that RU %d (is_slave %d,send_dmrs %d) is ready in state %s\n",ru->idx,ru->is_slave,ru->generate_dmrs_sync,ru_states[ru->state]); - AssertFatal((ret=pthread_mutex_lock(&RC.ru_mutex))==0,"mutex_lock returns %d\n",ret); - RC.ru_mask &= ~(1<idx); - pthread_cond_signal(&RC.ru_cond); - AssertFatal((ret=pthread_mutex_unlock(&RC.ru_mutex))==0,"mutex_unlock returns %d\n",ret); + AssertFatal((ret=pthread_mutex_lock(ru->ru_mutex))==0,"mutex_lock returns %d\n",ret); + *ru->ru_mask &= ~(1<idx); + pthread_cond_signal(ru->ru_cond); + AssertFatal((ret=pthread_mutex_unlock(ru->ru_mutex))==0,"mutex_unlock returns %d\n",ret); } */ } @@ -2449,22 +2464,22 @@ void kill_RU_proc(RU_t *ru) { } -void init_precoding_weights(PHY_VARS_eNB *eNB) { - int layer,ru_id,aa,re,ue,tb; +void init_precoding_weights(RU_t **rup,int nb_RU,PHY_VARS_eNB *eNB) { + int layer,ru_id,aa,re,tb; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; RU_t *ru; LTE_eNB_DLSCH_t *dlsch; // init precoding weigths - for (ue=0; uedlsch[ue][tb]; + dlsch = eNB->dlsch[dlsch_id][tb]; for (layer=0; layer<4; layer++) { int nb_tx=0; - for (ru_id=0; ru_idnb_tx; } @@ -2548,6 +2563,7 @@ void set_function_spec_param(RU_t *ru) { ru->fh_north_out = NULL; // no outgoing fronthaul to north ru->start_if = NULL; // no if interface ru->rfdevice.host_type = RAU_HOST; + ru->start_write_thread = start_write_thread; } ru->fh_south_in = rx_rf; // local synchronous RF RX @@ -2642,60 +2658,61 @@ void set_function_spec_param(RU_t *ru) { } -//extern void RCconfig_RU(void); +void init_RU0(RU_t *ru,int ru_id,char *rf_config_file, int send_dmrssync) { + ru->rf_config_file = rf_config_file; + ru->idx = ru_id; + ru->ts_offset = 0; + + if (ru->is_slave == 1) { + ru->in_synch = 0; + ru->generate_dmrs_sync = 0; + } else { + ru->in_synch = 1; + ru->generate_dmrs_sync = send_dmrssync; + } + + ru->cmd = EMPTY; + ru->south_out_cnt = 0; + // use eNB_list[0] as a reference for RU frame parameters + // NOTE: multiple CC_id are not handled here yet! + + //ru->generate_dmrs_sync = (ru->is_slave == 0) ? 1 : 0; + if ((ru->is_slave == 0) && (ru->ota_sync_enable == 1)) + ru->generate_dmrs_sync = 1; + else + ru->generate_dmrs_sync = 0; + + ru->wakeup_L1_sleeptime = 2000; + ru->wakeup_L1_sleep_cnt_max = 3; + -void init_RU(char *rf_config_file, int send_dmrssync) { +} + +// This part if on eNB side +void init_RU(RU_t **rup,int nb_RU,PHY_VARS_eNB ***eNBp,int nb_L1,int *nb_CC,char *rf_config_file, int send_dmrssync) { int ru_id, i, CC_id; RU_t *ru; PHY_VARS_eNB *eNB0 = (PHY_VARS_eNB *)NULL; LTE_DL_FRAME_PARMS *fp = (LTE_DL_FRAME_PARMS *)NULL; // create status mask - RC.ru_mask= (1 << RC.nb_RU) - 1; - pthread_mutex_init(&RC.ru_mutex,NULL); - pthread_cond_init(&RC.ru_cond,NULL); + if (nb_CC != NULL) + for (i=0; inum_RU=0; - if (RC.nb_CC != 0) - for (i=0; inum_RU=0; - - LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU); - - for (ru_id=0; ru_idrf_config_file = rf_config_file; - ru->idx = ru_id; - ru->ts_offset = 0; - - if (ru->is_slave == 1) { - ru->in_synch = 0; - ru->generate_dmrs_sync = 0; - } else { - ru->in_synch = 1; - ru->generate_dmrs_sync = send_dmrssync; - } - - ru->cmd = EMPTY; - ru->south_out_cnt = 0; - // use eNB_list[0] as a reference for RU frame parameters - // NOTE: multiple CC_id are not handled here yet! - - //ru->generate_dmrs_sync = (ru->is_slave == 0) ? 1 : 0; - if ((ru->is_slave == 0) && (ru->ota_sync_enable == 1)) - ru->generate_dmrs_sync = 1; - else - ru->generate_dmrs_sync = 0; - - ru->wakeup_L1_sleeptime = 2000; - ru->wakeup_L1_sleep_cnt_max = 3; + LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",nb_RU); + for (ru_id=0; ru_idru0 = rup[0]; if (ru->num_eNB > 0) { - LOG_D(PHY, "%s() RC.ru[%d].num_eNB:%d ru->eNB_list[0]:%p RC.eNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], RC.eNB[0][0], ru->rf_config_file); - + LOG_D(PHY, "%s() ru[%d].num_eNB:%d ru->eNB_list[0]:%p eNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], eNBp[0][0], ru->rf_config_file); + if (ru->eNB_list[0] == 0) { - LOG_E(PHY,"%s() DJP - ru->eNB_list ru->num_eNB are not initialized - so do it manually\n", __FUNCTION__); - ru->eNB_list[0] = RC.eNB[0][0]; + LOG_E(PHY,"%s() DJP - ru->eNB_list ru->num_eNB are not initialized - so do it manually\n", __FUNCTION__); + ru->eNB_list[0] = eNBp[0][0]; ru->num_eNB=1; // // DJP - feptx_prec() / feptx_ofdm() parses the eNB_list (based on num_eNB) and copies the txdata_F to txdata in RU @@ -2704,7 +2721,7 @@ void init_RU(char *rf_config_file, int send_dmrssync) { LOG_E(PHY,"DJP - delete code above this %s:%d\n", __FILE__, __LINE__); } } - + eNB0 = ru->eNB_list[0]; fp = ru->frame_parms; LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south); @@ -2778,10 +2795,10 @@ void stop_ru(RU_t *ru) { } -void stop_RU(int nb_ru) { +void stop_RU(RU_t **rup,int nb_ru) { for (int inst = 0; inst < nb_ru; inst++) { LOG_I(PHY, "Stopping RU %d processing threads\n", inst); - kill_RU_proc(RC.ru[inst]); + kill_RU_proc(rup[inst]); } } @@ -2802,7 +2819,7 @@ void init_ru_vnf(void) { pthread_cond_init(&RC.ru_cond,NULL); // read in configuration file) LOG_I(PHY,"configuring RU from file\n"); - RCconfig_RU(); + RC.ru = RCconfig_RU(RC.nb_RU,RC.nb_L1_inst,RC.eNB,&RC.ru_mask,&RC.ru_mutex,&RC.ru_cond); LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_L1_inst,RC.nb_RU,get_nprocs()); if (RC.nb_CC != 0) @@ -2878,183 +2895,185 @@ void init_ru_vnf(void) { /* --------------------------------------------------------*/ /* from here function to use configuration module */ -void RCconfig_RU(void) { +RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mask,pthread_mutex_t *ru_mutex,pthread_cond_t *ru_cond) { int i = 0; paramdef_t RUParams[] = RUPARAMS_DESC; paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0}; config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL); - + RU_t **ru=NULL; if ( RUParamList.numelt > 0) { - RC.ru = (RU_t **)malloc(RC.nb_RU*sizeof(RU_t *)); + ru = (RU_t **)malloc(nb_RU*sizeof(RU_t *)); - for (int j = 0; j < RC.nb_RU; j++) { - RC.ru[j] = (RU_t *)malloc(sizeof(RU_t)); - memset((void *)RC.ru[j],0,sizeof(RU_t)); - RC.ru[j]->idx = j; - LOG_I(PHY,"Creating RC.ru[%d]:%p\n", j, RC.ru[j]); - RC.ru[j]->if_timing = synch_to_ext_device; + for (int j = 0; j < nb_RU; j++) { + ru[j] = (RU_t *)malloc(sizeof(RU_t)); + memset((void *)ru[j],0,sizeof(RU_t)); + ru[j]->idx = j; + LOG_I(PHY,"Creating ru[%d]:%p\n", j, ru[j]); + ru[j]->if_timing = synch_to_ext_device; - if (RC.nb_L1_inst >0) - RC.ru[j]->num_eNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt; + ru[j]->ru_mask = ru_mask; + ru[j]->ru_mutex = ru_mutex; + ru[j]->ru_cond = ru_cond; + if (nb_L1_inst >0) + ru[j]->num_eNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt; else - RC.ru[j]->num_eNB = 0; + ru[j]->num_eNB = 0; - for (i=0; inum_eNB; i++) RC.ru[j]->eNB_list[i] = RC.eNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0]; + for (i=0; inum_eNB; i++) ru[j]->eNB_list[i] = eNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0]; - RC.ru[j]->has_ctrl_prt = 0; + ru[j]->has_ctrl_prt = 0; if (config_isparamset(RUParamList.paramarray[j], RU_SDR_ADDRS)) { - RC.ru[j]->openair0_cfg.sdr_addrs = strdup(*(RUParamList.paramarray[j][RU_SDR_ADDRS].strptr)); + ru[j]->openair0_cfg.sdr_addrs = strdup(*(RUParamList.paramarray[j][RU_SDR_ADDRS].strptr)); } if (config_isparamset(RUParamList.paramarray[j], RU_SDR_CLK_SRC)) { if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "internal") == 0) { - RC.ru[j]->openair0_cfg.clock_source = internal; + ru[j]->openair0_cfg.clock_source = internal; LOG_D(PHY, "RU clock source set as internal\n"); } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "external") == 0) { - RC.ru[j]->openair0_cfg.clock_source = external; + ru[j]->openair0_cfg.clock_source = external; LOG_D(PHY, "RU clock source set as external\n"); } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "gpsdo") == 0) { - RC.ru[j]->openair0_cfg.clock_source = gpsdo; + ru[j]->openair0_cfg.clock_source = gpsdo; LOG_D(PHY, "RU clock source set as gpsdo\n"); } else { LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr)); } } else { - RC.ru[j]->openair0_cfg.clock_source = unset; + ru[j]->openair0_cfg.clock_source = unset; } if (config_isparamset(RUParamList.paramarray[j], RU_SDR_TME_SRC)) { if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "internal") == 0) { - RC.ru[j]->openair0_cfg.time_source = internal; + ru[j]->openair0_cfg.time_source = internal; LOG_D(PHY, "RU time source set as internal\n"); } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "external") == 0) { - RC.ru[j]->openair0_cfg.time_source = external; + ru[j]->openair0_cfg.time_source = external; LOG_D(PHY, "RU time source set as external\n"); } else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_TME_SRC].strptr), "gpsdo") == 0) { - RC.ru[j]->openair0_cfg.time_source = gpsdo; + ru[j]->openair0_cfg.time_source = gpsdo; LOG_D(PHY, "RU time source set as gpsdo\n"); } else { LOG_E(PHY, "Erroneous RU time source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr)); } } else { - RC.ru[j]->openair0_cfg.time_source = unset; + ru[j]->openair0_cfg.time_source = unset; } + LOG_I(PHY,"RU %d is_slave=%s\n",j,*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr)); + + if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru[j]->is_slave=1; + else ru[j]->is_slave=0; + + LOG_I(PHY,"RU %d ota_sync_enabled=%s\n",j,*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr)); + + if (strcmp(*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr), "yes") == 0) ru[j]->ota_sync_enable=1; + else ru[j]->ota_sync_enable=0; + if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) { if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) { - RC.ru[j]->if_south = LOCAL_RF; - RC.ru[j]->function = eNodeB_3GPP; - RC.ru[j]->state = RU_RUN; - LOG_I(PHY,"Setting function for RU %d to eNodeB_3GPP\n",j); + ru[j]->if_south = LOCAL_RF; + ru[j]->function = eNodeB_3GPP; + ru[j]->state = RU_RUN; + printf("Setting function for RU %d to eNodeB_3GPP\n",j); } else { - RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); - RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); - RC.ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr)); - RC.ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr); - RC.ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr); + ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); + ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); + ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr)); + ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr); + ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr); // Check if control port set if (!(config_isparamset(RUParamList.paramarray[j],RU_REMOTE_PORTC_IDX)) ) { LOG_I(PHY,"Removing control port for RU %d\n",j); - RC.ru[j]->has_ctrl_prt = 0; + ru[j]->has_ctrl_prt = 0; } else { - RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); - RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); - LOG_I(PHY," Control port %u \n",RC.ru[j]->eth_params.my_portc); + ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); + ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); + LOG_I(PHY," Control port %u \n",ru[j]->eth_params.my_portc); } if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) { - RC.ru[j]->if_south = LOCAL_RF; - RC.ru[j]->function = NGFI_RRU_IF5; - RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE; + ru[j]->if_south = LOCAL_RF; + ru[j]->function = NGFI_RRU_IF5; + ru[j]->eth_params.transp_preference = ETH_UDP_MODE; LOG_I(PHY,"Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j); } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) { - RC.ru[j]->if_south = LOCAL_RF; - RC.ru[j]->function = NGFI_RRU_IF5; - RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE; + ru[j]->if_south = LOCAL_RF; + ru[j]->function = NGFI_RRU_IF5; + ru[j]->eth_params.transp_preference = ETH_RAW_MODE; LOG_I(PHY,"Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j); } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) { - RC.ru[j]->if_south = LOCAL_RF; - RC.ru[j]->function = NGFI_RRU_IF4p5; - RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE; - RC.ru[j]->has_ctrl_prt =1; + ru[j]->if_south = LOCAL_RF; + ru[j]->function = NGFI_RRU_IF4p5; + ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE; + ru[j]->has_ctrl_prt =1; LOG_I(PHY,"Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j); } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) { - RC.ru[j]->if_south = LOCAL_RF; - RC.ru[j]->function = NGFI_RRU_IF4p5; - RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE; - RC.ru[j]->has_ctrl_prt =1; + ru[j]->if_south = LOCAL_RF; + ru[j]->function = NGFI_RRU_IF4p5; + ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE; + ru[j]->has_ctrl_prt =1; LOG_I(PHY,"Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j); } - - LOG_I(PHY,"RU %d is_slave=%s\n",j,*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr)); - - if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) RC.ru[j]->is_slave=1; - else RC.ru[j]->is_slave=0; - - LOG_I(PHY,"RU %d ota_sync_enabled=%s\n",j,*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr)); - - if (strcmp(*(RUParamList.paramarray[j][RU_OTA_SYNC_ENABLE_IDX].strptr), "yes") == 0) RC.ru[j]->ota_sync_enable=1; - else RC.ru[j]->ota_sync_enable=0; } - RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);; - RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr); - RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; + ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);; + ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr); + ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt; /* sf_extension is in unit of samples for 30.72MHz here, has to be scaled later */ - RC.ru[j]->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr); + ru[j]->sf_extension = *(RUParamList.paramarray[j][RU_SF_EXTENSION_IDX].uptr); - for (i=0; inum_bands; i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; + for (i=0; inum_bands; i++) ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i]; } //strcmp(local_rf, "yes") == 0 -else { + else { LOG_I(PHY,"RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr)); - RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); - RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); - RC.ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr)); - RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); - RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); - RC.ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr); - RC.ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr); + ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr)); + ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr)); + ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr)); + ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr); + ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr); + ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr); + ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr); if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) { - RC.ru[j]->if_south = REMOTE_IF5; - RC.ru[j]->function = NGFI_RAU_IF5; - RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE; + ru[j]->if_south = REMOTE_IF5; + ru[j]->function = NGFI_RAU_IF5; + ru[j]->eth_params.transp_preference = ETH_UDP_MODE; } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_ecpri_if5") == 0) { - RC.ru[j]->if_south = REMOTE_IF5; - RC.ru[j]->function = NGFI_RAU_IF5; - RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF5_ECPRI_MODE; + ru[j]->if_south = REMOTE_IF5; + ru[j]->function = NGFI_RAU_IF5; + ru[j]->eth_params.transp_preference = ETH_UDP_IF5_ECPRI_MODE; } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) { - RC.ru[j]->if_south = REMOTE_IF5; - RC.ru[j]->function = NGFI_RAU_IF5; - RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE; + ru[j]->if_south = REMOTE_IF5; + ru[j]->function = NGFI_RAU_IF5; + ru[j]->eth_params.transp_preference = ETH_RAW_MODE; } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) { - RC.ru[j]->if_south = REMOTE_IF4p5; - RC.ru[j]->function = NGFI_RAU_IF4p5; - RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE; - RC.ru[j]->has_ctrl_prt = 1; + ru[j]->if_south = REMOTE_IF4p5; + ru[j]->function = NGFI_RAU_IF4p5; + ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE; + ru[j]->has_ctrl_prt = 1; } else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) { - RC.ru[j]->if_south = REMOTE_IF4p5; - RC.ru[j]->function = NGFI_RAU_IF4p5; - RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE; - RC.ru[j]->has_ctrl_prt = 1; + ru[j]->if_south = REMOTE_IF4p5; + ru[j]->function = NGFI_RAU_IF4p5; + ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE; + ru[j]->has_ctrl_prt = 1; - if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) RC.ru[j]->is_slave=1; - else RC.ru[j]->is_slave=0; + if (strcmp(*(RUParamList.paramarray[j][RU_IS_SLAVE_IDX].strptr), "yes") == 0) ru[j]->is_slave=1; + else ru[j]->is_slave=0; } } /* strcmp(local_rf, "yes") != 0 */ - RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr); - RC.ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr); - RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); - RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr); + ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr); + ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr); + ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr); + ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_RX_IDX].uptr); + *ru_mask= (*ru_mask)|(1< #include "rt_wrapper.h" +#include #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all @@ -56,6 +57,8 @@ //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all +#include + #include "PHY/phy_vars.h" #include "SCHED/sched_common_vars.h" #include "LAYER2/MAC/mac_vars.h" @@ -100,6 +103,8 @@ pthread_cond_t nfapi_sync_cond; pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex +msc_interface_t msc_interface; + uint16_t sf_ahead=4; @@ -161,16 +166,19 @@ void sendFs6Ulharq(enum pckType type, int UEid, PHY_VARS_eNB *eNB, LTE_eNB_UCI * AssertFatal(false, "Must not be called in this context\n"); } +RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mask,pthread_mutex_t *ru_mutex,pthread_cond_t *ru_cond); + extern void reset_opp_meas(void); extern void print_opp_meas(void); extern void init_eNB_afterRU(void); +RU_t **RCconfig_RU(int nb_RU,int nb_L1_inst,PHY_VARS_eNB ***eNB,uint64_t *ru_mask,pthread_mutex_t *ru_mutex,pthread_cond_t *ru_cond); + int transmission_mode=1; int emulate_rf = 0; int numerology = 0; -int usrp_tx_thread = 0; THREAD_STRUCT thread_struct; /* struct for ethernet specific parameters given in eNB conf file */ @@ -424,7 +432,6 @@ int stop_L1L2(module_id_t enb_id) { * Restart the lte-softmodem after it has been soft-stopped with stop_L1L2() */ int restart_L1L2(module_id_t enb_id) { - RU_t *ru = RC.ru[enb_id]; int cc_id; MessageDef *msg_p = NULL; LOG_W(ENB_APP, "restarting lte-softmodem\n"); @@ -435,10 +442,12 @@ int restart_L1L2(module_id_t enb_id) { for (cc_id = 0; cc_id < RC.nb_L1_CC[enb_id]; cc_id++) { RC.eNB[enb_id][cc_id]->configured = 0; + for (int ru_id=0;ru_idnum_RU;ru_id++) { + int ru_idx = RC.eNB[enb_id][cc_id]->RU_list[ru_id]->idx; + RC.ru_mask |= (1 << ru_idx); + set_function_spec_param(RC.ru[ru_idx]); + } } - - RC.ru_mask |= (1 << ru->idx); - set_function_spec_param(RC.ru[enb_id]); /* reset the list of connected UEs in the MAC, since in this process with * loose all UEs (have to reconnect) */ init_UE_info(&RC.mac[enb_id]->UE_info); @@ -459,9 +468,15 @@ int restart_L1L2(module_id_t enb_id) { /* TODO XForms might need to be restarted, but it is currently (09/02/18) * broken, so we cannot test it */ wait_eNBs(); - init_RU_proc(ru); - ru->rf_map.card = 0; - ru->rf_map.chain = 0; /* CC_id + chain_offset;*/ + for (int cc_id=0;cc_idnum_RU;ru_id++) { + int ru_idx = RC.eNB[enb_id][cc_id]->RU_list[ru_id]->idx; + + init_RU_proc(RC.ru[ru_idx]); + RC.ru[ru_idx]->rf_map.card = 0; + RC.ru[ru_idx]->rf_map.chain = 0; /* CC_id + chain_offset;*/ + } + } wait_RUs(); init_eNB_afterRU(); printf("Sending sync to all threads\n"); @@ -574,7 +589,7 @@ int main ( int argc, char **argv ) /* We need to read RU configuration before FlexRAN starts so it knows what * splits to report. Actual RU start comes later. */ if (RC.nb_RU > 0 && NFAPI_MODE != NFAPI_MODE_VNF) { - RCconfig_RU(); + RC.ru = RCconfig_RU(RC.nb_RU,RC.nb_L1_inst,RC.eNB,&RC.ru_mask,&RC.ru_mutex,&RC.ru_cond); LOG_I(PHY, "number of L1 instances %d, number of RU %d, number of CPU cores %d\n", RC.nb_L1_inst, RC.nb_RU, get_nprocs()); @@ -651,6 +666,7 @@ int main ( int argc, char **argv ) for (int x=0; x < RC.nb_L1_inst; x++) for (int CC_id=0; CC_idproc.L1_proc; + L1_rxtx_proc_t *L1proctx= &RC.eNB[x][CC_id]->proc.L1_proc_tx; L1proc->threadPool=(tpool_t*)malloc(sizeof(tpool_t)); L1proc->respEncode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); L1proc->respDecode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t)); @@ -658,9 +674,11 @@ int main ( int argc, char **argv ) initTpool(get_softmodem_params()->threadPoolConfig, L1proc->threadPool, true); else initTpool("n", L1proc->threadPool, true); - initNotifiedFIFO(L1proc->respEncode); - initNotifiedFIFO(L1proc->respDecode); - RC.eNB[x][CC_id]->proc.L1_proc_tx.threadPool = L1proc->threadPool; + initNotifiedFIFO(L1proc->respEncode); + initNotifiedFIFO(L1proc->respDecode); + L1proctx->threadPool=L1proc->threadPool; + L1proctx->respEncode=L1proc->respEncode; + L1proctx->nbEncode=L1proc->nbEncode; } @@ -675,7 +693,7 @@ int main ( int argc, char **argv ) // some initialization is necessary and init_ru_vnf do this. if (RC.nb_RU >0 && NFAPI_MODE!=NFAPI_MODE_VNF) { printf("Initializing RU threads\n"); - init_RU(get_softmodem_params()->rf_config_file,get_softmodem_params()->send_dmrs_sync); + init_RU(RC.ru,RC.nb_RU,RC.eNB,RC.nb_L1_inst,RC.nb_L1_CC,get_softmodem_params()->rf_config_file,get_softmodem_params()->send_dmrs_sync); for (ru_id=0; ru_idrf_map.card=0; @@ -727,7 +745,7 @@ int main ( int argc, char **argv ) fflush(stderr); // end of CI modifications //getchar(); - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) load_softscope("enb",NULL); itti_wait_tasks_end(); oai_exit=1; @@ -735,7 +753,7 @@ int main ( int argc, char **argv ) // stop threads if (RC.nb_inst == 0 || !NODE_IS_CU(node_type)) { - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) end_forms(); LOG_I(ENB_APP,"stopping MODEM threads\n"); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 1c537dabe3..a1b261f263 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -97,7 +97,6 @@ /*-------------------------------------------------------------------------------------------------------------------------------------------------------*/ #define CMDLINE_UEPARAMS_DESC { \ - {"siml1", CONFIG_HLP_SIML1, PARAMFLAG_BOOL, iptr:&simL1flag, defintval:0, TYPE_INT, 0}, \ {"U", CONFIG_HLP_NUMUE, 0, u16ptr:&NB_UE_INST, defuintval:1, TYPE_UINT16, 0}, \ {"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:130, TYPE_DOUBLE, 0}, \ {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \ @@ -171,7 +170,7 @@ extern void init_RU_proc(RU_t *ru); extern void stop_RU(int nb_ru); extern void kill_RU_proc(RU_t *ru); extern void set_function_spec_param(RU_t *ru); -extern void init_RU(char *, int send_dmrssync); +extern void init_RU(RU_t **rup,int nb_RU,PHY_VARS_eNB ***eNBp,int nb_L1,int *nb_CC,char *rf_config_file, int send_dmrssync); // In lte-ue.c extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg); @@ -199,7 +198,6 @@ extern void init_te_thread(PHY_VARS_eNB *); extern void kill_td_thread(PHY_VARS_eNB *); extern void kill_te_thread(PHY_VARS_eNB *); -extern void RCConfig_sim(void); extern void init_ocm(void); extern void init_ue_devices(PHY_VARS_UE *); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 407756e20f..cc084d18c5 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -95,6 +95,7 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP); +int tx_req_num_elems; extern uint16_t sf_ahead; //extern int tx_req_UE_MAC1(); @@ -181,9 +182,8 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, uint8_t abstraction_flag) { - PHY_VARS_UE *ue = (PHY_VARS_UE *)malloc(sizeof(PHY_VARS_UE)); - memset(ue,0,sizeof(PHY_VARS_UE)); - + PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE)); + AssertFatal(ue,""); if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS)); } @@ -283,13 +283,7 @@ void init_UE(int nb_inst, LOG_I(PHY,"Allocating UE context %d\n",inst); - if ( !IS_SOFTMODEM_SIML1 ) PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0); - else { - // needed for memcopy below. these are not used in the RU, but needed for UE - RC.ru[0]->frame_parms->nb_antennas_rx = fp0->nb_antennas_rx; - RC.ru[0]->frame_parms->nb_antennas_tx = fp0->nb_antennas_tx; - PHY_vars_UE_g[inst][0] = init_ue_vars(RC.ru[0]->frame_parms,inst,0); - } + PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0); // turn off timing control loop in UE PHY_vars_UE_g[inst][0]->no_timing_correction = timing_correction; @@ -371,17 +365,13 @@ void init_UE(int nb_inst, */ UE->N_TA_offset = 0; - if (IS_SOFTMODEM_SIML1 ) init_ue_devices(UE); - LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); init_UE_threads(inst); - if (!IS_SOFTMODEM_SIML1 ) { - ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]); + ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]); - if (ret !=0) { - exit_fun("Error loading device library"); - } + if (ret !=0) { + exit_fun("Error loading device library"); } UE->rfdevice.host_type = RAU_HOST; diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 9bf179efb9..1079f89c3f 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -86,6 +86,7 @@ #include "lte-softmodem.h" +msc_interface_t msc_interface; /* temporary compilation wokaround (UE/eNB split */ uint16_t sf_ahead; @@ -168,7 +169,6 @@ extern void get_uethreads_params(void); int transmission_mode=1; -int usrp_tx_thread = 0; char *usrp_args=NULL; @@ -193,6 +193,9 @@ int oaisim_flag=0; */ uint8_t abstraction_flag=0; +// needed for pdcp.c +RAN_CONTEXT_t RC; + /* forward declarations */ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); @@ -286,7 +289,6 @@ static void get_options(void) { int dumpframe=0; int timingadv=0; uint8_t nfapi_mode = NFAPI_MONOLITHIC; - int simL1flag =0; set_default_frame_parms(frame_parms); CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); @@ -300,8 +302,6 @@ static void get_options(void) { config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL); nfapi_setmode(nfapi_mode); - if (simL1flag) - set_softmodem_optmask(SOFTMODEM_SIML1_BIT); if (loopfile != NULL) { printf("Input file for hardware emulation: %s",loopfile); @@ -574,11 +574,6 @@ int main( int argc, char **argv ) { EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1; printf("Running with %d UE instances\n",NB_UE_INST); - if (NB_UE_INST > 1 && (!IS_SOFTMODEM_SIML1) && NFAPI_MODE!=NFAPI_UE_STUB_PNF) { - printf("Running with more than 1 UE instance and simL1 is not active, this will result in undefined behaviour for now, exiting.\n"); - abort(); - } - // Checking option of nums_ue_thread. if(NB_THREAD_INST < 1) { printf("Running with 0 UE rxtx thread, exiting.\n"); @@ -649,9 +644,6 @@ int main( int argc, char **argv ) { } } else init_openair0(frame_parms[0],(int)rx_gain[0][0]); - if (IS_SOFTMODEM_SIML1 ) { - RCConfig_sim(); - } cpuf=get_cpu_freq_GHz(); @@ -753,12 +745,8 @@ int main( int argc, char **argv ) { //p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX; - if (IS_SOFTMODEM_SIML1 ) { - init_ocm(); - PHY_vars_UE_g[0][0]->no_timing_correction = 1; - } - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) load_softscope("ue",NULL); config_check_unknown_cmdlineopt(CONFIG_CHECKALLSECTIONS); @@ -783,7 +771,7 @@ int main( int argc, char **argv ) { printf("oai_exit=%d\n",oai_exit); // stop threads - if(IS_SOFTMODEM_DOFORMS) + if(IS_SOFTMODEM_DOSCOPE) end_forms(); printf("stopping MODEM threads\n"); diff --git a/targets/RT/USER/rfsim.c b/targets/RT/USER/rfsim.c index eb380b9518..2bd95507c3 100644 --- a/targets/RT/USER/rfsim.c +++ b/targets/RT/USER/rfsim.c @@ -361,6 +361,7 @@ void init_ocm(void) { DS_TDL, 0.0, 0, + 0, 0); random_channel(sim.RU2UE[ru_id][UE_id][CC_id],0); LOG_D(OCM,"[SIM] Initializing channel (%s) from UE %d to ru %d\n", "AWGN", UE_id, ru_id); @@ -374,6 +375,7 @@ void init_ocm(void) { DS_TDL, 0.0, 0, + 0, 0); random_channel(sim.UE2RU[UE_id][ru_id][CC_id],0); // to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed. diff --git a/targets/RT/USER/rt_wrapper.c b/targets/RT/USER/rt_wrapper.c index 5bdbbb36e3..b051868825 100644 --- a/targets/RT/USER/rt_wrapper.c +++ b/targets/RT/USER/rt_wrapper.c @@ -44,6 +44,7 @@ #include #include "rt_wrapper.h" #include +#include #include "openair1/PHY/defs_common.h" diff --git a/targets/RT/USER/ru_control.c b/targets/RT/USER/ru_control.c index 7ac6a8913e..95b5ce6155 100644 --- a/targets/RT/USER/ru_control.c +++ b/targets/RT/USER/ru_control.c @@ -61,30 +61,17 @@ #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/LTE_TRANSPORT/if5_tools.h" -#include "PHY/phy_extern.h" -#include "LAYER2/MAC/mac_extern.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" #include "SCHED/sched_eNB.h" #include "PHY/LTE_ESTIMATION/lte_estimation.h" #include "PHY/INIT/phy_init.h" -#include "LAYER2/MAC/mac.h" -#include "LAYER2/MAC/mac_extern.h" -#include "LAYER2/MAC/mac_proto.h" -#include "RRC/LTE/rrc_extern.h" -#include "PHY_INTERFACE/phy_interface.h" - #include "common/utils/LOG/log.h" -#include "UTIL/OTG/otg_tx.h" -#include "UTIL/OTG/otg_externs.h" -#include "UTIL/MATH/oml.h" -#include "UTIL/OPT/opt.h" -#include "enb_config.h" int attach_rru(RU_t *ru); -void configure_ru(int idx, void *arg); -void configure_rru(int idx, void *arg); +void configure_ru(RU_t *ru, void *arg); +void configure_rru(RU_t *ru, void *arg); void fill_rf_config(RU_t *ru, char *rf_config_file); void* ru_thread_control( void* param ); @@ -164,7 +151,7 @@ int send_capab(RU_t *ru) cap->FH_fmt = MBP_IF5; break; default: - AssertFatal(1==0,"RU_function is unknown %d\n",RC.ru[0]->function); + AssertFatal(1==0,"RU_function is unknown %d\n",ru->function); break; } cap->num_bands = ru->num_bands; @@ -224,7 +211,7 @@ int attach_rru(RU_t *ru) LOG_E(PHY,"Received incorrect message %d from RRU %d\n",rru_config_msg.type,ru->idx); } } - configure_ru(ru->idx, + configure_ru(ru, (RRU_capabilities_t *)&rru_config_msg.msg[0]); rru_config_msg.type = RRU_config; @@ -296,7 +283,7 @@ int connect_rau(RU_t *ru) cap->FH_fmt = MBP_IF5; break; default: - AssertFatal(1==0,"RU_function is unknown %d\n",RC.ru[0]->function); + AssertFatal(1==0,"RU_function is unknown %d\n",ru->function); break; } cap->num_bands = ru->num_bands; @@ -335,7 +322,7 @@ int connect_rau(RU_t *ru) ((RRU_config_t *)&rru_config_msg.msg[0])->prach_FreqOffset[0], ((RRU_config_t *)&rru_config_msg.msg[0])->prach_ConfigIndex[0]); - configure_rru(ru->idx, + configure_rru(ru, (void*)&rru_config_msg.msg[0]); configuration_received = 1; } @@ -388,21 +375,20 @@ int check_capabilities(RU_t *ru, return(-1); } -void configure_ru(int idx, +void configure_ru(RU_t *ru, void *arg) { - RU_t *ru = RC.ru[idx]; RRU_config_t *config = (RRU_config_t *)arg; RRU_capabilities_t *capabilities = (RRU_capabilities_t*)arg; int ret; - LOG_I(PHY, "Received capabilities from RRU %d\n",idx); + LOG_I(PHY, "Received capabilities from RRU %d\n",ru->idx); if (capabilities->FH_fmt < MAX_FH_FMTs) LOG_I(PHY, "RU FH options %s\n",rru_format_options[capabilities->FH_fmt]); AssertFatal((ret=check_capabilities(ru,capabilities)) == 0, - "Cannot configure RRU %d, check_capabilities returned %d\n", idx,ret); + "Cannot configure RRU %d, check_capabilities returned %d\n", ru->idx,ret); // take antenna capabilities of RRU ru->nb_tx = capabilities->nb_tx[0]; ru->nb_rx = capabilities->nb_rx[0]; @@ -440,11 +426,10 @@ void configure_ru(int idx, phy_init_RU(ru); } -void configure_rru(int idx, +void configure_rru(RU_t *ru, void *arg) { RRU_config_t *config = (RRU_config_t *)arg; - RU_t *ru = RC.ru[idx]; ru->frame_parms->eutra_band = config->band_list[0]; ru->frame_parms->dl_CarrierFreq = config->tx_freq[0]; @@ -486,7 +471,6 @@ void configure_rru(int idx, static int send_update_rru(RU_t * ru, LTE_DL_FRAME_PARMS * fp){ //ssize_t msg_len/*,len*/; int i; - //LTE_DL_FRAME_PARMS *fp = &RC.eNB[0][0]->frame_parms; RRU_CONFIG_msg_t rru_config_msg; memset((void *)&rru_config_msg,0,sizeof(rru_config_msg)); rru_config_msg.type = RRU_config_update; @@ -535,7 +519,7 @@ void* ru_thread_control( void* param ) send_tick(ru); if (ru->state == RU_RUN && ru->if_south != LOCAL_RF){ - LTE_DL_FRAME_PARMS *fp = &RC.eNB[0][0]->frame_parms; + LTE_DL_FRAME_PARMS *fp = &ru->eNB_list[0]->frame_parms; LOG_D(PHY,"Check MBSFN SF changes\n"); if(fp->num_MBSFN_config != ru_sf_update){ ru_sf_update = fp->num_MBSFN_config; @@ -579,7 +563,7 @@ void* ru_thread_control( void* param ) ((RRU_capabilities_t*)&rru_config_msg.msg[0])->nb_tx[0], ((RRU_capabilities_t*)&rru_config_msg.msg[0])->nb_rx[0]); - configure_ru(ru->idx,(RRU_capabilities_t *)&rru_config_msg.msg[0]); + configure_ru(ru,(RRU_capabilities_t *)&rru_config_msg.msg[0]); // send config if (send_config(ru,rru_config_msg) == 0) ru->state = RU_CONFIG; @@ -603,7 +587,7 @@ void* ru_thread_control( void* param ) ((RRU_config_t *)&rru_config_msg.msg[0])->prach_ConfigIndex[0]); ru->frame_parms = calloc(1, sizeof(*ru->frame_parms)); - configure_rru(ru->idx, (void*)&rru_config_msg.msg[0]); + configure_rru(ru, (void*)&rru_config_msg.msg[0]); fill_rf_config(ru,ru->rf_config_file); @@ -652,10 +636,10 @@ void* ru_thread_control( void* param ) LOG_I(PHY, "Signaling main thread that RU %d (is_slave %d) is ready in state %s\n",ru->idx,ru->is_slave,ru_states[ru->state]); - pthread_mutex_lock(&RC.ru_mutex); - RC.ru_mask &= ~(1<idx); - pthread_cond_signal(&RC.ru_cond); - pthread_mutex_unlock(&RC.ru_mutex); + pthread_mutex_lock(ru->ru_mutex); + *ru->ru_mask &= ~(1<idx); + pthread_cond_signal(ru->ru_cond); + pthread_mutex_unlock(ru->ru_mutex); wait_sync("ru_thread_control"); @@ -710,10 +694,10 @@ void* ru_thread_control( void* param ) if (ru->state == RU_READY){ LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx); - pthread_mutex_lock(&RC.ru_mutex); - RC.ru_mask &= ~(1<idx); - pthread_cond_signal(&RC.ru_cond); - pthread_mutex_unlock(&RC.ru_mutex); + pthread_mutex_lock(ru->ru_mutex); + *ru->ru_mask &= ~(1<idx); + pthread_cond_signal(ru->ru_cond); + pthread_mutex_unlock(ru->ru_mutex); wait_sync("ru_thread_control"); @@ -736,7 +720,7 @@ void* ru_thread_control( void* param ) break; case RRU_sync_ok: //RAU - if (ru->if_south == LOCAL_RF) LOG_E(PHY,"Received RRU_config_ok msg...Ignoring\n"); + if (ru->if_south == LOCAL_RF) LOG_E(PHY,"Received RRU_sync_ok msg...Ignoring\n"); else{ if (ru->is_slave == 1){ printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Received RRU_sync_ok from RRU %d\n",ru->idx);