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

#ifndef _ECPRI_IRQ_H_
#define _ECPRI_IRQ_H_


/* -------------------------------------------------- <INC FILE> --------------------------------------------------- */
#include "typedef.h"
#include "ucp_tick.h"
#include "ucp_utility.h"
#include "phy_para.h"
#include "ecpri_comm.h"
#include "ecpri_csu.h"

#ifdef TEST_ENABLE
#include "ecpri_test.h"
#endif


/* -------------------------------------------------- <MACRO DEF> -------------------------------------------------- */
/* STC statistic max cycle */
#define STC_CYCLE_MAX                           1000000000ul


/* -------------------------------------------------- <TYPE DEF> --------------------------------------------------- */
/* eCPRI antenna config info structure */
typedef struct EcpriAntCfgInfo
{
    uint32_t pkt_addr;                          /* packet address */
    uint32_t pkt_len;                           /* packet length */
} EcpriAntCfgInfo_t;

/* eCPRI symbol interrupt statistic structure */
typedef struct EcpriSymIrqStats
{
    uint32_t handle_times;                      /* handle times */
    uint32_t handle_succ_times;                 /* handle success times */
    uint32_t handle_fail_times;                 /* handle fail times */
    uint32_t send_times;                        /* send times */
    uint32_t send_succ_times;                   /* send success times */
    uint32_t send_fail_times;                   /* send fail times */
} EcpriSymIrqStats_t;


/* --------------------------------------------------- <DECLARE> --------------------------------------------------- */
#if (ECPRI_CSU_MODE == ECPRI_CSU_LINK)
/* eCPRI CSU link list address */
extern uint32_t g_ecpri_csu_list_addr; /* 10G - ECS_RFM0: 0xB7E30400(256) ~ 0xB7E304FC(319) 
                                          25G - ECS_RFM0: 0xB7E30400(256) ~ 0xB7E305FC(383) */

/* eCPRI CSU node parameter */
extern stEcpriCsuNodePara *g_ecpri_csu_list_node_ptr;
#endif

/* eCPRI symbol interrupt init */
void ecpri_sym_irq_init(void);
/* eCPRI symbol interrupt handle */
int32_t ecpri_sym_irq_handle(uint8_t slot_id, uint8_t sym_id);
#if (ECPRI_CSU_MODE == ECPRI_CSU_REG)
/* eCPRI symbol interrupt send */
int32_t ecpri_sym_irq_send(uint8_t ant_id, uint8_t slot_type, uint8_t sym_id);
#endif
#if (ECPRI_CSU_MODE == ECPRI_CSU_LINK)
/* eCPRI symbol interrupt link send */
void ecpri_sym_irq_link_send(void);
#endif
/* eCPRI symbol interrupt interval check */
void ecpri_sym_irq_intv_check(void);
/* eCPRI symbol interrupt status check */
void ecpri_sym_irq_status_check(void);


#endif /* _ECPRI_IRQ_H_ */

