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

#ifndef _ECPRI_TEST_CASE119_ANTDATA_H_
#define _ECPRI_TEST_CASE119_ANTDATA_H_


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


/* -------------------------------------------------- <MACRO DEF> -------------------------------------------------- */
/* TDD eCPRI IQ 10bit compress enable */
//#define TDD_ECPRI_COMP_10BIT_EN

/* TDD eCPRI symbolx(x:0~14) length */
#define TDD_ECPRI_SYMX_LEN                      4448

/* TDD eCPRI symbolx(x:0~14) compress length */
#define TDD_ECPRI_SYMX_COMP_LEN                 (TDD_ECPRI_SYMX_LEN * 10 / 16)

/* TDD eCPRI symbolx(x:0~14) packet length(11,152) */
#define TDD_ECPRI_SYMX_PKT_LEN                  (TDD_ECPRI_SYMX_COMP_LEN * 4 + 32)


/* -------------------------------------------------- <TYPE DEF> --------------------------------------------------- */
#ifdef ECS_RFM1
/* TDD eCPRI head structure */
typedef struct TddEcpriHead
{
    /* 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 reserved   : 3;                     /* 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_l;                         /* frame index low */

    uint8_t slot_id     : 4;                    /* slot index[3:0] */
    uint8_t subframe_id : 4;                    /* subframe index[7:4] */
    uint8_t sym_id      : 6;                    /* symbol index[5:0] */
    uint8_t frame_id_h  : 2;                    /* frame index high[7:6] */
    uint8_t udcomp_meth : 4;                    /* IQ compress method[3:0] */
    uint8_t udiq_width  : 4;                    /* IQ bit width indication[7:4] */
    uint8_t udcomp_para;                        /* IQ compress parameter */
} TddEcpriHead_t;

/* TDD eCPRI symbolx(x:0~14) packet structure */
typedef struct TddEcpriSymXPkt
{
    TddEcpriHead_t tdd_ecpri_head;              /* TDD ethernet head */
    uint32_t tdd_symx_data[TDD_ECPRI_SYMX_COMP_LEN];
                                                /* TDD symbolx(x:0~14) data */
} TddEcpriSymXPkt_t;

/* TDD eCPRI antenna config data structure */
typedef struct TddEcpriAntCfgData
{
    TddEcpriSymXPkt_t tdd_symx;                 /* TDD symbolx(x:0~14) */
} TddEcpriAntCfgData_t;
#endif


/* --------------------------------------------------- <DECLARE> --------------------------------------------------- */
#ifdef ECS_RFM1
/* TDD eCPRI antenna config data */
extern DDR0 TddEcpriAntCfgData_t g_tdd_ecpri_ant_cfg_data[ECPRI_25G_ANT_NUM];
#endif


#endif /* _ECPRI_TEST_CASE119_ANTDATA_H_ */

