/**********************************************************************************************************************
*  Copyright (C), 2022-2026, SMARTLOGIC TECHNOLOGY LTD.
*  File Name: ecpri_test_case102_antdata.h
*  Create Date: 23/09/20
*  Description: eCPRI Test Case102 Antenna Data Module Header File
*  Change History:
*      <author>      <time>      <version>   <desc>
*    1. ShangH      23/09/20        1.0       Build this module
**********************************************************************************************************************/

#ifndef _ECPRI_TEST_CASE102_ANTDATA_H_
#define _ECPRI_TEST_CASE102_ANTDATA_H_


/* -------------------------------------------------- <INC FILE> --------------------------------------------------- */
#ifdef ECS_RFM1
#include "mem_sections.h"
#include "ecpri_comm.h"
#endif


/* -------------------------------------------------- <MACRO DEF> -------------------------------------------------- */
/* FDD eCPRI IQ 10bit compress enable */
//#define FDD_ECPRI_COMP_10BIT_EN

/* FDD eCPRI PRB number */
#define FDD_ECPRI_PRB_NUM                       273
/* FDD eCPRI RE number per PRB */
#define FDD_ECPRI_PRB_RE_NUM                    12
/* FDD eCPRI symbol0~symbol13 length */
#define FDD_ECPRI_SYMX_LEN                      (FDD_ECPRI_PRB_NUM * FDD_ECPRI_PRB_RE_NUM)

/* FDD eCPRI symbol0~symbol13 compress length(2,048) */
#define FDD_ECPRI_SYMX_COMP_LEN                 ((uint32_t)(FDD_ECPRI_SYMX_LEN * 10 / 16 + 1))

/* FDD eCPRI symbol0~symbol13 packet length(8,228) */
#define FDD_ECPRI_SYMX_PKT_LEN                  (FDD_ECPRI_SYMX_COMP_LEN * 4 + 36)


/* -------------------------------------------------- <TYPE DEF> --------------------------------------------------- */
#ifdef ECS_RFM1
/* FDD eCPRI head structure */
typedef struct FddEcpriHead
{
    /* ethernet head */
    uint8_t dst_mac[MAC_ADDR_LEN];              /* destination MAC address */
    uint8_t src_mac[MAC_ADDR_LEN];              /* source MAC address */
    uint32_t vlan_tag;                          /* VLAN tag */
    uint16_t ether_type;                        /* ethernet type */

    /* common head */
    uint8_t pkt_concat : 1;                     /* packet concatenation[0] */
    uint8_t ecpri_rsv  : 3;                     /* eCPRI reserved[3:1] */
    uint8_t ecpri_ver  : 4;                     /* eCPRI version[7:4] */
    uint8_t msg_type;                           /* message type */
    uint16_t payload_size;                      /* payload size */

    /* custom head */
    uint8_t sector_id  : 4;                     /* sector index[3:0] */
    uint8_t cu_port_id : 4;                     /* CU port index[7:4] */
    uint8_t ant_id     : 4;                     /* antenna index[3:0] */
    uint8_t cc_id      : 4;                     /* carrier unit[7:4] */

    uint8_t seq_id;                             /* sequence index */
    uint8_t subseq_id   : 7;                    /* subsequence index[6:0] */
    uint8_t seq_end     : 1;                    /* sequence end flag[7] */
    uint8_t fltr_id     : 4;                    /* filter index[3:0] */
    uint8_t payload_ver : 3;                    /* payload version[6:4] */
    uint8_t data_dir    : 1;                    /* data direction[7] */
    uint8_t frame_id;                           /* frame index */

    uint32_t startPrbc_h : 2;                   /* start PRB high[1:0] */
    uint32_t symInc      : 1;                   /* symbol increase[2] */
    uint32_t rb          : 1;                   /* resource block[3] */
    uint32_t sectionId   : 12;                  /* section index[15:4] */
    uint32_t sym_id      : 6;                   /* symbol index[21:16] */
    uint32_t slot_id     : 6;                   /* slot index[27:22] */
    uint32_t subframe_id : 4;                   /* subframe index[31:28] */

    uint8_t startPrbc_l;                        /* start PRB low */
    uint8_t numPrbc;                            /* PRB number */
    uint8_t udCompHdr;                          /* user data compress header */
    uint8_t reserved;                           /* reserved */
} FddEcpriHead_t;

/* FDD eCPRI symbol0~symbol13 packet structure */
typedef struct FddEcpriSymXPkt
{
    FddEcpriHead_t fdd_ecpri_head;              /* FDD ethernet head */
    uint32_t fdd_symx_data[FDD_ECPRI_SYMX_COMP_LEN];
                                                /* FDD symbol0~symbol13 data */
} FddEcpriSymXPkt_t;

/* FDD eCPRI antenna config data structure */
typedef struct FddEcpriAntCfgData
{
    FddEcpriSymXPkt_t fdd_symx[ECPRI_SYM_NUM];  /* FDD symbol0~symbol13 */
} FddEcpriAntCfgData_t;
#endif


/* --------------------------------------------------- <DECLARE> --------------------------------------------------- */
#ifdef ECS_RFM1
/* FDD eCPRI antenna config data */
extern DDR0 FddEcpriAntCfgData_t g_fdd_ecpri_ant_cfg_data[ECPRI_10G_ANT_NUM];
#endif


#endif /* _ECPRI_TEST_CASE102_ANTDATA_H_ */

