Main Content

nrMACSubPDU

Generate NR MAC subPDU

    Description

    example

    macSubPDU = nrMACSubPDU(linkDir,msgIndex,payload) generates a medium access control (MAC) sub protocol data unit (subPDU), as defined in 3GPP TS 38.321 Section 6.1.2 [1].

    This syntax is applicable for MAC subPDUs with MAC service data unit (SDU) or MAC control element (CE) as payload.

    example

    macSubPDU = nrMACSubPDU(paddingLength) generates a padding MAC subPDU for the uplink or downlink direction.

    For this syntax, the logical channel ID (LCID) value is set to 63 in the subheader.

    Examples

    collapse all

    Generate a MAC subPDU for service data unit (SDU) payload of 6 bytes in uplink direction. Specify the LCID index value as 25.

    linkDir = 1;
    msgIndex = 25;
    payload = [64;21;202;238;10;169]; % 6 bytes

    Generate the MAC subPDU.

    macSubPDU = nrMACSubPDU(linkDir,msgIndex,payload)
    macSubPDU = 8×1
    
        25
         6
        64
        21
       202
       238
        10
       169
    
    

    Generate a MAC subPDU for control element (CE) payload of 3 bytes in downlink direction. Specify the eLCID index value as 310.

    linkDir = 0;
    msgIndex = 310;
    payload = [22;138;244]; % 3 bytes

    Generate the MAC subPDU.

    macSubPDU = nrMACSubPDU(linkDir,msgIndex,payload)
    macSubPDU = 6×1
    
        34
       246
         3
        22
       138
       244
    
    

    Specify the required MAC padding size.

    paddingLength = 4; % In bytes

    Generate the MAC subPDU.

    macSubPDU = nrMACSubPDU(paddingLength)
    macSubPDU = 4×1
    
        63
         0
         0
         0
    
    

    Generate a MAC subPDU in uplink direction. Use the nrMACBSR function to generate a MAC buffer status report (BSR) payload.

    linkDir = 1;
    lcgBufferSize = [0 2000 3000 4000];
    [msgIndex,bsr] = nrMACBSR(lcgBufferSize)
    msgIndex = 62
    
    bsr = 4×1
    
        14
        85
        91
        96
    
    

    Generate a MAC subPDU.

    payload = bsr;
    macSubPDU = nrMACSubPDU(linkDir, msgIndex, payload)
    macSubPDU = 6×1
    
        62
         4
        14
        85
        91
        96
    
    

    Input Arguments

    collapse all

    Transmission direction of the MAC subPDU, specified as one of these values.

    • 0 — Use this value to set the transmission direction to downlink.

    • 1 — Use this value to set the transmission direction to uplink.

    Data Types: double

    Message index, specified as one of these values.

    • Integer in the range [0, 62] — Use this option to represent the logical channel ID (LCID) field of the subheader in a subPDU.

    • Integer in the range [64, 319] — Use this option to represent the one-octet extended logical channel ID (eLCID) field of the subheader in a subPDU. For this case, the LCID value is set to 34.

    • Integer in the range [320, 65855] — Use this option to represent the two-octet eLCID field of the subheader in a subPDU. For this case, the LCID value is set to 33.

    To set msgIndex, refer to these tables specified in 3GPP TS 38.321.

    • For a downlink shared channel (DL-SCH) subPDU, the msgIndex corresponds to the index value specified in 3GPP TS 38.321 Table 6.2.1-1, 6.2.1-1a, or 6.2.1-1b [1].

    • For an uplink shared channel (UL-SCH) subPDU, the msgIndex corresponds to the index value specified in 3GPP TS 38.321 Table 6.2.1-2, 6.2.1-2a, or 6.2.1-2b [1].

    Data Types: double

    MAC payload, specified a vector of octets in decimal format. The payload could be MAC SDU or MAC CE.

    To indicate a MAC CE with an empty payload, set payload to [ ].

    Data Types: double

    Required MAC padding size in bytes, specified as a positive integer.

    Data Types: double

    Output Arguments

    collapse all

    Generated MAC subPDU, returned as a column vector of octets in decimal format.

    Data Types: double

    References

    [1] 3GPP TS 38.321. “NR; Medium Access Control (MAC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2022a