?? le1vediag.c
字號:
/*****************************************************************************
* 版權所有 (C)2001-2005, 深圳市中興通訊股份有限公司。
*
* 文件名稱: Diagnose_prj_lib.c
* 文件標識:
* 內容摘要: 診斷模塊源文件
* 其它說明:
* 當前版本: V2.6.0.3
* 作 者: 史宏鋒133458
* 完成日期: 年 月 日
* 當前責任人-1:史宏鋒133458
* 當前責任人-2:
* 歷史責任人-3:
* 歷史責任人-2:
* 歷史責任人-1:
*
* 修改記錄1:
* 修改日期:
* 版 本 號:
* 修 改 人:
* 修改內容:
* 修改記錄2:…
*****************************************************************************/
/* 頭文件包含 */
#include "../Diagnose/include/Diag_prj_ex.h"
#include "le1veFpgalib.h"
#include "le1veFpgaDma.h"
/* 常量定義*/
/* 文件內部使用的宏*/
/* 文件內部使用的數據類型*/
#define LE1VE_CPLD_OFFSET 0x1F00
#define LE1VE_FPGA_OFFSET 0x500
/* 全局變量*/
extern UINT16 b_physIfType(UINT8 unitNum);
extern UINT32 drv_pm4354ReadReg(UINT32 slotNum, UINT8 chip, UINT32 addr, UINT8 i);
zlStatusE le1veDignoseDisplayClockinfo(UINT32 slot, char *buff);
extern LE1VE_PCI_DRV_CTRL *gpLe1veDrvCtrl[];
/* 本地變量(即靜態全局變量)*/
/* 局部函數原型 */
/******************************************************
Function:
drv_le1veBufferShow()
Description:
打印BD Buffer信息
Inputs:
pDrv LE1VE_PCI_DRV_CTRL指針
buffer 回顯字符串指針
Outputs:
buffer
Returns:
OK or ERROR
Remarks:
*******************************************************/
int drv_le1veBDShow(LE1VE_PCI_DRV_CTRL *pDrv, char *buffer)
{
int rxIndex = 0;
int txIndex = 0;
LE1VE_RMD *pRmd = NULL;
LE1VE_TMD *pTmd = NULL;
UINT32 tmp_le1veRMD0 = 0;
UINT32 tmp_le1veTMD0 = 0;
if((NULL == pDrv) || (NULL == buffer))
return ERROR;
/* 回顯Rx*/
sprintf((buffer+strlen(buffer)),"Rx BD Table:\n");
/*遍列BD 接受表*/
while(rxIndex<pDrv->rringSize)
{
pRmd = pDrv->pRring + rxIndex;
tmp_le1veRMD0 = Drv_Swap32(pRmd->RMD0);
if( tmp_le1veRMD0 & RMD0_OWN)
{
sprintf((buffer+strlen(buffer)),"Rx Buffer Index %d hold a packet Descriptor:0x%08x \tbuffer pointer:%08x\n",
rxIndex, tmp_le1veRMD0, Drv_Swap32(mapPhysToVirt(pRmd->RMD1)));
}
else if(Drv_Swap32(mapPhysToVirt(pRmd->RMD1)) != 0)
{
sprintf((buffer+strlen(buffer)),"Rx Buffer Index %d is free Descriptor:0x%08x\tbufer pointer:%08x\n",
rxIndex, tmp_le1veRMD0, Drv_Swap32(mapPhysToVirt(pRmd->RMD1)));
}
else
{
sprintf((buffer+strlen(buffer)),"Rx Buffer Index %d ERROR Descriptor:0x%08x\n",rxIndex,tmp_le1veRMD0);
}
rxIndex++;
}
/* 回顯Tx*/
sprintf((buffer+strlen(buffer)),"Tx BD Table:\n");
/*遍列BD 發送表*/
while(txIndex < pDrv->tringSize)
{
pTmd = pDrv->pTring + txIndex;
tmp_le1veTMD0 = Drv_Swap32(pTmd->TMD0) ;
if(tmp_le1veTMD0 & TMD0_OWN)
{
sprintf((buffer+strlen(buffer)),"Tx Buffer Index %d has a packet Descriptor:0x%08x\tbuffer pointer:%08x\n",
txIndex, tmp_le1veTMD0, Drv_Swap32(mapPhysToVirt(pTmd->TMD1)));
}
else if(Drv_Swap32(mapPhysToVirt(pTmd->TMD1)) != 0)
{
sprintf((buffer+strlen(buffer)),"Tx Buffer Index %d to be freed Descriptor:0x%08x\tbufer pointer:%08x\n",
txIndex, tmp_le1veTMD0, Drv_Swap32(mapPhysToVirt(pTmd->TMD1)));
}
else
{
sprintf((buffer+strlen(buffer)),"Tx Buffer Index %d not used\n",txIndex);
}
txIndex++;
}
return OK;
}
/******************************************************
Function:
drv_le1veShowCardInfo()
Description:
打印E1VE板基本信息
Inputs:
slotNum 槽位號
buffer 回顯字符串指針
Outputs:
buffer
Returns:
OK or ERROR
Remarks:
*******************************************************/
int drv_le1veShowCardInfo(int slotNum, char *buffer)
{
int i,j;
UINT32 value;
if(CARD_TMD_OVER_IP_4_1 == b_physIfType(slotNum))
{
sprintf(buffer,"========\tSlot: %d E1VE Card\t ========\n",slotNum);
}
else
{
sprintf(buffer,"========\tSlot: %d T1VE Card\t========\n",slotNum);
}
sprintf(buffer+strlen(buffer),"Hardware: PM4354\t Zl50114\n");
sprintf(buffer+strlen(buffer),"PM4354 Key Register Value:");
for(j=0;j<4; j++)
{
sprintf(buffer+strlen(buffer),"\nPort %d",j);
for(i=0;i<=0xFF;i++)
{
if (0 == (i % 16))
sprintf ((buffer+strlen(buffer)),"\n%08x:", i);
value = drv_pm4354ReadReg(slotNum, 0, i, j);
sprintf((buffer+strlen(buffer)),"%02x ", (value & 0xFF));
}
}
sprintf(buffer+strlen(buffer),"\nkey register:\n");
sprintf(buffer+strlen(buffer),"reg 0x0 : 0-2.048 E1 1 - 1.544 T1\n");
sprintf(buffer+strlen(buffer),"reg 0x6 : \n");
sprintf(buffer+strlen(buffer),"reg 0x1D : bit 1 : 1 - full 0 - empty bit 0: 1 -slip clear on read\n");
sprintf(buffer+strlen(buffer),"reg 0x21 : bit 1 : 1 - full 0 - empty bit 0: 1 -slip clear on read\n");
sprintf(buffer+strlen(buffer),"reg 0xbb : bit [1:0]sync clock selection 0-port 0 1-port 1 2-port 2 3-port3\n");
sprintf(buffer+strlen(buffer),"reg 0xF9 : bit[2-0] threshold settings for the incoming signal\n");
strcat(buffer,"\n\nZl5011x ADM Block Key Register Value:");
for(i=0;i<=0x48;i=i+4)
{
if(0 ==(i % 16))
sprintf((buffer+strlen(buffer)),"\n%08x:",i);
ZL5011X_REG_READ(slotNum, ZL5011X_ADM_BASE + i, &value);
sprintf((buffer+strlen(buffer)),"%08x ", value);
}
sprintf((buffer+strlen(buffer)),"\nZl5011x GM Block key Register Value:\t\n");
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x0, &value);
sprintf((buffer+strlen(buffer)),"gm_head_reg(0x0):\t %08x\tHead register for storing the starting address of the first (head) granule\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x4, &value);
sprintf((buffer+strlen(buffer)),"gm_tail_reg(0x4):\t %08x\tTail register for storing the starting address of the (tail) granule\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x8, &value);
sprintf((buffer+strlen(buffer)),"gm_grn_cnt_reg(0x8):\t %08x\tStoring the number of free granules\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0xc, &value);
sprintf((buffer+strlen(buffer)),"gm_cnt_limit(0xc):\t %08x\tStoring the threshold for free granule counter\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x10, &value);
sprintf((buffer+strlen(buffer)),"gm_int_mask(0x10):\t %08x\tInterrupt mask bits\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x14, &value);
sprintf((buffer+strlen(buffer)),"gm_adm_int_reg(0x14):\t %08x\tADM interrupt register\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x1c, &value);
sprintf((buffer+strlen(buffer)),"gm_gnt_cnt(0x14):\t %08x\tTotal number of granted granules\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x20, &value);
sprintf((buffer+strlen(buffer)),"gm_rls_cnt(0x20):\t %08x\tTotal number of released granules\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x100, &value);
sprintf((buffer+strlen(buffer)),"gm_pla_gnt_cnt(0x100):\t %08x\tGranted granules to PLA\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x104, &value);
sprintf((buffer+strlen(buffer)),"gm_prx_gnt_cnt(0x104):\t %08x\tGranted granules to PRX\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x108, &value);
sprintf((buffer+strlen(buffer)),"gm_cpu_gnt_cnt(0x108):\t %08x\tGranted granules to CPU\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x10c, &value);
sprintf((buffer+strlen(buffer)),"gm_rtp_gnt_cnt(0x10c):\t %08x\tGranted granules to PE\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x110, &value);
sprintf((buffer+strlen(buffer)),"gm_pla_rls_cnt(0x100):\t %08x\tReleased granules from PLA\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x114, &value);
sprintf((buffer+strlen(buffer)),"gm_tfm_rls_cnt(0x114):\t %08x\tReleased granules from TFM\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x118, &value);
sprintf((buffer+strlen(buffer)),"gm_tfq_rls_cnt(0x118):\t %08x\tReleased granules from TFQ\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x11c, &value);
sprintf((buffer+strlen(buffer)),"gm_ptx_rls_cnt(0x11c):\t %08x\tReleased granules from PTX\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x120, &value);
sprintf((buffer+strlen(buffer)),"gm_pkq_rls_cnt(0x120):\t %08x\tReleased granules from PKQ\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x124, &value);
sprintf((buffer+strlen(buffer)),"gm_pkc_rls_cnt(0x124):\t %08x\tReleased granules from PKC\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x128, &value);
sprintf((buffer+strlen(buffer)),"gm_cpu_rls_cnt(0x128):\t %08x\tReleased granules from CPU\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_GM_BASE + 0x12c, &value);
sprintf((buffer+strlen(buffer)),"gm_rtp_rls_cnt(0x12c):\t %08x\tReleased granules from PE\n",value);
sprintf((buffer+strlen(buffer)),"Zl5011x MM Block key Register Value:\t\n");
ZL5011X_REG_READ(slotNum, ZL5011X_MM_BASE + 0x0, &value);
sprintf((buffer+strlen(buffer)),"GRNBASE(0x0):\t\t %08x\tBase address of granule data memory area\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_MM_BASE + 0x4, &value);
sprintf((buffer+strlen(buffer)),"GRNDESBASE(0x4):\t %08x\tBase address of granule descriptor memory area\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_MM_BASE + 0x8, &value);
sprintf((buffer+strlen(buffer)),"IMEMSTATUS(0x8):\t %08x\tIndicates a failing internal memory\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_MM_BASE + 0x10, &value);
sprintf((buffer+strlen(buffer)),"IMEMSTATUS(0xc):\t %08x\tExternal Memory interface control\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_MM_BASE + 0x14, &value);
sprintf((buffer+strlen(buffer)),"EMEMENB(0x14):\t\t %08x\tExternal Memory interface control\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_MM_BASE + 0x20, &value);
sprintf((buffer+strlen(buffer)),"EMEMPARITY1(0x20):\t %08x\tExternal Memory Parity Configuration\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_MM_BASE + 0x24, &value);
sprintf((buffer+strlen(buffer)),"EMEMPARITY2(0x24):\t %08x\tExternal Memory Parity Error Interrupt Trip Point\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_MM_BASE + 0x28, &value);
sprintf((buffer+strlen(buffer)),"EMEMPTYCNT(0x28):\t %08x\tExternal Memory Parity Status\n",value);
sprintf((buffer+strlen(buffer)),"Zl5011x PAC Block key Register Value:\t\n");
ZL5011X_REG_READ(slotNum, ZL5011X_PAC_BASE + 0x4, &value);
sprintf((buffer+strlen(buffer)),"pac_setup(0x4):\t\t %08x\tDefines PAC operating modes, TDM data rate,differential timestamp sampling frequency\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PAC_BASE + 0x24c, &value);
sprintf((buffer+strlen(buffer)),"pac_status(0x24c):\t %08x\tInterrupts\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PAC_BASE + 0x250, &value);
sprintf((buffer+strlen(buffer)),"pac_mask(0x250):\t %08x\tMasks for interrupts\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PAC_BASE + 0x254, &value);
sprintf((buffer+strlen(buffer)),"pac_clear(0x254):\t %08x\tInterrupt clear commands\n",value);
sprintf((buffer+strlen(buffer)),"Zl5011x PKC Block key Register Value:\t\n");
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x48, &value);
sprintf((buffer+strlen(buffer)),"PKC_INT_SRC(0x48):\t %08x\tInterrupt is pending\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x4c, &value);
sprintf((buffer+strlen(buffer)),"PKC_INT_MASK(0x4c):\t %08x\tIMask the pending interrupt\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x50, &value);
sprintf((buffer+strlen(buffer)),"PKC_INT_POLL(0x50):\t %08x\tPolling the interrupt source register (PKC_INT_SRC) status\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x2040, &value);
sprintf((buffer+strlen(buffer)),"PKC_PC_TMPL_C0(0x2040):\t %08x\tCount packets matched against pre_classifier template 0\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x2048, &value);
sprintf((buffer+strlen(buffer)),"PKC_PC_TMPL_C1(0x2048):\t %08x\tCount packets matched against pre_classifier template 1\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x2050, &value);
sprintf((buffer+strlen(buffer)),"PKC_PC_TMPL_C2(0x2050):\t %08x\tCount packets matched against pre_classifier template 2\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x2058, &value);
sprintf((buffer+strlen(buffer)),"PKC_PC_TMPL_C3(0x2058):\t %08x\tCount packets matched against pre_classifier template 3\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x2060, &value);
sprintf((buffer+strlen(buffer)),"PKC_PC_NM_C(0x2060):\t %08x\tCount packets not matching any pre_classifier templates\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x2064, &value);
sprintf((buffer+strlen(buffer)),"PKC_IP_CS_ERR_C(0x2064): %08x\tCount IP checksum failure packets\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x2068, &value);
sprintf((buffer+strlen(buffer)),"PKC_CE_NM_C(0x2068):\t %08x\tCount pkts not matching any rule\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKC_BASE + 0x206c, &value);
sprintf((buffer+strlen(buffer)),"PKC_PV_NM_C(0x206c):\t %08x\tCount packets failing post verifier\n",value);
sprintf((buffer+strlen(buffer)),"Zl5011x PKI Block key Register Value:\t\n");
ZL5011X_REG_READ(slotNum, ZL5011X_PKI_BASE + 0x0, &value);
sprintf((buffer+strlen(buffer)),"pki0_ctrl(0x0):\t\t %08x\tPKI Port 0 Control Register\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKI_BASE + 0x4, &value);
sprintf((buffer+strlen(buffer)),"pki1_ctrl(0x4):\t\t %08x\tPKI Port 1 Control Register\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKI_BASE + 0x8, &value);
sprintf((buffer+strlen(buffer)),"pki2_ctrl(0x8):\t\t %08x\tPKI Port 2 Control Register\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PKI_BASE + 0xc, &value);
sprintf((buffer+strlen(buffer)),"pki3_ctrl(0xc):\t\t %08x\tPKI Port 3 Control Register\n",value);
sprintf((buffer+strlen(buffer)),"Zl5011x PLA Block key Register Value:\t\n");
ZL5011X_REG_READ(slotNum, ZL5011X_PLA_BASE + 0x60008, &value);
sprintf((buffer+strlen(buffer)),"Pre_Tmi_ovf(0x60008):\t %08x\tTask manager interface overflow pre-mask interrupt\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PLA_BASE + 0x6000c, &value);
sprintf((buffer+strlen(buffer)),"Tmi_ovf(0x6000c):\t %08x\tTask manager interface overflow post mask interrupt\n",value);
ZL5011X_REG_READ(slotNum, ZL5011X_PLA_BASE + 0x60010, &value);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -