X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=o-du%2Fphy.git;a=blobdiff_plain;f=fhi_lib%2Flib%2Fapi%2Fxran_pkt_up.h;fp=fhi_lib%2Flib%2Fapi%2Fxran_pkt_up.h;h=a2399f09d6f231fe1491bc3441057e7d4f9c70b4;hp=0000000000000000000000000000000000000000;hb=4745e5c88ba931c6d71cb6d8c681f76cf364eac5;hpb=59f84608ec15c016958a6e0e0ddd813f376c0925 diff --git a/fhi_lib/lib/api/xran_pkt_up.h b/fhi_lib/lib/api/xran_pkt_up.h new file mode 100644 index 0000000..a2399f0 --- /dev/null +++ b/fhi_lib/lib/api/xran_pkt_up.h @@ -0,0 +1,138 @@ +/****************************************************************************** +* +* Copyright (c) 2019 Intel. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*******************************************************************************/ + + +/** + * @brief Definitions and support functions to process XRAN packet + * @file xran_pkt_up.h + * @ingroup group_source_xran + * @author Intel Corporation + **/ + +/** + ***************************************************************************** + * @file xran_pkt_up.h + * + * @defgroup xran_up_pkt U-Plane XRAN Packet definitions and functions + * @ingroup xran + * + * @description + * Structures relevant to U-plane packets only (data now only) + *****************************************************************************/ +#ifndef _XRAN_PKT_UP_H_ +#define _XRAN_PKT_UP_H_ + +#include "xran_pkt.h" + +#define IQ_PAIR_NUM_IN_RB 12 +#define MAX_DATA_SECTIONS_NUM 273 +#define MAX_IQ_BIT_WIDTH 16 + +/* currently library supports I and Q sizes of 8 and 16 bits each */ +#define IQ_BITS MAX_IQ_BIT_WIDTH + +/* + * Structure holding data section header fields + * It is repeated for every section ID in xRAN packet + */ + +/** + ****************************************************************************** + * @ingroup xran_up_pkt + * + * @description + * Structure holding data section header fields + * It is repeated for every section ID in xRAN packet + * 5.4.5 Coding of Information Elements - Application Layer, Sections + * for U-plane as per 6.3.2 DL/UL Data + *****************************************************************************/ +struct data_section_hdr { + union { + uint32_t all_bits; + struct { + uint32_t num_prbu:8; /**< 5.4.5.6 number of contiguous PRBs per control section */ + uint32_t start_prbu:10; /**< 5.4.5.4 starting PRB of control section */ + uint32_t sym_inc:1; /**< 5.4.5.3 symbol number increment command XRAN_SYMBOLNUMBER_xxxx */ + uint32_t rb:1; /**< 5.4.5.2 resource block indicator, XRAN_RBIND_xxx */ + uint32_t sect_id:12; /**< 5.4.5.1 section identifier */ + }; + }fields; + } __attribute__((__packed__)); + + +/* + ****************************************************************************** + * @ingroup xran_up_pkt + * + * @description + * Structure holds compression header structure and field reserved for future use. + * reserved goes always with udCompHdr in u-plane pkt + * U-plane as per 6.3.2 DL/UL Data + *****************************************************************************/ +struct data_section_compression_hdr +{ + struct compression_hdr ud_comp_hdr; + uint8_t rsrvd; /**< This parameter provides 1 byte for future definition, + should be set to all zeros by the sender and ignored by the receiver. + This field is only present when udCompHdr is present, and is absent when + the static IQ format and compression method is configured via the M-Plane */ + + /* TODO: support for Block Floating Point compression */ + /* udCompMeth 0000b = no compression absent*/ +}; + +/* + ****************************************************************************** + * @ingroup xran_up_pkt + * + * @description + * Structure holds the compression parameters by the compression header. + * may not be present by udCompMeth in 6.3.3.13 + *****************************************************************************/ +union compression_params { + struct block_fl_point { + uint8_t exponent:4; + uint8_t reserved:4; + } blockFlPoint; + struct block_scaling { + uint8_t sblockScaler; + } blockScaling; + struct u_law { + uint8_t compShift:4; + uint8_t compBitWidth:4; + } uLaw; + } __attribute__((__packed__)); + + +/* + ****************************************************************************** + * @ingroup xran_up_pkt + * + * @description + * Structure holds an IQ sample pair + * U-plane as per 6.3.2 DL/UL Data + * Each bit field size is defined with IQ_BITS macro + * Currently supported I and Q sizes are 8 and 16 bits + *****************************************************************************/ +struct rb_map +{ + int16_t i_sample:IQ_BITS; /**< This parameter is the In-phase sample value */ + int16_t q_sample:IQ_BITS; /**< This parameter is the Quadrature sample value */ +} __rte_packed;; + +#endif