2023-12-14 10:55:49 +08:00

118 lines
4.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**********************************************************************************************************************
* Copyright (C), 2022-2026, SMARTLOGIC TECHNOLOGY LTD.
* File Name: ecpri_comm.h
* Create Date: 23/12/11
* Description: eCPRI Common Module Header File
* Change History:
* <author> <time> <version> <desc>
* 1. ShangH 23/12/11 1.0 Build this module
**********************************************************************************************************************/
#ifndef _ECPRI_COMM_H_
#define _ECPRI_COMM_H_
/* -------------------------------------------------- <INC FILE> --------------------------------------------------- */
/* -------------------------------------------------- <MACRO DEF> -------------------------------------------------- */
#ifndef NULL
#define NULL ((void *)0)
#endif
/* operation result */
#ifndef SUCCESS
#define SUCCESS 0
#endif
#ifndef ERROR
#define ERROR (-1)
#endif
/* byte order convert */
#ifndef HTON_S
#define HTON_S(X) X = (((X & 0x00FF) << 8) | ((X & 0xFF00) >> 8))
#endif
#ifndef HTON_L
#define HTON_L(X) X = (((X & 0x000000FF) << 24) | \
((X & 0x0000FF00) << 8) | \
((X & 0x00FF0000) >> 8) | \
((X & 0xFF000000) >> 24))
#endif
/* MAC address length */
#ifndef MAC_ADDR_LEN
#define MAC_ADDR_LEN 6
#endif
/* eCPRI buffer address & size(64MB) */
#define ECPRI_BUF_ADDR 0xAEE00000ul
#define ECPRI_BUF_SIZE 0x04000000ul
/* eCPRI RX buffer address & size(63MB) */
#define ECPRI_RX_BUF_ADDR ECPRI_BUF_ADDR
#define ECPRI_RX_BUF_SIZE 0x03F00000ul
/* eCPRI TX buffer address & size(512KB) */
#define ECPRI_TX_BUF_ADDR (ECPRI_RX_BUF_ADDR + ECPRI_RX_BUF_SIZE)
#define ECPRI_TX_BUF_SIZE 0x00080000ul
/* eCPRI antenna config data address & size(512KB) */
#define ECPRI_ANT_BUF_ADDR (ECPRI_TX_BUF_ADDR + ECPRI_TX_BUF_SIZE)
#define ECPRI_ANT_BUF_SIZE 0x00080000ul
/* eCPRI packet size(16KB) */
#define ECPRI_PKT_SIZE 0x00004000ul
/* eCPRI packet max number */
#define ECPRI_PKT_MAX (ECPRI_RX_BUF_SIZE / ECPRI_PKT_SIZE)
/* eCPRI descriptor address unit1:32B */
#define ECPRI_DESC_ADDR_UNIT 32
/* eCPRI antenna number */
#define ECPRI_ANT_NUM 4
/* eCPRI slot number */
#define ECPRI_SLOT_NUM 20 // LTE 10
/* eCPRI slot type - odd/even */
#define ECPRI_SLOT_TYPE 2
#define ECPRI_SLOT_ODD 0
#define ECPRI_SLOT_EVEN 1
/* eCPRI symbol number */
#define ECPRI_SYM_NUM 14
/* eCPRI symbol info length(packet address + packet length) */
#define ECPRI_SYM_INFO_LEN 8
/* eCPRI debug ECS_RFM0 index & address - 0xB7E30000 ~ 0xB7E30FFC(x = 0 ~ 0x3FF) */
#define ECPRI_DBG_IDX0(X) DBG_DDR_ECPRI_IDX(0, X)
#define ECPRI_DBG_ADDR0(X) (DBG_DDR_ADDR_BASE + ECPRI_DBG_IDX0(X) * 4)
/* eCPRI debug ECS_RFM1 index & address - 0xB7E31000 ~ 0xB7E31FFC(x = 0 ~ 0x3FF) */
#define ECPRI_DBG_IDX1(X) DBG_DDR_ECPRI_IDX(1, X)
#define ECPRI_DBG_ADDR1(X) (DBG_DDR_ADDR_BASE + ECPRI_DBG_IDX1(X) * 4)
/* eCPRI test index & address - 0xB7E32000(X = 0 ~ 0x7FFF) */
#define ECPRI_TEST_IDX(X) DBG_DDR_ECPRI_IDX(2, X)
#define ECPRI_TEST_ADDR(X) (DBG_DDR_ADDR_BASE + ECPRI_TEST_IDX(X) * 4)
/* eCPRI test ECS_RFM0 index & address - 0xB7E32000 ~ 0xB7E41FFC(X = 0 ~ 0x3FFF) */
#define ECPRI_TEST_IDX0(X) ECPRI_TEST_IDX(X)
#define ECPRI_TEST_ADDR0(X) ECPRI_TEST_ADDR(X)
/* eCPRI test ECS_RFM1 index & address - 0xB7E42000 ~ 0xB7E51FFC(X = 0 ~ 0x3FFF) */
#define ECPRI_TEST_IDX1(X) ECPRI_TEST_IDX(X + 0x4000)
#define ECPRI_TEST_ADDR1(X) ECPRI_TEST_ADDR(X + 0x4000)
/* -------------------------------------------------- <TYPE DEF> --------------------------------------------------- */
/* --------------------------------------------------- <DECLARE> --------------------------------------------------- */
#endif /* _ECPRI_COMM_H_ */