📄 le1vedebug.c
字号:
/* le1veIsr.c - LE1VE (TDMoIP) debug routine file
*
* Copyright 2004-2007 ZTE, Inc.
* author: ZhengQishan
* date: 2004.03
*
* modification history
*------------------------------
*
*/
#include "le1veLib.h"
#include "zl5011x.h"
#include "zl5011xApi.h"
#include "zl5011xPkcMap.h"
#include "zl5011xPkiMap.h"
#include "zl5011xTfqMap.h"
#include "zl5011xTmMap.h"
#include "zl5011xTdm.h"
#include "zl5011xGmMap.h"
#include "zl5011xTfq.h"
#include "zl5011xRdWr.h"
#include "zl5011xLan.h"
#include "zl5011xCet.h"
#include "zl5011xPrintError.h"
#ifdef DEBUG_DRV_RCV_SND
#ifdef printf
#undef printf
#endif
extern zl5011xParamsS *le1ve_Zl5011xParams[];
extern void ZL5011X_REG_READ(int slot, UINT32 reg, volatile UINT32 *value);
extern zlStatusE zl5011xAdmGetDeviceId(zl5011xParamsS *zl5011xParams, Uint32T *chipId, Uint32T *version);
extern zlStatusE zl5011xPkiReadCounters(zl5011xParamsS *zl5011xParams,Uint8T portNum);
extern zlStatusE zl5011xDebugContextRx(zl5011xParamsS *zl5011xParams, Uint32T start, Uint32T end);
extern zlStatusE zl5011xDebugContextRxChans(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE zl5011xDebugContextTx(zl5011xParamsS *zl5011xParams, Uint32T start, Uint32T end);
extern zlStatusE zl5011xDebugContextTxChans(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE zl5011xDebugContextTxRates(zl5011xParamsS *zl5011xParams, Uint32T start, Uint32T end);
extern zlStatusE zl5011xDebugContextTxQueue(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE zl5011xDebugTxClockSource(zl5011xParamsS *zl5011xParams);
extern zlStatusE zl5011xDebugDpllStatus(zl5011xParamsS *zl5011xParams);
extern zlStatusE zl5011xDebugPkcStats(zl5011xParamsS *zl5011xParams);
extern zlStatusE zl5011xDebugResetPkcStats(zl5011xParamsS *zl5011xParams);
extern zlStatusE zl5011xDebugPkiStats(zl5011xParamsS *zl5011xParams, Uint32T portNum);
extern zlStatusE zl5011xDebugResetPkiStats(zl5011xParamsS *zl5011xParams, Uint32T portNum);
extern zlStatusE zl5011xDebugPkcRates(zl5011xParamsS *zl5011xParams);
extern zlStatusE zl5011xDebugPkiRates(zl5011xParamsS *zl5011xParams, Uint32T portNum);
extern zlStatusE zl5011xDebugRtpStats(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE zl5011xDebugPwStats(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE zl5011xDebugPkcConfig(zl5011xParamsS *zl5011xParams);
extern zlStatusE zl5011xDebugPacketSniffCapture(zl5011xParamsS *zl5011xParams, Uint32T context, Uint32T *buf, Uint32T *length);
extern zlStatusE zl5011xDebugPacketSniff(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE zl5011xDebugPacketTxHeader(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE zl5011xDebugScanTmMsg(zl5011xParamsS *zl5011xParams);
extern zlStatusE zl5011xDebugGranuleInfo(zl5011xParamsS *zl5011xParams);
extern zlStatusE zl5011xDebugDisplayContextStats(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE zl5011xDebugResetContextStats(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE zl5011xDebugDisplayGlobalStats(zl5011xParamsS *zl5011xParams, Uint32T portNum);
extern zlStatusE zl5011xDebugResetGlobalStats(zl5011xParamsS *zl5011xParams, Uint32T portNum);
extern zlStatusE zl5011xDebugDisplayClockInfo(zl5011xParamsS *zl5011xParams, Uint32T context);
extern zlStatusE le1veDignoseClockInfo(UINT32 slot, char * buff);
#define ZL50114_DEVICE_ID (Uint32T)0x61e10a5
LOCAL STATUS checkCardType(int slot)
{
UINT32 deviceId,revisionId;
if ((slot < 1) || (slot > 8))
return ERROR;
if (le1ve_Zl5011xParams[slot - 1] != NULL)
{
zl5011xAdmGetDeviceId(le1ve_Zl5011xParams[slot - 1],
(Uint32T *)&deviceId, (Uint32T *)&revisionId);
if (deviceId == ZL50114_DEVICE_ID)
return (OK);
else
return (ERROR);
}
else
return (ERROR);
}
UINT32 debug_zl5011xRegRead(int slot, int reg)
{
UINT32 value;
ZL5011X_REG_READ(slot, reg, &value);
return(value);
}
void showPkcStt(int slot)
{
if (ERROR == checkCardType(slot))
return ;
printf(" Temp1 Temp2 Temp3 Temp4 Temp5 Temp6 Temp7 Temp8 \n");
printf("Eth Type:%-8d %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n",
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_ETHERTYPE_COUNT),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_ETHERTYPE_COUNT + 0x4),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_ETHERTYPE_COUNT + 0x8),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_ETHERTYPE_COUNT + 0x0c),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_ETHERTYPE_COUNT + 0x10),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_ETHERTYPE_COUNT + 0x14),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_ETHERTYPE_COUNT + 0x18),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_ETHERTYPE_COUNT + 0x1c));
printf("MAC Matc:%-8d %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n",
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_MAC_ADDRESS_COUNT),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_MAC_ADDRESS_COUNT + 0x4),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_MAC_ADDRESS_COUNT + 0x8),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_MAC_ADDRESS_COUNT + 0x0c),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_MAC_ADDRESS_COUNT + 0x10),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_MAC_ADDRESS_COUNT + 0x14),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_MAC_ADDRESS_COUNT + 0x18),
debug_zl5011xRegRead(slot, ZL5011X_PKC_FILTER_MAC_ADDRESS_COUNT + 0x1c));
printf("Pre_clas:%-8d %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n\n",
debug_zl5011xRegRead(slot, ZL5011X_PKC_PROTOCOL_COUNT),
debug_zl5011xRegRead(slot, ZL5011X_PKC_PROTOCOL_COUNT + 0x4),
debug_zl5011xRegRead(slot, ZL5011X_PKC_PROTOCOL_COUNT + 0x8),
debug_zl5011xRegRead(slot, ZL5011X_PKC_PROTOCOL_COUNT + 0x0c),
debug_zl5011xRegRead(slot, ZL5011X_PKC_PROTOCOL_COUNT + 0x10),
debug_zl5011xRegRead(slot, ZL5011X_PKC_PROTOCOL_COUNT + 0x14),
debug_zl5011xRegRead(slot, ZL5011X_PKC_PROTOCOL_COUNT + 0x18),
debug_zl5011xRegRead(slot, ZL5011X_PKC_PROTOCOL_COUNT + 0x1c));
printf("Pre_classifier No-match Counter: %-8d\n",debug_zl5011xRegRead(slot, ZL5011X_PKC_PROTOCOL_NO_MATCH_COUNT));
printf("IP Checksum Failure Counter: %-8d\n",debug_zl5011xRegRead(slot, ZL5011X_PKC_IPV4_CHECKSUM_COUNT));
printf("UDP Checksum Failure Counter: %-8d\n",debug_zl5011xRegRead(slot, ZL5011X_PKC_UDP_CHECKSUM_COUNT));
printf("Classify No-Match Counter: %-8d\n",debug_zl5011xRegRead(slot, ZL5011X_PKC_CLASSIFY_NO_MATCH_COUNT));
printf("Post Verifier Failure Counter: %-8d\n",debug_zl5011xRegRead(slot, ZL5011X_PKC_VERIFY_FAIL_COUNT));
}
void showLanStt(int slot, int port, int mode)
{
UINT32 pkiAddress, regValue;
zl5011xParamsS *pZl5011xParam;
zl5011xMacStatsS *pMacStats; /* pointers to avoid typing */
if (ERROR == checkCardType(slot))
return;
if (port < 1 || port > 2)
{
printf("Error argument!\n");
return;
}
pZl5011xParam = le1ve_Zl5011xParams[slot - 1];
zl5011xPkiReadCounters(pZl5011xParam, port - 1);
pMacStats= &(pZl5011xParam->pki.lanPort[port - 1].macStats);
printf("Early Collisions frames: %-ld\n", pMacStats->collision.lo );
printf("Late Collisions frames: %-ld\n", pMacStats->lateCollision.lo);
printf("Number of packets filtered: %-ld\n", pMacStats->filter.lo);
printf("Dropped frames: %-ld\n", pMacStats->dropEvent.lo);
printf("Number of frames Short Event: %-ld\n", pMacStats->shortEvent.lo);
printf("Number of frames with CRC errors: %-ld\n", pMacStats->crc.lo);
printf("Number of frames with bad alignment:%-ld\n", pMacStats->alignmentError.lo);
printf("Number of TW3: %-ld\n", pMacStats->jabber.lo);
printf("Number of frames with bad FCS: %-ld\n", pMacStats->fragment.lo);
printf("Undersize frames: %-ld\n", pMacStats->undersize.lo);
printf("Over size frames: %-ld\n", pMacStats->oversize.lo);
printf("Frame with length of 64 bytes: %-ld\n", pMacStats->pkts64Octets.lo);
printf("Frame with length in range 65-127 bytes: %-ld\n", pMacStats->pkts65To127Octets.lo);
printf("Frame with length in range 128-255 bytes: %-ld\n", pMacStats->pkts128To255Octets.lo);
printf("Frame with length in range 256-511 bytes: %-ld\n", pMacStats->pkts256To511Octets.lo);
printf("Frame with length in range 512-1023 bytes: %-ld\n", pMacStats->pkts512To1023Octets.lo);
printf("Frame with length in range 1024-1518 bytes: %-ld\n", pMacStats->pkts1024To1518Octets.lo);
printf("Broadcast frames received: %-ld\n", pMacStats->broadcastPktsReceived.lo);
printf("Multicast frames received: %-ld\n", pMacStats->multicastPktsReceived.lo);
printf("Good frames received: %-ld\n", pMacStats->goodPktsReceived.lo);
printf("Good bytes received: %-ld\n", pMacStats->goodOctetsReceived.lo);
printf("Total frames received: %-ld\n", pMacStats->totalPktsReceived.lo);
printf("Total bytes received: %-ld\n", pMacStats->totalOctetsReceived.lo);
printf("Total non-Unicast frames sent: %-ld\n", pMacStats->nUcastPktsSent.lo);
printf("Total Unicast frames sent: %-ld\n", pMacStats->ucastPktsSent.lo);
printf("Flow control frames sent: %-ld\n", pMacStats->flowControlSent.lo);
printf("Number of sent packets that failed: %-ld\n", pMacStats->pktSentFail.lo);
printf("Total bytes sent: %-ld\n", pMacStats->totalOctetsSent.lo);
if (mode == 1) /*read and clear to zero*/
{
pkiAddress = ZL5011X_PKI0_CTRL+ ((port - 1) * sizeof( Uint32T));
zl5011xRead(pZl5011xParam, pkiAddress, (Uint32T *)®Value);
zl5011xWrite(pZl5011xParam, pkiAddress, regValue | (ZL5011X_1BIT_MASK << ZL5011X_PKI_CTRL_REG_STA_RESET));
zl5011xWrite(pZl5011xParam, pkiAddress, regValue &( ~(ZL5011X_1BIT_MASK << ZL5011X_PKI_CTRL_REG_STA_RESET)));
}
}
void showGmStt(int slot)
{
if (ERROR == checkCardType(slot))
return;
printf("starting address of the first(head) granule: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_GRANULE_HEAD));
printf("starting address of the last(tail) granule: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_GRANULE_TAIL));
printf("number of free granules: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_GRANULE_COUNT));
printf("threshold for free granule counter: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_GRANULE_THRESHOLD));
printf("Total granules granted by GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x1c));
printf("Total granules released to GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x20));
printf("Granules granted to PLA by GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x100));
printf("granules granted to PRX by GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x104));
printf("granules granted to CPU by GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x108));
printf("granules granted to PE by GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x10c));
printf("granules released from PLA to GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x110));
printf("granules released from TFM to GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x114));
printf("granules released from TFQ to GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x118));
printf("granules released from PTX to GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x11c));
printf("granules released from PKQ to GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x120));
printf("granules released from PKC to GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x124));
printf("granules released from CPU to GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x128));
printf("granules released from PE to GM: %d\n", debug_zl5011xRegRead(slot,ZL5011X_GM_BASE + 0x12c));
}
void showTfqStt (int slot, int context)
{
zl5011xParamsS *pZl5011xParam;
zl5011xTfqStatsS TfqStats; /* pointers to avoid typing */
if (ERROR == checkCardType(slot))
return;
pZl5011xParam = le1ve_Zl5011xParams[slot - 1];
zl5011xTfqGetStats(pZl5011xParam, context,&TfqStats);
printf("minLen maxLen avgLen latePack earlyPack underruns\n");
printf("%-8ld %-8ld %-8ld %-8ld %-8ld %-8ld\n", TfqStats.minLength,
TfqStats.maxLength, TfqStats.avgLength, TfqStats.latePackets,
TfqStats.earlyPackets, TfqStats.underruns);
}
zlStatusE le1veDebugContextRx(UINT32 slot, Uint32T start, Uint32T end)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -