Front Haul Interface Library update to third seed code contribution
[o-du/phy.git] / fhi_lib / lib / api / xran_pkt_up.h
index 39cfc2d..588d3e1 100644 (file)
-/******************************************************************************\r
-*\r
-*   Copyright (c) 2019 Intel.\r
-*\r
-*   Licensed under the Apache License, Version 2.0 (the "License");\r
-*   you may not use this file except in compliance with the License.\r
-*   You may obtain a copy of the License at\r
-*\r
-*       http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-*   Unless required by applicable law or agreed to in writing, software\r
-*   distributed under the License is distributed on an "AS IS" BASIS,\r
-*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-*   See the License for the specific language governing permissions and\r
-*   limitations under the License.\r
-*\r
-*******************************************************************************/\r
-\r
-/**\r
- * @brief Definitions and support functions to process XRAN packet\r
- * @file xran_pkt_up.h\r
- * @ingroup group_source_xran\r
- * @author Intel Corporation\r
- **/\r
-\r
-/**\r
- *****************************************************************************\r
- * @file xran_pkt_up.h\r
- *\r
- * @defgroup xran_up_pkt U-Plane XRAN Packet definitions and functions\r
- * @ingroup xran\r
- *\r
- * @description\r
- *      Structures relevant to U-plane packets only (data now only)\r
- *****************************************************************************/\r
-#ifndef _XRAN_PKT_UP_H_\r
-#define _XRAN_PKT_UP_H_\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#include "xran_pkt.h"\r
-\r
-#define IQ_PAIR_NUM_IN_RB 12\r
-#define MAX_DATA_SECTIONS_NUM 273\r
-#define MAX_IQ_BIT_WIDTH 16\r
-\r
-/* currently library supports I and Q sizes of 8 and 16 bits each */\r
-#define IQ_BITS MAX_IQ_BIT_WIDTH\r
-\r
-/*\r
- * Structure holding data section header fields\r
- * It is repeated for every section ID in xRAN packet\r
- */\r
-\r
-/**\r
- ******************************************************************************\r
- * @ingroup xran_up_pkt\r
- *\r
- * @description\r
- *       Structure holding data section header fields\r
- *       It is repeated for every section ID in xRAN packet\r
- *       5.4.5 Coding of Information Elements - Application Layer, Sections\r
- *       for U-plane as per 6.3.2      DL/UL Data\r
- *****************************************************************************/\r
-struct data_section_hdr {\r
-    union {\r
-        uint32_t all_bits;\r
-        struct {\r
-            uint32_t     num_prbu:8;    /**< 5.4.5.6 number of contiguous PRBs per control section */\r
-            uint32_t     start_prbu:10; /**< 5.4.5.4 starting PRB of control section */\r
-            uint32_t     sym_inc:1;     /**< 5.4.5.3 symbol number increment command XRAN_SYMBOLNUMBER_xxxx */\r
-            uint32_t     rb:1;          /**< 5.4.5.2 resource block indicator, XRAN_RBIND_xxx */\r
-            uint32_t     sect_id:12;    /**< 5.4.5.1 section identifier */\r
-        };\r
-    }fields;\r
-} __rte_packed;\r
-\r
-\r
-/*\r
- ******************************************************************************\r
- * @ingroup xran_up_pkt\r
- *\r
- * @description\r
- *       Structure holds compression header structure and field reserved for future use.\r
- *       reserved goes always with udCompHdr in u-plane pkt\r
- *       U-plane as per 6.3.2   DL/UL Data\r
- *****************************************************************************/\r
-struct data_section_compression_hdr\r
-{\r
-    struct compression_hdr ud_comp_hdr;\r
-    uint8_t rsrvd; /**< This parameter provides 1 byte for future definition,\r
-    should be set to all zeros by the sender and ignored by the receiver.\r
-    This field is only present when udCompHdr is present, and is absent when\r
-    the static IQ format and compression method is configured via the M-Plane */\r
-\r
-    /* TODO: support for Block Floating Point compression */\r
-    /* udCompMeth  0000b = no compression      absent*/\r
-};\r
-\r
-/*\r
- ******************************************************************************\r
- * @ingroup xran_up_pkt\r
- *\r
- * @description\r
- *       Structure holds the compression parameters by the compression header.\r
- *       may not be present by udCompMeth in 6.3.3.13\r
- *****************************************************************************/\r
-union compression_params {\r
-    struct block_fl_point {\r
-        uint8_t exponent:4;\r
-        uint8_t reserved:4;\r
-        } blockFlPoint;\r
-    struct block_scaling {\r
-        uint8_t sblockScaler;\r
-        } blockScaling;\r
-    struct u_law {\r
-        uint8_t compShift:4;\r
-        uint8_t compBitWidth:4;\r
-        } uLaw;\r
-} __rte_packed;\r
-\r
-\r
-/*\r
- ******************************************************************************\r
- * @ingroup xran_up_pkt\r
- *\r
- * @description\r
- *       Structure holds an IQ sample pair\r
- *       U-plane as per 6.3.2   DL/UL Data\r
- *       Each bit field size is defined with IQ_BITS macro\r
- *       Currently supported I and Q sizes are 8 and 16 bits\r
- *****************************************************************************/\r
-struct rb_map\r
-{\r
-    int16_t i_sample:IQ_BITS; /**< This parameter is the In-phase sample value */\r
-    int16_t q_sample:IQ_BITS; /**< This parameter is the Quadrature sample value */\r
-} __rte_packed;\r
-\r
-/**\r
- ******************************************************************************\r
- * @ingroup xran_common_pkt\r
- *\r
- * @description\r
- *       Structure holds complete xran u-plane packet header\r
- *       3.1.1 Ethernet Encapsulation\r
- *****************************************************************************/\r
-struct xran_up_pkt_hdr\r
-{\r
-    struct xran_ecpri_hdr ecpri_hdr; /**< eCPRI Transport Header */\r
-    struct radio_app_common_hdr app_hdr; /**< eCPRI Transport Header */\r
-    struct data_section_hdr data_sec_hdr;\r
-} __rte_packed;\r
-\r
-\r
-/**\r
- ******************************************************************************\r
- * @ingroup xran_common_pkt\r
- *\r
- * @description\r
- *       Structure holds complete ethernet and xran u-plane packet header\r
- *       3.1.1 Ethernet Encapsulation\r
- *****************************************************************************/\r
-struct eth_xran_up_pkt_hdr\r
-{\r
-    struct ether_hdr eth_hdr;\r
-    struct xran_up_pkt_hdr xran_hdr;\r
-}__rte_packed;\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif\r
+/******************************************************************************
+*
+*   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_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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;
+} __rte_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;
+} __rte_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;
+
+/**
+ ******************************************************************************
+ * @ingroup xran_common_pkt
+ *
+ * @description
+ *       Structure holds complete xran u-plane packet header
+ *       3.1.1 Ethernet Encapsulation
+ *****************************************************************************/
+struct xran_up_pkt_hdr
+{
+    struct xran_ecpri_hdr ecpri_hdr; /**< eCPRI Transport Header */
+    struct radio_app_common_hdr app_hdr; /**< eCPRI Transport Header */
+    struct data_section_hdr data_sec_hdr;
+} __rte_packed;
+
+
+/**
+ ******************************************************************************
+ * @ingroup xran_common_pkt
+ *
+ * @description
+ *       Structure holds complete ethernet and xran u-plane packet header
+ *       3.1.1 Ethernet Encapsulation
+ *****************************************************************************/
+struct eth_xran_up_pkt_hdr
+{
+    struct ether_hdr eth_hdr;
+    struct xran_up_pkt_hdr xran_hdr;
+}__rte_packed;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif