Section: 5.5.2.9 Measurement gap configuration
Content: The UE shall: 1> if gapFR1 is set to setup: 2> if an FR1 measurement gap configuration configured by gapFR1 is already setup, release the FR1 measurement gap configuration; 2> setup the FR1 measurement gap configuration indicated by the gapFR1 in accordance with the received gapOffset, i.e., the first subframe of each gap occurs at an SFN and subframe meeting the following condition: SFN mod T = FLOOR(gapOffset/10); subframe = gapOffset mod 10; with T = MGRP/10 as defined in TS 38.133[ NR; Requirements for support of radio resource management ]  [14]; 2> apply the specified timing advance mgta to the gap occurrences calculated above (i.e. the UE starts the measurement mgta ms before the gap subframe occurrences); 1> else if gapFR1 is set to release: 2> release the FR1 measurement gap configuration configured by gapFR1; 1> if gapFR2 is set to setup: 2> if an FR2 measurement gap configuration configured by gapFR2 is already setup, release the FR2 measurement gap configuration; 2> setup the FR2 measurement gap configuration indicated by the gapFR2 in accordance with the received gapOffset, i.e., the first subframe of each gap occurs at an SFN and subframe meeting the following condition: SFN mod T = FLOOR(gapOffset/10); subframe = gapOffset mod 10; with T = MGRP/10 as defined in TS 38.133[ NR; Requirements for support of radio resource management ]  [14]; 2> apply the specified timing advance mgta to the gap occurrences calculated above (i.e. the UE starts the measurement mgta ms before the gap subframe occurrences); 1> else if gapFR2 is set to release: 2> release the FR2 measurement gap configuration configured by gapFR2; 1> if gapUE is set to setup: 2> if a per UE measurement gap configuration configured by gapUE is already setup, release the per UE measurement gap configuration; 2> setup the per UE measurement gap configuration indicated by the gapUE in accordance with the received gapOffset, i.e., the first subframe of each gap occurs at an SFN and subframe meeting the following condition: SFN mod T = FLOOR(gapOffset/10); subframe = gapOffset mod 10; with T = MGRP/10 as defined in TS 38.133[ NR; Requirements for support of radio resource management ]  [14]; 2> apply the specified timing advance mgta to the gap occurrences calculated above (i.e. the UE starts the measurement mgta ms before the gap subframe occurrences); 1> else if gapUE is set to release: 2> release the per UE measurement gap configuration configured by gapUE. 1> for each measGapId included in the received gapToReleaseList: 2> release the measurement gap configuration associated with the measGapId; 1> for each measPosPreConfigGapId included in the received posMeasGapPreConfigToReleaseList: 2> release the measurement gap configuration associated with the measPosPreConfigGapId; 1> for each GapConfig received in gapToAddModList: 2> setup measurement gap configuration indicated by the GapConfig in accordance with the received gapOffset, i.e., the first subframe of each gap occurs at an SFN and subframe meeting the following condition: SFN mod T = FLOOR(gapOffset/10); subframe = gapOffset mod 10; with T = MGRP/10 as defined in TS 38.133[ NR; Requirements for support of radio resource management ]  [14]; 2> apply the specified timing advance mgta to the gap occurrences calculated above (i.e. the UE starts the measurement mgta ms before the gap subframe occurrences); 2> apply the measurement gap as per UE measurement gap, FR1 measurement gap, or FR2 measurement gap according to the gapType indicated by the GapConfig; 2> associate the measurement gap with the measGapId indicated by the GapConfig; 2> if gapSharing in the GapConfig is present: 3> setup the gap sharing configuration for the measurement gap in accordance with the received gapSharing as defined in TS 38.133[ NR; Requirements for support of radio resource management ]  [14]; 2> else: 3> release the gap sharing configuration (if configured) for the measurement gap; 1> for each PosGapConfig received in PosMeasGapPreConfigToAddModList: 2> if a measurement gap configuration associated with the measPosPreConfigGapId indicated by the PosGapConfig is already setup: 3> release the measurement gap configuration; 2> setup measurement gap configuration indicated by the PosGapConfig in accordance with the received gapOffset, i.e., the first subframe of each gap occurs at an SFN and subframe meeting the following condition: SFN mod T = FLOOR(gapOffset/10); subframe = gapOffset mod 10; with T = MGRP/10 as defined in TS 38.133[ NR; Requirements for support of radio resource management ]  [14]; 2> apply the specified timing advance mgta to the gap occurrences calculated above (i.e. the UE starts the measurement mgta ms before the gap subframe occurrences); 2> configure the measurement gap as indicated by gapType; 1> for each FR1, FR2, and per UE measurement gap that is setup: 2> if the measurement gap is configured by GapConfig and preConfigInd-r17 in the corresponding GapConfig is present: 3> determine whether the measurement gap is activated or not according to TS 38.133[ NR; Requirements for support of radio resource management ]  [14]; 2> else if the measurement gap is configured by PosGapConfig: 3> consider the measurement gap to be deactivated; 2> else: 3> consider the measurement gap to be activated. NOTE 1: For FR2 gap configuration with synchronous CA, for the UE in NE-DC or NR-DC, the SFN and subframe of the serving cell indicated by the refServCellIndicator is used in the gap calculation. Otherwise, the SFN and subframe of a serving cell on FR2 frequency is used in the gap calculation NOTE 2: For FR1 gap or per UE gap configuration, for the UE in NE-DC or NR-DC, the SFN and subframe of the serving cell indicated by the refServCellIndicator in is used in the gap calculation. Otherwise, the SFN and subframe of the PCell is used in the gap calculation. NOTE 3: For FR2 gap configuration with asynchronous CA, for the UE in NE-DC or NR-DC, the SFN and subframe of the serving cell indicated by the refServCellIndicator and refFR2ServCellAsyncCA is used in the gap calculation. Otherwise, the SFN and subframe of a serving cell on FR2 frequency indicated by the refFR2ServCellAsyncCA is used in the gap calculation