#include "jesd_csu_nr_7ds2u.h"
#include "jesd_csu.h"
#include "phy_para.h"

int32_t jesd_csu_init_nr_7ds2u()
{
	jesd_csu_init(JESD_NR7DS2U_ANT_NUM, JESD_NR7DS2U_MARGIN, TDD_MODE);
	stJesdCsuNodePara txCsuNode[JESD_NR7DS2U_TX_NODENUM];
	stJesdCsuNodePara rxCsuNode[JESD_NR7DS2U_RX_NODENUM];
    //tx的链表地址
    uint32_t txListAddr = JESD_TX_LIST_ADDR; // 0x721F000; // 
    //rx的链表地址
    uint32_t rxListAddr = JESD_RX_LIST_ADDR; // 0x721F600; // 
	int32_t i = 0;

	// tx, slot0~6
	for (i = 0; i < (JESD_NR7DS2U_TX_NODENUM-1); i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (1 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
		else if (2 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (3 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
	}
	// slot7, slots
	txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
	txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
	txCsuNode[i].allNum = ((LONGCP_SAM_CNT+5*SHORTCP_SAM_CNT)<<4);

	// rx list nodes
	// slot7, slots
	rxCsuNode[0].dataAddr = JESD_NR7DS2U_RX_SLOTS_DATA_ADDR;
	rxCsuNode[0].yStep = (SHORTCP_SAM_CNT*4)<<2;
	rxCsuNode[0].allNum = (SHORTCP_SAM_CNT*4)<<4;
	// slot8
	rxCsuNode[1].dataAddr = JESD_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
	rxCsuNode[1].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
	rxCsuNode[1].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;
	// slot9
	rxCsuNode[2].dataAddr = JESD_NR7DS2U_RX_SLOT_ODD_DATA_ADDR;
	rxCsuNode[2].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
	rxCsuNode[2].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;

	jesd_csu_tx_cfg(txListAddr, JESD_NR7DS2U_TX_NODENUM, txCsuNode, JESD_CSU_CH0, 0);	
	jesd_csu_rx_cfg(rxListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode, JESD_CSU_CH0, 0);	
#if 0	
	jesd_csu_tx_list_init(txListAddr, JESD_NR7DS2U_TX_NODENUM, txCsuNode);
	jesd_csu_tx_dmaReg_Cfg(JESD_CSU_CH0, txListAddr, JESD_NR7DS2U_TX_NODENUM);
	jesd_csu_rx_list_init(rxListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode);
	jesd_csu_rx_dmaReg_Cfg(JESD_CSU_CH0, rxListAddr, JESD_NR7DS2U_RX_NODENUM);
#endif
	return 0;
}

int32_t jesd_csu_init_nr_7d2u()
{
	jesd_csu_init(JESD_NR7DS2U_ANT_NUM, JESD_NR7DS2U_MARGIN, TDD_MODE);
	stJesdCsuNodePara txCsuNode[JESD_NR7DS2U_TX_NODENUM];
	stJesdCsuNodePara rxCsuNode[JESD_NR7DS2U_RX_NODENUM];
    //tx的链表地址
    uint32_t txListAddr = JESD_TX_LIST_ADDR; // 0x721F000; // 
    //rx的链表地址
    uint32_t rxListAddr = JESD_RX_LIST_ADDR; // 0x721F600; // 
	int32_t i = 0;

	// tx, slot0~6
	for (i = 0; i < 14; i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (1 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
		else if (2 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (3 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
	}

	// rx list nodes
	// slot7, slots
	rxCsuNode[0].dataAddr = JESD_NR7DS2U_RX_SLOTS_DATA_ADDR;
	rxCsuNode[0].yStep = (SHORTCP_SAM_CNT*4)<<2;
	rxCsuNode[0].allNum = (SHORTCP_SAM_CNT*4)<<4;
	// slot8
	rxCsuNode[1].dataAddr = JESD_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
	rxCsuNode[1].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
	rxCsuNode[1].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;
	// slot9
	rxCsuNode[2].dataAddr = JESD_NR7DS2U_RX_SLOT_ODD_DATA_ADDR;
	rxCsuNode[2].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
	rxCsuNode[2].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;
	
	jesd_csu_tx_cfg(txListAddr, 14, txCsuNode, JESD_CSU_CH0, 0);	
	jesd_csu_rx_cfg(rxListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode, JESD_CSU_CH0, 0);	
#if 0	
	jesd_csu_tx_list_init(txListAddr, 14, txCsuNode);
	jesd_csu_tx_dmaReg_Cfg(JESD_CSU_CH0, txListAddr, 14);
	jesd_csu_rx_list_init(rxListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode);
	jesd_csu_rx_dmaReg_Cfg(JESD_CSU_CH0, rxListAddr, JESD_NR7DS2U_RX_NODENUM);
#endif
	return 0;
}

int32_t jesd_csu_init_nr_7d2u_slot0()
{
	jesd_csu_init(JESD_NR7DS2U_ANT_NUM, JESD_NR7DS2U_MARGIN, TDD_MODE);
	stJesdCsuNodePara txCsuNode[JESD_NR7DS2U_TX_NODENUM];
	stJesdCsuNodePara rxCsuNode[JESD_NR7DS2U_RX_NODENUM];
    //tx的链表地址
    uint32_t txListAddr = JESD_TX_LIST_ADDR; // 0x721F000; // 
    //rx的链表地址
    uint32_t rxListAddr = JESD_RX_LIST_ADDR; // 0x721F600; // 
	int32_t i = 0;

	// tx, slot0~6
	for (i = 0; i < 14; i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (1 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
		else if (2 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (3 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
	}

	// rx list nodes
	// slot7, slots
	rxCsuNode[0].dataAddr = JESD_NR7DS2U_RX_SLOTS_DATA_ADDR;
	rxCsuNode[0].yStep = (SHORTCP_SAM_CNT*4)<<2;
	rxCsuNode[0].allNum = (SHORTCP_SAM_CNT*4)<<4;
	// slot8
	rxCsuNode[1].dataAddr = JESD_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
	rxCsuNode[1].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
	rxCsuNode[1].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;
	// slot9
	rxCsuNode[2].dataAddr = JESD_NR7DS2U_RX_SLOT_ODD_DATA_ADDR;
	rxCsuNode[2].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
	rxCsuNode[2].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;
	
	jesd_csu_tx_cfg(txListAddr, 2, txCsuNode, JESD_CSU_CH0, 0);	
	jesd_csu_rx_cfg(rxListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode, JESD_CSU_CH0, 0);	
#if 0	
	jesd_csu_tx_list_init(txListAddr, 2, txCsuNode);
	jesd_csu_tx_dmaReg_Cfg(JESD_CSU_CH0, txListAddr, 2);
	jesd_csu_rx_list_init(rxListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode);
	jesd_csu_rx_dmaReg_Cfg(JESD_CSU_CH0, rxListAddr, JESD_NR7DS2U_RX_NODENUM);
#endif
	return 0;
}

int32_t jesd_csu_init_nr_7ds2u_iomode()
{
	jesd_csu_init(JESD_NR7DS2U_ANT_NUM, JESD_NR7DS2U_MARGIN, TDD_MODE);
	stJesdCsuNodePara txCsuNode[20];
	stJesdCsuNodePara rxCsuNode[20];
    //tx的链表地址
    uint32_t txListAddr = JESD_TX_LIST_ADDR; // 0x721F000; // 
    //rx的链表地址
    uint32_t rxListAddr = JESD_RX_LIST_ADDR; // 0x721F600; // 
	int32_t i = 0;

	// tx, slot0~9
	for (i = 0; i < 20; i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (1 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
		else if (2 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (3 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
	}

	
	// rx, slot0~9
	for (i = 0; i < 10; i++)
	{
		if (0 == (i&1))
		{
			rxCsuNode[i].dataAddr = JESD_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
			rxCsuNode[i].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
			rxCsuNode[i].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;
		}
		else
		{
			rxCsuNode[i].dataAddr = JESD_NR7DS2U_RX_SLOT_ODD_DATA_ADDR;
			rxCsuNode[i].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
			rxCsuNode[i].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;
		}
	}

	jesd_csu_tx_cfg(txListAddr, 20, txCsuNode, JESD_CSU_CH0, 0);	
	jesd_csu_rx_cfg(rxListAddr, 10, rxCsuNode, JESD_CSU_CH0, 0);	
#if 0	
	jesd_csu_tx_list_init(txListAddr, 20, txCsuNode);
	jesd_csu_tx_dmaReg_Cfg(JESD_CSU_CH0, txListAddr, 20);
	jesd_csu_rx_list_init(rxListAddr, 10, rxCsuNode);
	jesd_csu_rx_dmaReg_Cfg(JESD_CSU_CH0, rxListAddr, 10);
#endif
	return 0;
}

int32_t jesd_csu_init_nr_7ds2u_8t8r()
{
	jesd_csu_init(8, JESD_NR7DS2U_MARGIN, TDD_MODE);
	stJesdCsuNodePara txCsuNode[JESD_NR7DS2U_TX_NODENUM];
	stJesdCsuNodePara rxCsuNode[JESD_NR7DS2U_RX_NODENUM];
    //tx的链表地址
    uint32_t tx0ListAddr = JESD_TX_LIST_ADDR; 
    uint32_t tx1ListAddr = JESD_TX_LIST_ADDR + 0x800;
    //rx的链表地址
    uint32_t rx0ListAddr = JESD_RX_LIST_ADDR;
    uint32_t rx1ListAddr = JESD_RX_LIST_ADDR + 0x800; 
	int32_t i = 0;

	// tx, slot0~6
	for (i = 0; i < (JESD_NR7DS2U_TX_NODENUM-1); i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (1 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
		else if (2 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4);
		}
		else if (3 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2);
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4);
		}
	}
	// slot7, slots
	txCsuNode[i].dataAddr = JESD_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
	txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2);
	txCsuNode[i].allNum = ((LONGCP_SAM_CNT+5*SHORTCP_SAM_CNT)<<4);

	// rx list nodes
	// slot7, slots
	rxCsuNode[0].dataAddr = JESD_NR7DS2U_RX_SLOTS_DATA_ADDR;
	rxCsuNode[0].yStep = (SHORTCP_SAM_CNT*4)<<2;
	rxCsuNode[0].allNum = (SHORTCP_SAM_CNT*4)<<4;
	// slot8
	rxCsuNode[1].dataAddr = JESD_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
	rxCsuNode[1].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
	rxCsuNode[1].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;
	// slot9
	rxCsuNode[2].dataAddr = JESD_NR7DS2U_RX_SLOT_ODD_DATA_ADDR;
	rxCsuNode[2].yStep = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2;
	rxCsuNode[2].allNum = (LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4;
	
	jesd_csu_tx_cfg(tx0ListAddr, JESD_NR7DS2U_TX_NODENUM, txCsuNode, JESD_CSU_CH0, 0);	
	jesd_csu_rx_cfg(rx0ListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode, JESD_CSU_CH0, 0);
	
	jesd_csu_tx_cfg(tx1ListAddr, JESD_NR7DS2U_TX_NODENUM, txCsuNode, JESD_CSU_CH1, 0);	
	jesd_csu_rx_cfg(rx1ListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode, JESD_CSU_CH1, 0);	
#if 0	
	jesd_csu_tx_list_init(tx0ListAddr, JESD_NR7DS2U_TX_NODENUM, txCsuNode);
	jesd_csu_tx_dmaReg_Cfg(JESD_CSU_CH0, tx0ListAddr, JESD_NR7DS2U_TX_NODENUM);
	jesd_csu_rx_list_init(rx0ListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode);
	jesd_csu_rx_dmaReg_Cfg(JESD_CSU_CH0, rx0ListAddr, JESD_NR7DS2U_RX_NODENUM);

	jesd_csu_tx_list_init(tx1ListAddr, JESD_NR7DS2U_TX_NODENUM, txCsuNode);
	jesd_csu_tx_dmaReg_Cfg(JESD_CSU_CH1, tx1ListAddr, JESD_NR7DS2U_TX_NODENUM);
	jesd_csu_rx_list_init(rx1ListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode);
	jesd_csu_rx_dmaReg_Cfg(JESD_CSU_CH1, rx1ListAddr, JESD_NR7DS2U_RX_NODENUM);
#endif
	return 0;
}

int32_t jesd_csu_init_nr_7ds2u_4t4r_98()
{
	jesd_csu_init(4, JESD_98_NR7DS2U_MARGIN, TDD_MODE);
	stJesdCsuNodePara txCsuNode[JESD_NR7DS2U_TX_NODENUM];
	stJesdCsuNodePara rxCsuNode[JESD_NR7DS2U_RX_NODENUM];
    //tx的链表地址
    uint32_t tx0ListAddr = JESD_TX_LIST_ADDR; 
//    uint32_t tx1ListAddr = JESD_TX_LIST_ADDR + 0x800;
    //rx的链表地址
    uint32_t rx0ListAddr = JESD_RX_LIST_ADDR;
//    uint32_t rx1ListAddr = JESD_RX_LIST_ADDR + 0x800; 
	int32_t i = 0;

	// tx, slot0~6
	for (i = 0; i < (JESD_NR7DS2U_TX_NODENUM-1); i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR; // JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (1 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (2 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (3 == (i&0x3))
		{
			txCsuNode[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
	}
	// slot7, slots
	txCsuNode[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
	txCsuNode[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
	txCsuNode[i].allNum = ((LONGCP_SAM_CNT+5*SHORTCP_SAM_CNT)<<4)*2;

	// rx list nodes
	// slot7, slots
	rxCsuNode[0].dataAddr = JESD_98_NR7DS2U_RX_SLOTS_DATA_ADDR;
	rxCsuNode[0].yStep = ((SHORTCP_SAM_CNT*4)<<2)*2;
	rxCsuNode[0].allNum = ((SHORTCP_SAM_CNT*4)<<4)*2;
	// slot8
	rxCsuNode[1].dataAddr = JESD_98_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
	rxCsuNode[1].yStep = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2)*2;
	rxCsuNode[1].allNum = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4)*2;
	// slot9
	rxCsuNode[2].dataAddr = JESD_98_NR7DS2U_RX_SLOT_ODD_DATA_ADDR;
	rxCsuNode[2].yStep = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2)*2;
	rxCsuNode[2].allNum = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4)*2;
	
	jesd_csu_tx_cfg(tx0ListAddr, JESD_NR7DS2U_TX_NODENUM, txCsuNode, JESD_CSU_CH0, 0);	
	jesd_csu_rx_cfg(rx0ListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode, JESD_CSU_CH0, 0);	
#if 0
	jesd_csu_tx_list_init(tx0ListAddr, JESD_NR7DS2U_TX_NODENUM, txCsuNode);
	jesd_csu_tx_dmaReg_Cfg(JESD_CSU_CH0, tx0ListAddr, JESD_NR7DS2U_TX_NODENUM);
	jesd_csu_rx_list_init(rx0ListAddr, JESD_NR7DS2U_RX_NODENUM, rxCsuNode);
	jesd_csu_rx_dmaReg_Cfg(JESD_CSU_CH0, rx0ListAddr, JESD_NR7DS2U_RX_NODENUM);
#endif
	return 0;
}

// 4t4r, 245.76M
int32_t jesd_csu_init_nr_2500us_double()
{
	jesd_csu_init(4, JESD_98_NR7DS2U_MARGIN, TDD_2500US_DOUBLE);
	stJesdCsuNodePara txCsuNode1[JESD_2500US_DOUBLE_TX_NODENUM1];
	stJesdCsuNodePara rxCsuNode1[JESD_2500US_DOUBLE_RX_NODENUM1];
	stJesdCsuNodePara txCsuNode2[JESD_2500US_DOUBLE_TX_NODENUM2];
	stJesdCsuNodePara rxCsuNode2[JESD_2500US_DOUBLE_RX_NODENUM2];
    //tx的链表地址
    uint32_t tx1ListAddr = JESD_TX_LIST_ADDR; 
    uint32_t tx2ListAddr = JESD_TX_LIST2_ADDR;
    //rx的链表地址
    uint32_t rx1ListAddr = JESD_RX_LIST_ADDR;
    uint32_t rx2ListAddr = JESD_RX_LIST2_ADDR; 
	int32_t i = 0;

	// tx, slot0~2
	for (i = 0; i < (JESD_2500US_DOUBLE_TX_NODENUM1-1); i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR; // JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode1[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode1[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (1 == (i&0x3))
		{
			txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode1[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode1[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (2 == (i&0x3))
		{
			txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode1[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode1[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (3 == (i&0x3))
		{
			txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode1[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode1[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
	}
	// slot3, slots
	txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
	txCsuNode1[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
	txCsuNode1[i].allNum = ((LONGCP_SAM_CNT+5*SHORTCP_SAM_CNT)<<4)*2;

	// rx list nodes
	// slot3, slots
	rxCsuNode1[0].dataAddr = JESD_98_NR7DS2U_RX_SLOTS_DATA_ADDR;
	rxCsuNode1[0].yStep = ((SHORTCP_SAM_CNT*4)<<2)*2;
	rxCsuNode1[0].allNum = ((SHORTCP_SAM_CNT*4)<<4)*2;
	// slot4
	rxCsuNode1[1].dataAddr = JESD_98_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
	rxCsuNode1[1].yStep = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2)*2;
	rxCsuNode1[1].allNum = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4)*2;
	
	jesd_csu_tx_cfg(tx1ListAddr, JESD_2500US_DOUBLE_TX_NODENUM1, txCsuNode1, JESD_CSU_CH0, 0);	
	jesd_csu_rx_cfg(rx1ListAddr, JESD_2500US_DOUBLE_RX_NODENUM1, rxCsuNode1, JESD_CSU_CH0, 0);	

	// tx, slot5~6
	for (i = 0; i < (JESD_2500US_DOUBLE_TX_NODENUM2-1); i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR; // JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode2[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode2[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (1 == (i&0x3))
		{
			txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode2[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode2[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (2 == (i&0x3))
		{
			txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode2[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode2[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (3 == (i&0x3))
		{
			txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode2[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode2[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
	}
	// slot7, slots
	txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
	txCsuNode2[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
	txCsuNode2[i].allNum = ((LONGCP_SAM_CNT+5*SHORTCP_SAM_CNT)<<4)*2;

	// rx list nodes
	// slot7, slots
	rxCsuNode2[0].dataAddr = JESD_98_NR7DS2U_RX_SLOTS_DATA_ADDR;
	rxCsuNode2[0].yStep = ((SHORTCP_SAM_CNT*4)<<2)*2;
	rxCsuNode2[0].allNum = ((SHORTCP_SAM_CNT*4)<<4)*2;
	// slot8
	rxCsuNode2[1].dataAddr = JESD_98_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
	rxCsuNode2[1].yStep = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2)*2;
	rxCsuNode2[1].allNum = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4)*2;
	// slot9
	rxCsuNode2[2].dataAddr = JESD_98_NR7DS2U_RX_SLOT_ODD_DATA_ADDR;
	rxCsuNode2[2].yStep = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2)*2;
	rxCsuNode2[2].allNum = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4)*2;
	
	jesd_csu_tx_cfg(tx2ListAddr, JESD_2500US_DOUBLE_TX_NODENUM2, txCsuNode2, JESD_CSU_CH0, 1);	
	jesd_csu_rx_cfg(rx2ListAddr, JESD_2500US_DOUBLE_RX_NODENUM2, rxCsuNode2, JESD_CSU_CH0, 1);	

	return 0;
}

// 4t4r, 245.76M, slot0
int32_t jesd_csu_init_nr_2500us_double_slot0()
{
	jesd_csu_init(4, JESD_98_NR7DS2U_MARGIN, TDD_2500US_DOUBLE);
	stJesdCsuNodePara txCsuNode1[JESD_2500US_DOUBLE_TX_NODENUM1];
	stJesdCsuNodePara rxCsuNode1[JESD_2500US_DOUBLE_RX_NODENUM1];
	stJesdCsuNodePara txCsuNode2[JESD_2500US_DOUBLE_TX_NODENUM2];
	stJesdCsuNodePara rxCsuNode2[JESD_2500US_DOUBLE_RX_NODENUM2];
    //tx的链表地址
    uint32_t tx1ListAddr = JESD_TX_LIST_ADDR; 
    uint32_t tx2ListAddr = JESD_TX_LIST2_ADDR;
    //rx的链表地址
    uint32_t rx1ListAddr = JESD_RX_LIST_ADDR;
    uint32_t rx2ListAddr = JESD_RX_LIST2_ADDR; 
	int32_t i = 0;

	// tx, slot0~2
	for (i = 0; i < (JESD_2500US_DOUBLE_TX_NODENUM1-1); i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR; // JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode1[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode1[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (1 == (i&0x3))
		{
			txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode1[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode1[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (2 == (i&0x3))
		{
			txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode1[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode1[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (3 == (i&0x3))
		{
			txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode1[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode1[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
	}
	// slot3, slots
	txCsuNode1[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
	txCsuNode1[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
	txCsuNode1[i].allNum = ((LONGCP_SAM_CNT+5*SHORTCP_SAM_CNT)<<4)*2;

	// rx list nodes
	// slot3, slots
	rxCsuNode1[0].dataAddr = JESD_98_NR7DS2U_RX_SLOTS_DATA_ADDR;
	rxCsuNode1[0].yStep = ((SHORTCP_SAM_CNT*4)<<2)*2;
	rxCsuNode1[0].allNum = ((SHORTCP_SAM_CNT*4)<<4)*2;
	// slot4
	rxCsuNode1[1].dataAddr = JESD_98_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
	rxCsuNode1[1].yStep = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2)*2;
	rxCsuNode1[1].allNum = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4)*2;
	
	jesd_csu_tx_cfg(tx1ListAddr, 2, txCsuNode1, JESD_CSU_CH0, 0);	
	//jesd_csu_rx_cfg(rx1ListAddr, 0, rxCsuNode1, JESD_CSU_CH0, 0);	
	jesd_csu_rx_cfg(rx1ListAddr, JESD_2500US_DOUBLE_RX_NODENUM1, rxCsuNode1, JESD_CSU_CH0, 0);	

	// tx, slot5~6
	for (i = 0; i < (JESD_2500US_DOUBLE_TX_NODENUM2-1); i++)
	{
		if (0 == (i&0x3))
		{
			txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR; // JESD_NR7DS2U_TX_SLOT_EVEN_F7SYMBOL_ADDR;
			txCsuNode2[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode2[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (1 == (i&0x3))
		{
			txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_EVEN_B7SYMBOL_ADDR;
			txCsuNode2[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode2[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (2 == (i&0x3))
		{
			txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
			txCsuNode2[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode2[i].allNum = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<4)*2;
		}
		else if (3 == (i&0x3))
		{
			txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_B7SYMBOL_ADDR;
			txCsuNode2[i].yStep = ((7*SHORTCP_SAM_CNT)<<2)*2;
			txCsuNode2[i].allNum = ((7*SHORTCP_SAM_CNT)<<4)*2;
		}
	}
	// slot7, slots
	txCsuNode2[i].dataAddr = JESD_98_NR7DS2U_TX_SLOT_ODD_F7SYMBOL_ADDR;
	txCsuNode2[i].yStep = ((LONGCP_SAM_CNT+6*SHORTCP_SAM_CNT)<<2)*2;
	txCsuNode2[i].allNum = ((LONGCP_SAM_CNT+5*SHORTCP_SAM_CNT)<<4)*2;

	// rx list nodes
	// slot7, slots
	rxCsuNode2[0].dataAddr = JESD_98_NR7DS2U_RX_SLOTS_DATA_ADDR;
	rxCsuNode2[0].yStep = ((SHORTCP_SAM_CNT*4)<<2)*2;
	rxCsuNode2[0].allNum = ((SHORTCP_SAM_CNT*4)<<4)*2;
	// slot8
	rxCsuNode2[1].dataAddr = JESD_98_NR7DS2U_RX_SLOT_EVEN_DATA_ADDR;
	rxCsuNode2[1].yStep = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2)*2;
	rxCsuNode2[1].allNum = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4)*2;
	// slot9
	rxCsuNode2[2].dataAddr = JESD_98_NR7DS2U_RX_SLOT_ODD_DATA_ADDR;
	rxCsuNode2[2].yStep = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<2)*2;
	rxCsuNode2[2].allNum = ((LONGCP_SAM_CNT + SHORTCP_SAM_CNT*13)<<4)*2;
	
	jesd_csu_tx_cfg(tx2ListAddr, 0, txCsuNode2, JESD_CSU_CH0, 1);	
	jesd_csu_rx_cfg(rx2ListAddr, JESD_2500US_DOUBLE_RX_NODENUM2, rxCsuNode2, JESD_CSU_CH0, 1);	

	return 0;
}

int32_t jesd_sniffer_orx_csu_init()
{
	jesd_orx_csu_init(5);
	stJesdCsuNodePara orxCsuNode[2];
    //orx的链表地址
    uint32_t orxListAddr = JESD_RX_LIST2_ADDR; // 0x8A00C000

	// rx list nodes
	// slot7, slots
	orxCsuNode[0].dataAddr = JESD_ORX_DATA_ADDR;
	orxCsuNode[0].yStep = JESD_ORX_DATA_LEN;
	orxCsuNode[0].allNum = JESD_ORX_DATA_LEN;

	orxCsuNode[1].dataAddr = JESD_ORX_DATA_ADDR+JESD_ORX_DATA_LEN;
	orxCsuNode[1].yStep = JESD_ORX_DATA_LEN;
	orxCsuNode[1].allNum = JESD_ORX_DATA_LEN;

	jesd_csu_orx_cfg(orxListAddr, 2, orxCsuNode, 0);	

	return 0;
}

