blob: add7173dbfa94c36d18ca9ac477085d66955204d [file] [log] [blame]
/*******************************************************************************
Copyright (C) Marvell International Ltd. and its affiliates
This software file (the "File") is owned and distributed by Marvell
International Ltd. and/or its affiliates ("Marvell") under the following
alternative licensing terms. Once you have made an election to distribute the
File under one of the following license alternatives, please (i) delete this
introductory statement regarding license alternatives, (ii) delete the two
license alternatives that you have not elected to use and (iii) preserve the
Marvell copyright notice above.
********************************************************************************
Marvell Commercial License Option
If you received this File from Marvell and you have entered into a commercial
license agreement (a "Commercial License") with Marvell, the File is licensed
to you under the terms of the applicable Commercial License.
********************************************************************************
Marvell GPL License Option
If you received this File from Marvell, you may opt to use, redistribute and/or
modify this File in accordance with the terms and conditions of the General
Public License Version 2, June 1991 (the "GPL License"), a copy of which is
available along with the File in the license.txt file or by writing to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or
on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY
DISCLAIMED. The GPL License provides additional details about this warranty
disclaimer.
********************************************************************************
Marvell BSD License Option
If you received this File from Marvell, you may opt to use, redistribute and/or
modify this File under the following licensing terms.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Marvell nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
/******************************************************************************
** FILE : gponOnuLnxKsUI.c **
** **
** DESCRIPTION : This file implements ONU GPON CLI functionality **
*******************************************************************************
* *
* MODIFICATION HISTORY: *
* *
* 29Oct06 Oren Ben Hayun created *
* =========================================================================== *
******************************************************************************/
/* Include Files
------------------------------------------------------------------------------*/
#include "gponOnuHeader.h"
#include "gponOnuGoogle.h"
#ifndef PON_FPGA
#include "mvSysPonConfig.h"
#endif /* PON_FPGA */
/* Local Constant
------------------------------------------------------------------------------*/
#define __FILE_DESC__ "mv_pon/perf/gpon/gponOnuLnxKsUI.c"
/* Global Variables
------------------------------------------------------------------------------*/
extern MV_BOOL onuGponLogEnable;
/* Local Variables
------------------------------------------------------------------------------*/
MV_BOOL infoGponCntReadClearInd = MV_TRUE;
MV_U32 maxPloamsSend = 270;
/* Export Functions
------------------------------------------------------------------------------*/
/* Local Functions
------------------------------------------------------------------------------*/
/******************************************************************************/
/* ========================================================================== */
/* Info Commands */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** onuGponUiInfoShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu information
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiInfoShow(char* buf)
{
MV_U8 *stateText[] = {"",
"INITIAL",
"STANDBY",
"SERIAL NUMBER",
"RANGING",
"OPERATION",
"POPUP",
"EMERGENCY STOP"};
MV_U8 *boolText[] = {"FALSE","TRUE"};
MV_U8 serialNumber[8];
MV_U8 password[10];
MV_U32 onuId,onuState;
MV_BOOL init,omcc,snMaskEnable,snMaskMatchMode;
MV_U32 berInt, dummy,omccPort;
MV_U32 guard,pre1Size;
MV_U32 pre2Size,pre3RaSize,pre3OpSize,pre3Pat;
MV_U32 dbDelimiter,asicDelimiter,sd,sf;
MV_U32 intDelay,eqdDb,eqdAsic,fDelay;
MV_U32 snMsg[3], idleMsg[3];
MV_U8 *mchText[] = {"NO MATCH","MATCH "};
MV_U16 ponIdTxOpticalLevel;
MV_U8 ponIdTypeAbit;
MV_U8 ponIdClassType;
MV_U8 ponIdBytes[ONU_GPON_PON_ID_BYTES_LEN];
int off = 0;
onuGponDbSerialNumGet(serialNumber);
onuState = onuGponDbOnuStateGet();
onuId = onuGponDbOnuIdGet();
init = onuGponDbInitGet();
omcc = onuGponDbOmccValidGet();
omccPort = onuGponDbOmccPortGet();
snMaskEnable = onuGponDbSerialNumberMaskEnableGet();
snMaskMatchMode = onuGponDbSerialNumberMaskMatchGet();
onuGponDbPasswordGet(password);
guard = onuGponDbGuardBitsGet();
berInt = onuGponDbBerIntervalGet();
onuGponDbPreambleGet(ONU_GPON_PREM_TYPE_01,&dummy,&pre1Size);
onuGponDbPreambleGet(ONU_GPON_PREM_TYPE_02,&dummy,&pre2Size);
onuGponDbPreambleGet(ONU_GPON_PREM_TYPE_03,&pre3Pat,&dummy);
pre3OpSize = onuGponDbExtPreambleOperGet();
pre3RaSize = onuGponDbExtPreambleSyncGet();
sd = onuGponDbSdThresholdGet();
sf = onuGponDbSfThresholdGet();
intDelay = onuGponDbConstDelayGet();
eqdDb = onuGponDbEqualizationDelayGet();
mvOnuGponMacRxEqualizationDelayGet(&eqdAsic);
mvOnuGponMacTxFinalDelayGet(&fDelay);
dbDelimiter = onuGponDbDelimiterGet(ONU_GPON_DELM_BYTE_01) |
(onuGponDbDelimiterGet(ONU_GPON_DELM_BYTE_02) << 8) |
(onuGponDbDelimiterGet(ONU_GPON_DELM_BYTE_03) << 16);
mvOnuGponMacTxDelimiterGet(&asicDelimiter,&dummy);
onuGponDbSnMsgGet(snMsg);
onuGponDbIdleMsgGet(idleMsg);
// PON-ID Manufacturer info
ponIdTypeAbit = onuGponDbPONIdTypeABitGet();
ponIdClassType = onuGponDbPONIdClassTypeGet();
onuGponDbPONIdBytesInfoGet(&(ponIdBytes[0]));
ponIdTxOpticalLevel = onuGponDbPONIdOpticalLevelGet();
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "ONT Full Information:\n");
off += mvOsSPrintf(buf+off, "---------------------\n");
off += mvOsSPrintf(buf+off, "SN[VENDOR ID]: %02X:%02X:%02X:%02X [%c%c%c%c]\n",
serialNumber[0],serialNumber[1],serialNumber[2],serialNumber[3],
serialNumber[0],serialNumber[1],serialNumber[2],serialNumber[3]);
off += mvOsSPrintf(buf+off, "SN[Serial Number]: %02X:%02X:%02X:%02X\n",
serialNumber[4],serialNumber[5],serialNumber[6],serialNumber[7]);
off += mvOsSPrintf(buf+off, "ONU ID: %d\n", onuId);
off += mvOsSPrintf(buf+off, "ONU STATE: %d [%s]\n", onuState, stateText[onuState]);
off += mvOsSPrintf(buf+off, "INIT STATE: %s\n", boolText[init]);
off += mvOsSPrintf(buf+off, "OMCC Valid: %s\n", boolText[omcc]);
off += mvOsSPrintf(buf+off, "OMCC Port: %d\n", omccPort);
off += mvOsSPrintf(buf+off, "Password: %02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X.%02X\n",
password[0],password[1],password[2],password[3],password[4],
password[5],password[6],password[7],password[8],password[9]);
off += mvOsSPrintf(buf+off, "BER Interval: %d\n", berInt);
off += mvOsSPrintf(buf+off, "SD Threshold: %d\n", sd);
off += mvOsSPrintf(buf+off, "SF Threshold: %d\n", sf);
off += mvOsSPrintf(buf+off, "Guard Bits: %d\n", guard);
off += mvOsSPrintf(buf+off, "Preamble Type1 Size: %d\n", pre1Size);
off += mvOsSPrintf(buf+off, "Preamble Type2 Size: %d\n", pre2Size);
off += mvOsSPrintf(buf+off, "Preamble Type3 Pattern: 0x%02X\n", pre3Pat);
off += mvOsSPrintf(buf+off, "Preamble Type3 Range Size: %d\n", pre3RaSize);
off += mvOsSPrintf(buf+off, "Preamble Type3 Oper Size: %d\n", pre3OpSize);
off += mvOsSPrintf(buf+off, "Delimiter: 0x%08X [0x%08X]\n", dbDelimiter, asicDelimiter);
off += mvOsSPrintf(buf+off, "Internal Delay: %d [0x%x]\n", intDelay, intDelay);
off += mvOsSPrintf(buf+off, "Equalization Delay: %d [0x%x] (HW:0x%x)\n", eqdDb, eqdDb, eqdAsic);
off += mvOsSPrintf(buf+off, "Final Delay: %d\n", fDelay);
off += mvOsSPrintf(buf+off, "Const Idle Ploam: [0x%08X][0x%08X][0x%08X]\n", idleMsg[0],idleMsg[1],idleMsg[2]);
off += mvOsSPrintf(buf+off, "Const Serial Number Ploam: [0x%08X][0x%08X][0x%08X]\n", snMsg[0],snMsg[1],snMsg[2]);
off += mvOsSPrintf(buf+off, "Serial Number Mask Enable: %s\n", boolText[snMaskEnable]);
off += mvOsSPrintf(buf+off, "Serial Number Mask Match Mode: %s\n", mchText [snMaskMatchMode]);
off += mvOsSPrintf(buf+off, "Debug Mode: %s\n", boolText[onuGponPonMngDebugModeGet()]);
off += mvOsSPrintf(buf+off, "Overhead Manual Mode: %s\n", boolText[onuGponPonMngOverheadManualModeGet()]);
off += mvOsSPrintf(buf+off, "ponIdTypeAbit: %d\n", ponIdTypeAbit);
off += mvOsSPrintf(buf+off, "ponIdClassType: %s (%d)\n", onuGponDbPONIdClassTypeStrGet(), ponIdClassType);
off += mvOsSPrintf(buf+off, "ponIdTxOpticalLevel: 0x%02X\n", ponIdTxOpticalLevel);
off += mvOsSPrintf(buf+off, "ponIdBytes: [0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x]\n",
ponIdBytes[0], ponIdBytes[1], ponIdBytes[2], ponIdBytes[3],
ponIdBytes[4], ponIdBytes[5], ponIdBytes[6]);
return(off);
}
/*******************************************************************************
**
** onuGponUiAlarmShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu alarms
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiAlarmShow(char* buf)
{
MV_STATUS rcode;
MV_U32 alarms;
MV_U32 iAlarm;
MV_U8 *alarmText[] = {"LOS ","LOF ","LCDA","LCDG"," SF "," SD "," TF ",
"SUF ","MEM ","DACT","DIS ","MIS ","PEE ","RDI "};
MV_U8 *statusText[] = {"OFF","ON "};
MV_U32 status;
int off = 0;
rcode = onuGponApiAlarmsGet(&alarms);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get alarms status, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "------------------\n");
off += mvOsSPrintf(buf+off, "|ONU ALARMS: |\n");
off += mvOsSPrintf(buf+off, "------------------\n");
off += mvOsSPrintf(buf+off, "| ALARM | STATUS |\n");
off += mvOsSPrintf(buf+off, "------------------\n");
for (iAlarm = 0 ; iAlarm < ONU_GPON_MAX_ALARMS ; iAlarm++)
{
status = (alarms >> iAlarm) & 0x01;
off += mvOsSPrintf(buf+off, " %s | %s |\n", alarmText[iAlarm], statusText[status]);
}
off += mvOsSPrintf(buf+off, "------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiFifoShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function prints US PLOAM statistics
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiFifoShow(char* buf)
{
S_MacFifoCtrl* fifo;
int auditEn, auditAc, fifoSup;
int msgSend, allocFifo, freeFifo, ploamSend;
int off = 0;
mvOnuGponMacFifoGetInfo(&fifo, &fifoSup);
mvOnuGponMacFifoGetStat(&msgSend, &allocFifo, &freeFifo, &ploamSend);
mvOnuGponMacFifoAuditGetStat(&auditEn, &auditAc);
if (fifoSup)
{
off += mvOsSPrintf(buf+off, "===========================\n");
off += mvOsSPrintf(buf+off, "GPON SW FIFO\n");
off += mvOsSPrintf(buf+off, "===========================\n");
off += mvOsSPrintf(buf+off, "FIFO size %d\n", GPON_SW_FIFO_SIZE);
off += mvOsSPrintf(buf+off, "Write index %d\n", fifo->fifoWriteIndex);
off += mvOsSPrintf(buf+off, "Read index %d\n", fifo->fifoReadIndex);
off += mvOsSPrintf(buf+off, "Repeating cycle number %d\n", fifo->fifoReparoundNum);
off += mvOsSPrintf(buf+off, "===========================\n");
off += mvOsSPrintf(buf+off, "FIFO Audit Enter cnt. %d\n", auditEn);
off += mvOsSPrintf(buf+off, "FIFO Audit Action cnt. %d\n", auditAc);
}
off += mvOsSPrintf(buf+off, "===========================\n");
off += mvOsSPrintf(buf+off, "US msg. send cnt. %d\n", msgSend);
if (fifoSup)
{
off += mvOsSPrintf(buf+off, "Add to SW FIFO cnt. %d\n", allocFifo);
off += mvOsSPrintf(buf+off, "Free SW FIFO cnt. %d\n", freeFifo);
}
off += mvOsSPrintf(buf+off, "Add to HW FIFO cnt. %d\n", ploamSend);
off += mvOsSPrintf(buf+off, "===========================\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiFecStatus
** ____________________________________________________________________________
**
** DESCRIPTION: The function prints DS FEC Statsus
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiFecStatus(char* buf)
{
MV_U32 fecMode;
int off = 0;
onuGponApiFecStatusGet(&fecMode);
off += mvOsSPrintf(buf+off, "GPON FEC Status - %s\n", (fecMode == 0) ? ("Off") : ("On"));
return(off);
}
/*******************************************************************************
**
** onuGponUiInfoHelpShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print info help
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiInfoHelpShow(char* buf)
{
int off = 0;
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, "Display Commands: cat <file>\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, " cat info - dump onu information\n");
off += mvOsSPrintf(buf+off, " cat alarm - dump onu alarms\n");
off += mvOsSPrintf(buf+off, " cat fecStatus - dump onu fec status\n");
off += mvOsSPrintf(buf+off, " cat swfifo - dump onu SW FIFO info\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
return(off);
}
/******************************************************************************/
/* ========================================================================== */
/* PM Commands */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** onuGponUiCountersReadClearFlag
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu FEC counters
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: void
**
*******************************************************************************/
void onuGponUiCountersReadClearFlag(MV_BOOL clear)
{
infoGponCntReadClearInd = clear;
}
/*******************************************************************************
**
** onuGponBwMapCountersEnDisFlag
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu FEC counters
**
** PARAMETERS: MV_BOOL enable
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS onuGponBwMapCountersEnDisFlag(MV_BOOL enable)
{
return (onuGponApiPmRxBwMapPmDumpSet(enable));
}
/*******************************************************************************
**
** onuGponUiFecCountersShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu FEC counters
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiFecCountersShow(char* buf)
{
MV_STATUS rcode;
S_GponIoctlFecPm counters;
int off = 0;
MV_U8 *counterText[] = {"FEC received Bytes ",
"FEC corrected Bytes ",
"FEC corrected Bits ",
"FEC received CodeWords ",
"FEC uncorrected CodeWords"};
rcode = onuGponApiPmFecPmGet(&counters,infoGponCntReadClearInd);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get counters value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "------------------\n");
off += mvOsSPrintf(buf+off, "| FEC COUNTERS: |\n");
off += mvOsSPrintf(buf+off, "--------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| COUNTER | VALUE |\n");
off += mvOsSPrintf(buf+off, "--------------------------------------------\n");
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[0],counters.receivedBytes);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[1],counters.correctedBytes);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[2],counters.correctedBits);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[3],counters.receivedCodeWords);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[4],counters.uncorrectedCodeWords);
off += mvOsSPrintf(buf+off, "--------------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiRxPloamCountersShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu Rx Ploam counters
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiRxPloamCountersShow(char* buf)
{
MV_STATUS rcode;
S_GponIoctlPloamRxPm counters;
S_GponIoctlPloamTxPm countDummy;
MV_U32 MsgId;
int off = 0;
MV_U8 *counterText[] = {"Idle Ploam Counter ",
"CRC Error Ploam Counter ",
"FIFO Overflaw Error Ploam Counter ",
"received Broadcast Ploam Counter ",
"Received Onu Id Ploam Counter "};
MV_U8 *msgIdCntText = {"Total PLOAM "};
MV_U8 *msgIdText[] = {"ERROR PLOAM ",
"OVERHEAD ",
"SN_MASK ",
"ASSIGN_ONU_ID ",
"RANGING_TIME ",
"DACT_ONU_ID ",
"DIS_SN ",
"CONFIG_VP_VC ",
"ENCRYPT_VPI_PORT_ID",
"REQ_PASSWORD ",
"ASSIGN_ALLOC_ID ",
"NO_MESSAGE ",
"POPUP ",
"REQ_KEY ",
"CONFIG_PORT_ID ",
"PHYSICAL_EQUIP_ERR ",
"CHANGE_POWER_LEVEL ",
"PST ",
"BER_INTERVAL ",
"KEY_SWITCH_TIME ",
"EXT_BURST_LEN "};
rcode = onuGponApiPmRxPloamPmGet(&counters, infoGponCntReadClearInd);
rcode |= onuGponApiAdvancedPloamsCounterGet(&countDummy, &counters, infoGponCntReadClearInd);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get counters value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "-------------------------\n");
off += mvOsSPrintf(buf+off, "|RX PLOAM COUNTERS: |\n");
off += mvOsSPrintf(buf+off, "------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| HW COUNTERS | VALUE |\n");
off += mvOsSPrintf(buf+off, "------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[0],counters.rxIdlePloam);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[1],counters.rxCrcErrorPloam);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[2],counters.rxFifoOverErrorPloam);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[3],counters.rxBroadcastPloam);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[4],counters.rxOnuIdPloam);
off += mvOsSPrintf(buf+off, "------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| SW COUNTERS | VALUE |\n");
off += mvOsSPrintf(buf+off, "--------------------------------------\n");
off += mvOsSPrintf(buf+off, " %s | %10u |\n", msgIdCntText, counters.rxMsgTotalPloam);
for (MsgId = 0; MsgId <= ONU_GPON_DS_MSG_LAST; MsgId++)
off += mvOsSPrintf(buf+off, " %s | %10u |\n", msgIdText[MsgId], counters.rxMsgIdPloam[MsgId]);
off += mvOsSPrintf(buf+off, "--------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiTxPloamCountersShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu Tx Ploam counters
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiTxPloamCountersShow(char* buf)
{
MV_STATUS rcode;
S_GponIoctlPloamRxPm countDummy;
S_GponIoctlPloamTxPm counters;
MV_U32 MsgId;
int off = 0;
MV_U8 *msgIdText[] = {"Total Ploams Recived",
"SN_ONU ",
"PASSWORD ",
"DYING_GASP ",
"NO_MESSAGE ",
"ENCRYPT_KEY ",
"PHYSICAL_EQUIP_ERR ",
"PST ",
"REI ",
"ACK "};
rcode = onuGponApiAdvancedPloamsCounterGet(&counters, &countDummy, infoGponCntReadClearInd);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get counters value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "-------------------------\n");
off += mvOsSPrintf(buf+off, "|TX PLOAM COUNTERS: |\n");
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
off += mvOsSPrintf(buf+off, "| COUNTER | VALUE |\n");
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
off += mvOsSPrintf(buf+off, " %s | %10d |\n", msgIdText[0], counters.txMsgTotalPloam);
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
off += mvOsSPrintf(buf+off, "| TX Error | VALUE |\n");
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
for (MsgId=1;MsgId <= ONU_GPON_US_MSG_LAST; MsgId++)
{
off += mvOsSPrintf(buf+off, " %s | %10d |\n", msgIdText[MsgId], counters.txErrMsgIdPloam[MsgId]);
}
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
off += mvOsSPrintf(buf+off, "| TX Correct | VALUE |\n");
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
for (MsgId=1;MsgId <= ONU_GPON_US_MSG_LAST; MsgId++)
{
off += mvOsSPrintf(buf+off, " %s | %10d |\n", msgIdText[MsgId], counters.txMsgIdPloam[MsgId]);
}
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiBwMapCountersShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu bw map counters
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiBwMapCountersShow(char* buf)
{
MV_STATUS rcode;
S_GponIoctlBwMapPm counters;
int off = 0;
MV_U8 *counterText[] = {"Alloc Crc Error ",
"Alloc Correctable Crc Error ",
"Alloc UnCorrectable Crc Error ",
"Alloc Correct ",
"Total Received Alloc Bytes "};
rcode = onuGponApiPmRxBwMapPmGet(&counters, infoGponCntReadClearInd);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get counters value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "----------------------\n");
off += mvOsSPrintf(buf+off, "| BWMAP COUNTERS: |\n");
off += mvOsSPrintf(buf+off, "------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| COUNTER | VALUE |\n");
off += mvOsSPrintf(buf+off, "------------------------------------------------\n");
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[0],counters.allocCrcErr);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[1],counters.allocCorrectableCrcErr);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[2],counters.allocUnCorrectableCrcErr);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[3],counters.allocCorrec);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[4],counters.totalReceivedAllocBytes);
off += mvOsSPrintf(buf+off, "------------------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiStandardCountersShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu standard counters
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiStandardCountersShow(char* buf)
{
MV_STATUS rcode;
S_RxStandardApiPm counters;
int off = 0;
MV_U8 *counterText[] = {"bip8 Error Counter ",
"plend Counter "};
rcode = onuGponApiPmRxStandardPmGet(&counters, infoGponCntReadClearInd);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get counters value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "-------------------------\n");
off += mvOsSPrintf(buf+off, "|STANDARD COUNTERS: |\n");
off += mvOsSPrintf(buf+off, "-----------------------------------------\n");
off += mvOsSPrintf(buf+off, "| COUNTER | VALUE |\n");
off += mvOsSPrintf(buf+off, "-----------------------------------------\n");
off += mvOsSPrintf(buf+off, " %s | %8u |\n", counterText[0],counters.bip8);
off += mvOsSPrintf(buf+off, " %s | %8u |\n",counterText[1],counters.plend);
off += mvOsSPrintf(buf+off, "-----------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiGemCountersShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu gem counters
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiGemCountersShow(char* buf)
{
MV_STATUS rcode;
S_GponIoctlGemRxPm counters;
int off = 0;
MV_U8 *counterText[] = {"Received Idle Gem Frames ",
"Received Valid Gem Frames ",
"Received Undefined Gem Frames ",
"Received Omci Frames ",
"Dropped Gem Frames ",
"Dropped Omci Frames ",
"Received Gem Frames With Uncorr Hec Error ",
"Received Gem Frames With One Fixed Hec Error ",
"Received Gem Frames With Two Fixed Hec Error ",
"Received Valid Gem Frames Total Byte Count ",
"Received Undefined Gem Frames Total Byte Count ",
"Gem Reassemble Memory Flush ",
"Gem Synch Lost ",
"Received Eth Frames With Correct FCS ",
"Received Eth Frames With FCS Error ",
"Received Omci Frames With Correct CRC ",
"Received Omci Frames With CRC Error "};
rcode = onuGponApiGemRxCounterGet(&counters, infoGponCntReadClearInd);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get counters value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "----------------------\n");
off += mvOsSPrintf(buf+off, "|GEM COUNTERS: |\n");
off += mvOsSPrintf(buf+off, "------------------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| COUNTER | VALUE |\n");
off += mvOsSPrintf(buf+off, "------------------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[0], counters.gemRxIdleGemFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[1], counters.gemRxValidGemFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[2], counters.gemRxUndefinedGemFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[3], counters.gemRxOmciFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[4], counters.gemRxDroppedGemFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[5], counters.gemRxDroppedOmciFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[6], counters.gemRxGemFramesWithUncorrHecErr);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[7], counters.gemRxGemFramesWithOneFixedHecErr);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[8], counters.gemRxGemFramesWithTwoFixedHecErr);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[9], counters.gemRxTotalByteCountOfReceivedValidGemFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[10],counters.gemRxTotalByteCountOfReceivedUndefinedGemFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[11],counters.gemRxGemReassembleMemoryFlush);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[12],counters.gemRxGemSynchLost);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[13],counters.gemRxEthFramesWithCorrFcs);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[14],counters.gemRxEthFramesWithFcsError);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[15],counters.gemRxOmciFramesWithCorrCrc);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[16],counters.gemRxOmciFramesWithCrcError);
off += mvOsSPrintf(buf+off, "------------------------------------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiTxCountersShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu tx counters
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiTxCountersShow(char* buf)
{
MV_STATUS rcode;
S_GponIoctlGemTxPm counters;
MV_BOOL exist;
MV_U32 tcont;
int off = 0;
MV_U8 *counterText[] = {"Transmitted Gem Pti Type-1 Frames ",
"Transmitted Gem Pti Type-0 Frames ",
"Transmitted Idle Gem Frames ",
"Transmitted Eth Frames Via Tcont ",
"Transmitted Eth Bytes Via Tcont ",
"Transmitted Gem Frames Via Tcont ",
"Transmitted Idle Gem Frames Via Tcont "};
rcode = onuGponApiGemTxCounterGet(&counters, infoGponCntReadClearInd);
if (rcode != MV_OK) {
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get counters value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "----------------------\n");
off += mvOsSPrintf(buf+off, "|TX COUNTERS: |\n");
off += mvOsSPrintf(buf+off, "------------------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| COUNTER | VALUE |\n");
off += mvOsSPrintf(buf+off, "------------------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[0],counters.gemTxGemPtiTypeOneFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[1],counters.gemTxGemPtiTypeZeroFrames);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[2],counters.gemTxIdleGemFrames);
for (tcont = 0; tcont < ONU_GPON_MAX_NUM_OF_T_CONTS; tcont++) {
rcode = onuGponDbBwTcontExist(tcont, &exist);
if ((rcode == MV_OK) && (exist != MV_FALSE)) {
off += mvOsSPrintf(buf+off, "T-Cont [%d] Counters |\n", tcont);
off += mvOsSPrintf(buf+off, "------------------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[3],counters.gemTxEthFramesViaTconti[tcont]);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[4],counters.gemTxEthBytesViaTconti[tcont]);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[5],counters.gemTxGemFramesViaTconti[tcont]);
off += mvOsSPrintf(buf+off, " %s | %10u |\n", counterText[6],counters.gemTxIdleGemFramesViaTconti[tcont]);
}
}
off += mvOsSPrintf(buf+off, "------------------------------------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiRawCounters
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu counters
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiRaw_1Counters(char* buf)
{
MV_U32 suspected;
MV_U32 decided;
S_RxPloamPm inRxPloamCounters;
S_RxBwMapPm inRxBwMapCounters;
S_RxBip8Pm inBip8Counter;
S_RxPlendPm inPlendCounter;
S_RxFecPm inRxFecCounters;
S_GemPm gemCounters;
int off = 0;
decided = onuGponPonMngrFifoErrCountersGet(&suspected);
onuGponPmFecPmGet(&inRxFecCounters);
onuGponPmRxBwMapPmGet(&inRxBwMapCounters);
onuGponPmRxBip8PmGet(&inBip8Counter);
onuGponPmRxPlendPmGet(&inPlendCounter);
onuGponPmRxPloamPmGet(&inRxPloamCounters);
onuGponPmGemPmGet(&gemCounters);
off += mvOsSPrintf(buf+off, "ONT GPON Counters\n");
off += mvOsSPrintf(buf+off, "----------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "PLOAM FIFO SYNC ERROR SUSPECTED: %u\n", suspected);
off += mvOsSPrintf(buf+off, "PLOAM FIFO SYNC ERROR DECIDED: %u\n", decided);
off += mvOsSPrintf(buf+off, "This ONU ID PLOAMs: %u\n", inRxPloamCounters.receivedOnuIdPloamCounter);
off += mvOsSPrintf(buf+off, "Broadcast PLOAMs: %u\n", inRxPloamCounters.receivedBroadcastPloamCounter);
off += mvOsSPrintf(buf+off, "Idles PLOAMs: %u\n", inRxPloamCounters.idlePloamCounter);
off += mvOsSPrintf(buf+off, "CRC Error PLOAMs: %u\n", inRxPloamCounters.crcErrorPloamCounter);
off += mvOsSPrintf(buf+off, "FIFO Full Dropped PLOAMs: %u\n", inRxPloamCounters.fifoOverErrorPloamCounter);
off += mvOsSPrintf(buf+off, "BW Error Free Allocs: %u\n", inRxBwMapCounters.allocCorrec);
off += mvOsSPrintf(buf+off, "BW Uncorrectable Allocs: %u\n", inRxBwMapCounters.allocUnCorrectableCrcErr);
off += mvOsSPrintf(buf+off, "BW Bad CRC Allocs: %u\n", inRxBwMapCounters.allocCrcErr);
off += mvOsSPrintf(buf+off, "BW Error Free and Correctable Allocs: %u\n", inRxBwMapCounters.allocCorrectableCrcErr);
off += mvOsSPrintf(buf+off, "BW Total Allocation: %u\n", inRxBwMapCounters.totalReceivedAllocBytes);
off += mvOsSPrintf(buf+off, "Bip8: %u\n", inBip8Counter.bip8);
off += mvOsSPrintf(buf+off, "Plend: %u\n", inPlendCounter.plend);
off += mvOsSPrintf(buf+off, "FEC correctedBits: %u\n", inRxFecCounters.correctedBits);
off += mvOsSPrintf(buf+off, "FEC correctedBytes: %u\n", inRxFecCounters.correctedBytes);
off += mvOsSPrintf(buf+off, "FEC receivedBytes: %u\n", inRxFecCounters.receivedBytes);
off += mvOsSPrintf(buf+off, "FEC receivedCodeWords: %u\n", inRxFecCounters.receivedCodeWords);
off += mvOsSPrintf(buf+off, "FEC uncorrectedCodeWords: %u\n", inRxFecCounters.uncorrectedCodeWords);
off += mvOsSPrintf(buf+off, "GEM Received Idle Gem Frames %u\n", gemCounters.receivedIdleGemFrames);
off += mvOsSPrintf(buf+off, "GEM Received Valid Gem Frames %u\n", gemCounters.receivedValidGemFrames);
off += mvOsSPrintf(buf+off, "GEM Received Undefined Gem Frames %u\n", gemCounters.receivedUndefinedGemFrames);
off += mvOsSPrintf(buf+off, "GEM Received Omci Frames %u\n", gemCounters.receivedOmciFrames);
off += mvOsSPrintf(buf+off, "GEM Dropped Gem Frames %u\n", gemCounters.droppedGemFrames);
off += mvOsSPrintf(buf+off, "GEM Dropped Omci Frames %u\n", gemCounters.droppedOmciFrames);
off += mvOsSPrintf(buf+off, "GEM Received Gem Frames With Uncorr Hec Error %u\n", gemCounters.receivedGemFramesWithUncorrHecErr);
off += mvOsSPrintf(buf+off, "GEM Received Gem Frames With One Fixed Hec Error %u\n", gemCounters.receivedGemFramesWithOneFixedHecErr);
off += mvOsSPrintf(buf+off, "GEM Received Gem Frames With Two Fixed Hec Error %u\n", gemCounters.receivedGemFramesWithTwoFixedHecErr);
off += mvOsSPrintf(buf+off, "GEM Received Valid Gem Frames Total Byte Count %u\n", gemCounters.totalByteCountOfReceivedValidGemFrames);
off += mvOsSPrintf(buf+off, "GEM Received Undefined Gem Frames Total Byte Count %u\n", gemCounters.totalByteCountOfReceivedUndefinedGemFrames);
off += mvOsSPrintf(buf+off, "GEM Gem Reassemble Memory Flush %u\n", gemCounters.gemReassembleMemoryFlush);
off += mvOsSPrintf(buf+off, "GEM Gem Synch Lost %u\n", gemCounters.gemSynchLost);
off += mvOsSPrintf(buf+off, "GEM Received Eth Frames With Correct FCS %u\n", gemCounters.receivedEthFramesWithCorrFcs);
off += mvOsSPrintf(buf+off, "GEM Received Eth Frames With FCS Error %u\n", gemCounters.receivedEthFramesWithFcsError);
off += mvOsSPrintf(buf+off, "GEM Received Omci Frames With Correct CRC %u\n", gemCounters.receivedOmciFramesWithCorrCrc);
off += mvOsSPrintf(buf+off, "GEM Received Omci Frames With CRC Error %u\n", gemCounters.receivedOmciFramesWithCrcError);
return(off);
}
int onuGponUiRaw_2Counters(char* buf)
{
S_GponTxPm txCounters;
MV_U32 tcont;
int off = 0;
onuGponPmTxPmGet(&txCounters);
off += mvOsSPrintf(buf+off, "ONT GPON Raw Counters\n");
off += mvOsSPrintf(buf+off, "----------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "Transmitted Gem Pti Type-1 Frames %u\n", txCounters.transmittedGemPtiTypeOneFrames);
off += mvOsSPrintf(buf+off, "Transmitted Gem Pti Type-0 Frames %u\n", txCounters.transmittedGemPtiTypeZeroFrames);
off += mvOsSPrintf(buf+off, "Transmitted Idle Gem Frames %u\n", txCounters.transmittedIdleGemFrames);
off += mvOsSPrintf(buf+off, "Transmitted Tx Enable Count %u\n", txCounters.transmittedTxEnableCount);
for (tcont = 0; tcont < ONU_GPON_MAX_NUM_OF_T_CONTS; tcont++)
{
off += mvOsSPrintf(buf+off, "T-Cont [%d] Counters \n", tcont);
off += mvOsSPrintf(buf+off, "----------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "Transmitted Eth Frames Via Tcont %u\n", txCounters.transmittedEthFramesViaTconti[tcont]);
off += mvOsSPrintf(buf+off, "Transmitted Eth Bytes Via Tcont %u\n", txCounters.transmittedEthBytesViaTconti[tcont]);
off += mvOsSPrintf(buf+off, "Transmitted Gem Frames Via Tcont %u\n", txCounters.transmittedGemFramesViaTconti[tcont]);
off += mvOsSPrintf(buf+off, "Transmitted Idle Gem Frames Via Tcont %u\n", txCounters.transmittedIdleGemFramesViaTconti[tcont]);
}
return(off);
}
/*******************************************************************************
**
** onuGponUiPmHelpShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print pm help
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiPmHelpShow(char* buf)
{
int off = 0;
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, "Configuration Commands[DEC]\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, " echo [state] > cntRdClrFlState - onu counters flag, Read[0], Read Clear[1]\n");
off += mvOsSPrintf(buf+off, " echo [state] > bwMapCntByState - dump bw map counters before changing ONU state\n");
off += mvOsSPrintf(buf+off, " Disable[0], Enable[1] \n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, "Display Commands: cat <file>\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, " cat rxPloamCnt - dump Rx PLOAM counters\n");
off += mvOsSPrintf(buf+off, " cat txPloamCnt - dump Tx PLOAM counters\n");
off += mvOsSPrintf(buf+off, " cat bwMapCnt - dump bw map counters\n");
off += mvOsSPrintf(buf+off, " cat stdCnt - dump standard counters\n");
off += mvOsSPrintf(buf+off, " cat fecCnt - dump fec counters\n");
off += mvOsSPrintf(buf+off, " cat gemCnt - dump gem counters\n");
off += mvOsSPrintf(buf+off, " cat txCnt - dump Tx counters\n");
off += mvOsSPrintf(buf+off, " cat rawCnt_1 - dump raw counters\n");
off += mvOsSPrintf(buf+off, " cat rawCnt_2 - dump raw counters\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
return(off);
}
/******************************************************************************/
/* ========================================================================== */
/* Data Commands */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** onuGponUiTcontConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu tcont <--> alloc
**
** PARAMETERS: MV_U32 alloc
** MV_U32 tcont
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiTcontConfig(MV_U32 alloc, MV_U32 tcont)
{
MV_STATUS rcode;
rcode = onuGponApiTcontConfig(alloc, tcont);
if (rcode != MV_OK)
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"ONU Allocation Id(%d) to T-CONT(%d) Config - FAIL\n", alloc, tcont);
}
/*******************************************************************************
**
** onuGponUiClearTcontConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function clear onu tcont
**
** PARAMETERS: MV_U32 tcont
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiClearTcontConfig(MV_U32 tcont)
{
MV_STATUS rcode;
rcode = onuGponApiTcontClear(tcont);
if (rcode != MV_OK)
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"ONU T-CONT(%d) Clear - FAIL\n", tcont);
}
/*******************************************************************************
**
** onuGponUiResetTcontsConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function reset onu bw map table
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiResetTcontsConfig(void)
{
onuGponApiTcontsReset();
}
/*******************************************************************************
**
** onuGponUiDebugTcont
** ____________________________________________________________________________
**
** DESCRIPTION: The function handle onu tcont
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiDebugTcont(char* buf)
{
MV_U32 allocId;
MV_U32 idleAllocId;
MV_U32 validCount = 0;
MV_BOOL valid;
MV_BOOL exist;
MV_U32 i;
MV_U8 *boolText[2] = {"NO ","YES"};
MV_U32 fAllocId;
MV_BOOL fEna;
MV_U32 fTcont;
MV_U32 knowTcont;
MV_U8 *knowTcontText[] = {"T-CONT 0 ","T-CONT 1 ","T-CONT 2 ",
"T-CONT 3 ","T-CONT 4 ","T-CONT 5 ",
"T-CONT 6 ","T-CONT 7 ","T-CONT 8 ",
"T-Def ","T-Idle "};
int off = 0;
MV_STATUS status;
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
off += mvOsSPrintf(buf+off, "| Alloc Id Table |\n");
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
off += mvOsSPrintf(buf+off, "| Assigned || Idle |\n");
off += mvOsSPrintf(buf+off, "|-----------------------------------|\n");
off += mvOsSPrintf(buf+off, "| ALLOC-ID | Valid || |\n");
off += mvOsSPrintf(buf+off, "|-----------------------------------|\n");
for (i = 0 ; i < ONU_GPON_MAX_NUM_OF_T_CONTS; i++) {
onuGponDbBwAllocGet(i, &allocId, &valid);
onuGponDbBwIdleAllocGet(i, &idleAllocId);
if (idleAllocId != PON_ONU_ALLOC_NOT_EXIST) {
off += mvOsSPrintf(buf+off, "| %04d | %3s || %04d |\n",
allocId, boolText[valid], idleAllocId);
} else {
off += mvOsSPrintf(buf+off, "| %04d | %3s || ==== |\n",
allocId, boolText[valid]);
}
}
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
off += mvOsSPrintf(buf+off, "| Alloc Id to T-CONT Connect Table |\n");
off += mvOsSPrintf(buf+off, "|-----------------------------------|\n");
off += mvOsSPrintf(buf+off, "| T-CONT | Exist | ALLOC-ID | Valid |\n");
off += mvOsSPrintf(buf+off, "|-----------------------------------|\n");
for (i = 0 ; i < ONU_GPON_MAX_NUM_OF_T_CONTS; i++) {
onuGponDbBwTcontGet(i, &exist, &allocId, &valid);
off += mvOsSPrintf(buf+off, "| %02d | %s | %04d | %s |\n", i, boolText[exist], allocId, boolText[valid]);
if (valid != MV_FALSE) validCount++;
}
off += mvOsSPrintf(buf+off, "-------------------------------------\n");
off += mvOsSPrintf(buf+off, "----------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| BW MAC - SoC Table | |\n");
off += mvOsSPrintf(buf+off, "|-----------------------------------| |\n");
off += mvOsSPrintf(buf+off, "| Index | ALLOC-ID | T-CONT | Valid | KNOWN T-CONT |\n");
off += mvOsSPrintf(buf+off, "|--------------------------------------------------|\n");
for (i = 0 ; i < ONU_GPON_MAX_NUM_OF_T_CONTS ; i++) {
status = mvOnuGponMacRxBwMapGet(i, &fAllocId, &fEna, &fTcont);
if (status != MV_OK)
off += mvOsSPrintf(buf+off, "Error calling mvOnuGponMacRxBwMapGet, Tcont(%d)\n", i);
if (fTcont == PON_ONU_DEFAULT_ALLOC_TCONT)
knowTcont = 9;
else {
if ((fTcont == onuGponIdleAllocIdTcontGet()) && (validCount < 8))
knowTcont = 10;
else
knowTcont = fTcont;
}
off += mvOsSPrintf(buf+off, "| %02d | %04d | %02d | %s | %s |\n",
i,fAllocId, fTcont, boolText[fEna],knowTcontText[knowTcont]);
}
off += mvOsSPrintf(buf+off, "----------------------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiDebugGemPortidValidSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function enable gem port Id valid configuration
**
** PARAMETERS: MV_U32 portId
** MV_U32 enable
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugGemPortidValidSet(MV_U32 portId, MV_U32 enable)
{
if (enable != 0) onuGponApiGemPortIdConfig(portId);
else onuGponApiGemPortIdClear(portId);
}
/*******************************************************************************
**
** onuGponUiDebugGemPortidValidSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function enable gem port Id valid configuration
**
** PARAMETERS: MV_U32 enable
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugAllGemPortidValidSet(MV_U32 enable)
{
MV_U32 portId;
if (enable != 0) {
for (portId = 0; portId < 4096; portId++)
onuGponApiGemPortIdConfig(portId);
} else {
for (portId = 0; portId < 4096; portId++)
onuGponApiGemPortIdClear(portId);
}
}
/*******************************************************************************
**
** onuGponUiDebugGemPmSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function start or stop Gem PM.
**
** PARAMETERS: MV_U32 portId
** MV_U32 enable
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugGemPmSet(MV_U32 portId, MV_U32 enable)
{
S_GponIoctlGemPortPmConfig gemPm;
gemPm.gem_port = portId;
if(enable !=0)
gemPm.command = GEMPORTPMCMD_START;
else
gemPm.command = GEMPORTPMCMD_STOP;
onuGponApiGemPortPmConfig(&gemPm);
}
/*******************************************************************************
**
** onuGponUiDebugGemPmReset
** ____________________________________________________________________________
**
** DESCRIPTION: The function resets GEM PM MIB counters
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugGemPmReset(void)
{
onuGponApiGemPortPmReset();
}
/*******************************************************************************
**
** onuGponUiDebugGemPmListShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function prints Gem PM ports enabled to collect MIB counters
**
** PARAMETERS: MV_U32 portId
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
int onuGponUiDebugGemPmListShow(char* buf)
{
S_apiGemPortPmConfig gemPortCfg;
int off = 0;
MV_U16 dbIdx;
MV_STATUS rc;
off += mvOsSPrintf(buf+off, "GEM port ids list\n");
off += mvOsSPrintf(buf+off, "=================\n");
off += mvOsSPrintf(buf+off, " Counter GEM \n");
off += mvOsSPrintf(buf+off, " set port \n");
off += mvOsSPrintf(buf+off, "=================\n");
for (dbIdx = 0; dbIdx < MAX_SUPPORTED_GEMPORTS_FOR_PM; dbIdx++)
{
rc = onuGponPmGemPortPmConfigGet(dbIdx, &gemPortCfg);
if (rc == MV_OK)
{
off += mvOsSPrintf(buf+off, " %d %d\n", dbIdx, gemPortCfg.gem_port);
}
}
off += mvOsSPrintf(buf+off, "=================\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiDebugGemPmGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function prints Gem PM counters
**
** PARAMETERS: MV_U32 portId
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugGemPmGet(MV_U32 portId)
{
S_GponIoctlGemPortMibCounters mibCounters;
MV_STATUS rcode;
MV_U8 *counterText[] = {"Received Eth broadcast Frames ",
"Received Eth multicast Frames ",
"Received Eth good Frames ",
"Received Eth good Frames length 65-127 "};
memset(&mibCounters, 0, sizeof(S_GponIoctlGemPortMibCounters));
mibCounters.gem_port = portId;
rcode = onuGponApiGemPortPmGet(&mibCounters);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get mibCounters value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
mvOsPrintf("\n");
mvOsPrintf("------------------------------------------------------------------\n");
mvOsPrintf("|MIB COUNTERS for GEM port: %d\n", portId);
mvOsPrintf("------------------------------------------------------------------\n");
mvOsPrintf("|COUNTER | VALUE |\n");
mvOsPrintf("------------------------------------------------------------------\n");
mvOsPrintf(" %s | %10u |\n", counterText[0], mibCounters.broadcast_frames_received);
mvOsPrintf(" %s | %10u |\n", counterText[1], mibCounters.multicast_frames_received);
mvOsPrintf(" %s | %10u |\n", counterText[2], mibCounters.good_frames_received);
mvOsPrintf(" %s | %10u |\n", counterText[3], mibCounters.frames_65_to_127_octets);
mvOsPrintf("------------------------------------------------------------------\n");
}
/*******************************************************************************
**
** onuGponUiDebugGemPortid
** ____________________________________________________________________________
**
** DESCRIPTION: The function return gem port Id valid configuration
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiDebugGemPortid(char* buf, int range)
{
MV_BOOL enable;
MV_U32 portId;
MV_U32 startRange;
MV_U32 endRange;
int off = 0;
off += mvOsSPrintf(buf+off, "GEM port ids list\n");
off += mvOsSPrintf(buf+off, "=================\n");
switch (range)
{
case 1: startRange = 1000; endRange = 1999; break;
case 2: startRange = 2000; endRange = 2999; break;
case 3: startRange = 3000; endRange = 4096; break;
default: startRange = 0; endRange = 999; break;
}
for (portId = startRange ; portId < endRange ; portId++)
{
enable = mvOnuGponMacPortIdValidGet(portId);
if (enable == MV_TRUE) off += mvOsSPrintf(buf+off, "[%04d]", portId);
if ((portId / 14) == 0) off += mvOsSPrintf(buf+off, "\n");
}
off += mvOsSPrintf(buf+off, "\n");
return(off);
}
#ifdef MV_GPON_STATIC_GEM_PORT
/*******************************************************************************
**
** onuGponUiDebugDummyGemPortFlagSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set dummy gem port flag
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugDummyGemPortFlagSet(MV_U32 flag)
{
onuGponApiGemPortIdStaticConfigFlag(flag);
}
/*******************************************************************************
**
** onuGponUiDebugDummyGemPortReset
** ____________________________________________________________________________
**
** DESCRIPTION: The function reset dummy gem port table
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: OK or ERROR
**
*******************************************************************************/
void onuGponUiDebugDummyGemPortReset(void)
{
onuGponApiGemPortIdStaticConfigReset();
}
#endif /* MV_GPON_STATIC_GEM_PORT */
/*******************************************************************************
**
** onuGponUiDataHelpShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print data help
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiDataHelpShow(char* buf)
{
int off = 0;
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, "Configuration Commands[DEC]\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, " echo [AllocId] [T-Cont] > cfgTcont - config alloc to tcont\n");
off += mvOsSPrintf(buf+off, " echo [T-Cont] > clrTcont - clear alloc Ids from T-Cont\n");
off += mvOsSPrintf(buf+off, " echo [0] > rstTcont - clear T-Cont configuration\n");
off += mvOsSPrintf(buf+off, " echo [GemPort] [Valid] > cfgGem - config gem port valid state, Disable[0], Enable[1]\n");
off += mvOsSPrintf(buf+off, " echo [Valid] > cfgAllGem - config all gem ports valid state, Disable[0], Enable[1]\n");
off += mvOsSPrintf(buf+off, " echo [gemport] [state] > cfgMibPm - Config onu gem port for MIB PM: start count[1], stop count[0]\n");
off += mvOsSPrintf(buf+off, " echo [dummy] > resetMibPm - Reset MIB PM\n");
off += mvOsSPrintf(buf+off, " echo [gemport] > getMibPm - Get MIB PM for a Gem port\n");
#ifdef MV_GPON_STATIC_GEM_PORT
off += mvOsSPrintf(buf+off, " echo [state] > dummyGemState - static gem port flag, Disable[0], Enable[1]\n");
off += mvOsSPrintf(buf+off, " echo [0] > dummyGemRst - clear static gem port table\n");
#endif /* MV_GPON_STATIC_GEM_PORT */
off += mvOsSPrintf(buf+off, " echo [PortId] [State] > cfgAesPort - config gem port encryption state\n");
off += mvOsSPrintf(buf+off, " echo [State] > cfgAllAes - config all gem ports encryption state\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, "Display Commands: cat <file>\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, " cat showTcont - dump T-Cont configuration\n");
off += mvOsSPrintf(buf+off, " cat showMibGemPorts - dump a list of gem ports enabled for MIB PM\n");
off += mvOsSPrintf(buf+off, " cat showGem0xxx showGem1xxx showGem2xxx showGem3xxx - dump valid gem port list\n");
off += mvOsSPrintf(buf+off, " cat showAes0xxx showAes1xxx showAes2xxx showAes3xxx - dump encrypted gem port list\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
return(off);
}
/******************************************************************************/
/* ========================================================================== */
/* Introp Commands */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** onuGponUiOverrideShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu override parameters info
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiOverrideShow(char* buf)
{
MV_U8 *parametersText[] = {"ExtendedBurst",
"Delimiter ",
"OnuId ",
"OmccPortId ",
"EqualizationDelay"};
MV_U8 *enableText[] = {"disabled","enabled"};
MV_U32 tempValue1;
MV_U32 tempValue2;
MV_U32 status;
int off = 0;
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "--------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| ONU OVERRIDE: |\n");
off += mvOsSPrintf(buf+off, "--------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| PARAMETER | VALUE | STATUS |\n");
off += mvOsSPrintf(buf+off, "--------------------------------------------\n");
tempValue1 = onuGponDbExtendedBurstOperOverrideValueGet();
tempValue2 = onuGponDbExtendedBurstSyncOverrideValueGet();
status = (MV_U32)onuGponDbExtendedBurstOverrideGet();
off += mvOsSPrintf(buf+off, "| %s SYNC | %8u | %s |\n", parametersText[0], tempValue1, enableText[status]);
off += mvOsSPrintf(buf+off, "| %s OPER | %8u | %s |\n", parametersText[0], tempValue2, enableText[status]);
tempValue1 = onuGponDbDelimiterOverrideValueGet();
status = (MV_U32)onuGponDbDelimiterOverrideGet();
off += mvOsSPrintf(buf+off, "| %s | %8u | %s |\n", parametersText[1], tempValue1, enableText[status]);
tempValue1 = onuGponDbOnuIdOverrideValueGet();
status = (MV_U32)onuGponDbOnuIdOverrideGet();
off += mvOsSPrintf(buf+off, "| %s | %8u | %s |\n", parametersText[2], tempValue1, enableText[status]);
tempValue1 = onuGponDbOmccPortOverrideValueGet();
status = (MV_U32)onuGponDbOmccPortOverrideGet();
off += mvOsSPrintf(buf+off, "| %s | %8u | %s |\n", parametersText[3], tempValue1, enableText[status]);
tempValue1 = onuGponDbEqualizationDelayOverrideValueGet();
status = (MV_U32)onuGponDbEqualizationDelayOverrideGet();
off += mvOsSPrintf(buf+off, "| %s | %8u | %s |\n", parametersText[4], tempValue1, enableText[status]);
off += mvOsSPrintf(buf+off, "--------------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiDelimiterConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu delimiter
**
** PARAMETERS: MV_U32 enable
** MV_U32 DelValue
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDelimiterConfig(MV_U32 enable, MV_U32 DelValue)
{
onuGponApiDelimiterSet((MV_BOOL)enable, DelValue);
}
/*******************************************************************************
**
** onuGponUiOnuIdConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu Id
**
** PARAMETERS: MV_U32 onuId
** MV_U32 enable
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiOnuIdConfig(MV_U32 onuId, MV_U32 enable)
{
onuGponApiOnuIdSet((MV_BOOL)enable, onuId);
}
/*******************************************************************************
**
** onuGponUiPortIdConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu omcc port Id
**
** PARAMETERS: MV_U32 portId
** MV_U32 enable
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiPortIdConfig(MV_U32 portId, MV_U32 enable)
{
onuGponApiOmccPortIdSet((MV_BOOL)enable, portId);
}
/*******************************************************************************
**
** onuGponUiEquDelaySetConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu equalization delay
**
** PARAMETERS: MV_U32 equDelayVal
** MV_U32 enable
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiEquDelaySetConfig(MV_U32 equDelayVal, MV_U32 enable)
{
onuGponApiEqualizationDelaySet((MV_BOOL)enable, equDelayVal);
}
/*******************************************************************************
**
** onuGponUiEquDelayChangeConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function change onu equalization delay
**
** PARAMETERS: MV_U32 direction
** MV_U32 size
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiEquDelayChangeConfig(MV_U32 direction, MV_U32 size)
{
onuGponApiEqualizationDelayChange(direction, size);
}
/*******************************************************************************
**
** onuGponUiExtendedBurstConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu extended burst
**
** PARAMETERS: MV_U32 enable
** MV_U32 rangeValue
** MV_U32 operValue
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiExtendedBurstConfig(MV_U32 enable, MV_U32 rangeValue, MV_U32 operValue)
{
onuGponApiExtendedBurstSet ((MV_BOOL)enable, rangeValue, operValue);
}
/*******************************************************************************
**
** onuGponUiExtendedBurstDelayConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure delay for the received onu extended burst
**
** PARAMETERS: MV_U32 enable
** MV_U32 rangeValue
** MV_U32 operValue
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiExtendedBurstDelayConfig(MV_U32 enable, MV_U32 rangeValue, MV_U32 operValue)
{
onuGponApiExtendedBurstDelaySet ((MV_BOOL)enable, rangeValue, operValue);
}
/*******************************************************************************
**
** onuGponUiDebugOverheadMode
** ____________________________________________________________________________
**
** DESCRIPTION: The function handle onu overhead mode
**
** PARAMETERS: MV_U32 overMode
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugOverheadMode(MV_U32 overMode)
{
MV_BOOL mode = (overMode == 0)? MV_FALSE : MV_TRUE;
onuGponPonMngOverheadManualModeSet(mode);
}
/*******************************************************************************
**
** onuGponUiDebugOverheadGuard
** ____________________________________________________________________________
**
** DESCRIPTION: The function handle onu overhead guard bits
**
** PARAMETERS: MV_U32 guard
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugOverheadGuard(MV_U32 guard)
{
onuGponDbGuardBitsSet(guard);
}
/*******************************************************************************
**
** onuGponUiDebugOverheadPreamble
** ____________________________________________________________________________
**
** DESCRIPTION: The function handle onu overhead preamble
**
** PARAMETERS: MV_U32 pream3RangeCnt
** MV_U32 pream3OperCnt
** MV_U32 pream3PattCnt
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugOverheadPreamble(MV_U32 pream3RangeCnt,
MV_U32 pream3OperCnt,
MV_U32 pream3PattCnt)
{
MV_U32 onuState;
onuGponDbPreambleSet(ONU_GPON_PREM_TYPE_03, pream3PattCnt, 0);
onuGponDbExtPreambleSyncSet(pream3RangeCnt);
onuGponDbExtPreambleOperSet(pream3OperCnt);
onuState = onuGponDbOnuStateGet();
if (onuState == ONU_GPON_05_OPERATION) mvOnuGponMacPreambleType3Set(pream3PattCnt,pream3OperCnt);
else mvOnuGponMacPreambleType3Set(pream3PattCnt,pream3RangeCnt);
}
/*******************************************************************************
**
** onuGponUiIntropHelpShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print introp help
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiIntropHelpShow(char* buf)
{
int off = 0;
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, "Configuration Commands[DEC]\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, " echo [OnuId] [Enable] > onuIdCfg - override configured OnuId\n");
off += mvOsSPrintf(buf+off, " echo [PortId] [Enable] > portIdCfg - override configured omcc portId\n");
off += mvOsSPrintf(buf+off, " echo [EquDelay] [Enable] > eqdCfg - override configured Equ Delay\n");
off += mvOsSPrintf(buf+off, " echo [Direction] [Size] > eqdChange - change Equ Delay\n");
off += mvOsSPrintf(buf+off, " echo [Enable] [RangeValue] [OperValue] > extBurstCfg - override configured external burst\n");
off += mvOsSPrintf(buf+off, " echo [Enable] [RangeValue] [OperValue] > extBurstDelayCfg - add configured delay to received external burst\n");
off += mvOsSPrintf(buf+off, " echo [Enable] [Value] > delimiterCfg - override configured delimiter\n");
off += mvOsSPrintf(buf+off, " echo [RangeValue] [OperValue] [Pattern] > preambleCfg - override configured preamble type3\n");
off += mvOsSPrintf(buf+off, " echo [Guard Bits] > guardCfg - configure guard bits\n");
off += mvOsSPrintf(buf+off, " echo [Mode] > manModeCfg - configure override parameters mode\n");
off += mvOsSPrintf(buf+off, " echo [Mode] > adminCfg - configure onu Tx mode:(0)Enable, (1)Disable\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, "Display Commands: cat <file>\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, " cat manMode - override parameters mode\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
return(off);
}
/******************************************************************************/
/* ========================================================================== */
/* Protocol Commands */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** onuGponUiDebugBurstConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu tx burst
**
** PARAMETERS: MV_U32 start
** MV_U32 stop
** MV_U32 order
** MV_U32 polarity
** MV_U32 mask
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugBurstConfig(MV_U32 start,
MV_U32 stop,
MV_U32 order,
MV_U32 polarity,
MV_U32 mask)
{
S_apiBurstConfig burstConfig;
burstConfig.start = start;
burstConfig.stop = stop;
burstConfig.order = order;
burstConfig.polarity = polarity;
burstConfig.mask = mask;
onuGponApiBurstConfigSet(&burstConfig);
}
/*******************************************************************************
**
** onuGponUiDebugBurstInfo
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu tx burst info
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiDebugBurstInfo(char* buf)
{
S_apiBurstConfig burstConfig;
int off = 0;
onuGponApiBurstConfigGet(&burstConfig);
off += mvOsSPrintf(buf+off, "----------------------------------------------\n");
off += mvOsSPrintf(buf+off, "| Burst Parameters |\n");
off += mvOsSPrintf(buf+off, "|--------------------------------------------|\n");
off += mvOsSPrintf(buf+off, "| Start | Stop | Order |Polarity| Mask |\n");
off += mvOsSPrintf(buf+off, "|--------------------------------------------|\n");
off += mvOsSPrintf(buf+off, "| %02d | %02d | %02d | %02d | %02d |\n",
burstConfig.start, burstConfig.stop, burstConfig.order,
burstConfig.polarity, burstConfig.mask);
off += mvOsSPrintf(buf+off, "|--------------------------------------------|\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiInfoBerDebug
** ____________________________________________________________________________
**
** DESCRIPTION: The function get Global OLT BER Information
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiInfoBerDebug(char* buf)
{
S_BerCoefficient coeff;
MV_U32 seconds;
MV_U32 ber;
MV_U32 intervalBer;
MV_U32 bip,lastBip;
MV_U32 sdThreshold;
MV_U32 sfThreshold;
MV_U32 sdDetectValue;
MV_U32 sdCancelValue;
MV_U32 sfDetectValue;
MV_U32 sfCancelValue;
int off = 0;
coeff = onuGponBerCoefficientGet();
seconds = onuGponBerIntervalSecondsGet();
sdThreshold = onuGponDbSdThresholdGet();
sfThreshold = onuGponDbSfThresholdGet();
sdDetectValue = onuGponBerPower(10 ,(11 - sdThreshold));
sdCancelValue = onuGponBerPower(10 ,(11 - sdThreshold - 1));
sfDetectValue = onuGponBerPower(10 ,(11 - sfThreshold));
sfCancelValue = onuGponBerPower(10 ,(11 - sfThreshold - 1));
ber = onuGponBerBerValueGet();
intervalBer = onuGponBerIntervalBerValueGet();
bip = onuGponBerBip8CounterGet();
lastBip = onuGponBerLastIntervalBip8CounterGet();
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "----------------------------------------\n");
off += mvOsSPrintf(buf+off, "| BER Information |\n");
off += mvOsSPrintf(buf+off, "|--------------------------------------|\n");
off += mvOsSPrintf(buf+off, "|Interval of %2d Seconds |\n", seconds);
off += mvOsSPrintf(buf+off, "|Coefficient is %2d/%2d |\n", coeff.numerator, coeff.denominator);
off += mvOsSPrintf(buf+off, "-----------------------------------------------------\n");
off += mvOsSPrintf(buf+off, "|Interval BER| BER | BIP8 | Inter.BIP8 |\n");
off += mvOsSPrintf(buf+off, "-----------------------------------------------------\n");
off += mvOsSPrintf(buf+off, " %010u | %010u | %010u | %010u |\n", intervalBer, ber ,bip, lastBip);
off += mvOsSPrintf(buf+off, "------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, " | DET SD TH | CNC SD TH | DET SF TH | CNC SF TH |\n");
off += mvOsSPrintf(buf+off, "------------------------------------------------------\n");
off += mvOsSPrintf(buf+off, " %010u | %010u | %010u | %010u |\n", sdDetectValue, sdCancelValue, sfDetectValue, sfCancelValue);
off += mvOsSPrintf(buf+off, "------------------------------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiDebugBerIntervalDebug
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu ber interval
**
** PARAMETERS: MV_U32 interval
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugBerIntervalDebug(MV_U32 interval)
{
onuGponApiBerIntervalConfig(interval);
}
/*******************************************************************************
**
** onuGponUiDebugBerCoefficientDebug
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu ber coefficient
**
** PARAMETERS: MV_U32 numerator
** MV_U32 denominator
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugBerCoefficientDebug(MV_U32 numerator, MV_U32 denominator)
{
onuGponApiBerCoefficientConfig(denominator,numerator);
}
/*******************************************************************************
**
** onuGponUiBerThresholdsConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu ber thresholds
**
** PARAMETERS: MV_U32 sd
** MV_U32 sf
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiBerThresholdsConfig(MV_U32 sd, MV_U32 sf)
{
onuGponApiBerThresholdConfig(sd, sf);
}
/*******************************************************************************
**
** onuGponUiDebugAesSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function handle onu AES port configuration
**
** PARAMETERS: MV_U32 portId
** MV_U32 enable
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugAesSet(MV_U32 portId, MV_U32 enable)
{
MV_STATUS rcode = MV_OK;
MV_BOOL enaBool;
MV_BOOL valid;
/* to start AES on a port Id, it should be valid */
if (enable == 1)
{
valid = onuGponDbGemPortValidGet(portId);
if (valid != MV_TRUE)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"Set GEM Port AES: Port(%d) is not Valid\n", portId);
return;
}
}
enaBool = (enable == 0) ? MV_FALSE : MV_TRUE;
rcode = mvOnuGponMacAesPortIdSet(portId, enaBool);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"Set GEM Port AES: Port(%d) enable(%d) failed\n", portId, enable);
}
onuGponDbGemPortAesSet(portId, enaBool);
}
/*******************************************************************************
**
** onuGponUiDebugAesSetAll
** ____________________________________________________________________________
**
** DESCRIPTION: The function handle onu AES port configuration
**
** PARAMETERS: MV_U32 enable
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugAesSetAll(MV_U32 enable)
{
MV_STATUS rcode = MV_OK;
MV_BOOL enaBool;
MV_BOOL valid;
MV_U32 portId;
for (portId = 0; portId < 4096; portId++)
{
/* to start AES on a port Id, it should be valid */
if (enable == 1)
{
valid = onuGponDbGemPortValidGet(portId);
if (valid != MV_TRUE)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"Set GEM Port AES: Port(%d) is not Valid\n", portId);
return;
}
}
enaBool = (enable == 0) ? MV_FALSE : MV_TRUE;
rcode = mvOnuGponMacAesPortIdSet(portId, enaBool);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"Set GEM Port AES: Port(%d) enable(%d) failed\n", portId, enable);
}
onuGponDbGemPortAesSet(portId,enaBool);
}
}
/*******************************************************************************
**
** onuGponUiDebugAesGemAll
** ____________________________________________________________________________
**
** DESCRIPTION: The function return a list of all gem port AES and status
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiDebugAesGemAll(char* buf, int range)
{
MV_U32 portId;
MV_BOOL enable;
MV_U32 startRange;
MV_U32 endRange;
int off = 0;
off += mvOsSPrintf(buf+off, "Encrypted GEM port ids list\n");
off += mvOsSPrintf(buf+off, "===========================\n");
switch (range)
{
case 1: startRange = 1000; endRange = 1999; break;
case 2: startRange = 2000; endRange = 2999; break;
case 3: startRange = 3000; endRange = 4096; break;
default: startRange = 0; endRange = 999; break;
}
for (portId = startRange ; portId < endRange ; portId++)
{
if (onuGponDbGemPortValidGet(portId)== MV_TRUE) {
enable = onuGponDbGemPortAesGet(portId);
if (enable == MV_TRUE) off += mvOsSPrintf(buf+off, "[%04d]", portId);
}
if ((portId / 14) == 0) off += mvOsSPrintf(buf+off, "\n");
}
return(off);
}
/*******************************************************************************
**
** onuGponUiDebugManagerSendPloam
** ____________________________________________________________________________
**
** DESCRIPTION: The function transmit US ploam message
**
** PARAMETERS: MV_U32 msgId
** MV_U32 onuId
** MV_U32 data1
** MV_U32 data2
** MV_U32 data3
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugManagerSendPloam(MV_U32 msgId,
MV_U32 onuId,
MV_U32 data1,
MV_U32 data2,
MV_U32 data3)
{
MV_U8 msgData[12];
MV_STATUS rcode;
msgData[0] = (MV_U8)((data1 >> 24) & 0xFF);
msgData[1] = (MV_U8)((data1 >> 16) & 0xFF);
msgData[2] = (MV_U8)((data1 >> 8) & 0xFF);
msgData[3] = (MV_U8)((data1) & 0xFF);
msgData[4] = (MV_U8)((data2 >> 24) & 0xFF);
msgData[5] = (MV_U8)((data2 >> 16) & 0xFF);
msgData[6] = (MV_U8)((data2 >> 8) & 0xFF);
msgData[7] = (MV_U8)((data2) & 0xFF);
msgData[8] = (MV_U8)((data3 >> 24) & 0xFF);
msgData[9] = (MV_U8)((data3 >> 16) & 0xFF);
msgData[10] = (MV_U8)((data3 >> 8) & 0xFF);
msgData[11] = (MV_U8)((data3) & 0xFF);
rcode = mvOnuGponMacMessageSend(onuId, msgId, msgData);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"mvOnuGponMacMessageSend failed\n");
}
}
/*******************************************************************************
**
** onuGponUiDebugManagerReceivePloam
** ____________________________________________________________________________
**
** DESCRIPTION: The function receive DS ploam message
**
** PARAMETERS: MV_U32 msgId
** MV_U32 onuId
** MV_U32 data1
** MV_U32 data2
** MV_U32 data3
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugManagerReceivePloam(MV_U32 msgId,
MV_U32 onuId,
MV_U32 data1,
MV_U32 data2,
MV_U32 data3)
{
MV_U8 msgData[12];
msgData[0] = (MV_U8)((data1 >> 24) & 0xFF);
msgData[1] = (MV_U8)((data1 >> 16) & 0xFF);
msgData[2] = (MV_U8)((data1 >> 8) & 0xFF);
msgData[3] = (MV_U8)((data1) & 0xFF);
msgData[4] = (MV_U8)((data2 >> 24) & 0xFF);
msgData[5] = (MV_U8)((data2 >> 16) & 0xFF);
msgData[6] = (MV_U8)((data2 >> 8) & 0xFF);
msgData[7] = (MV_U8)((data2) & 0xFF);
msgData[8] = (MV_U8)((data3 >> 24) & 0xFF);
msgData[9] = (MV_U8)((data3 >> 16) & 0xFF);
msgData[10] = (MV_U8)((data3 >> 8) & 0xFF);
msgData[11] = (MV_U8)((data3) & 0xFF);
onuGponPonMngPloamProcess((MV_U8)onuId, (MV_U8)msgId, msgData);
}
/*******************************************************************************
**
** onuGponUiDebugManagerRcvBurstPloams
** ____________________________________________________________________________
**
** DESCRIPTION: The function receives DS ploam messages
**
** PARAMETERS: MV_U32 msgId
** MV_U32 onuId
** MV_U32 data1
** MV_U32 data2
** MV_U32 data3
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugManagerRcvBurstPloams(MV_U32 msgId,
MV_U32 onuId,
MV_U32 data1,
MV_U32 data2,
MV_U32 data3)
{
int i;
for (i=0; i<maxPloamsSend; i++) {
onuGponUiDebugManagerReceivePloam(msgId, onuId, data1, data2, data3);
}
}
/*******************************************************************************
**
** onuGponUiDebugManagerRcvBurstCfg
** ____________________________________________________________________________
**
** DESCRIPTION: The function configures DS PLOAM burst size
**
** PARAMETERS: MV_U32 size
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugManagerRcvBurstCfg(MV_U32 size)
{
maxPloamsSend = size;
}
/*******************************************************************************
**
** onuGponUiDebugManagerFifoCntsClear
** ____________________________________________________________________________
**
** DESCRIPTION: The function clears SW FIFO counters
**
** PARAMETERS: MV_U32 size
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugManagerFifoCntsClear(MV_U32 value)
{
mvOnuGponMacFifoCountersSet(value);
}
/*******************************************************************************
**
** onuGponUiDebugManagerFifoSupportSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function enables or disables SW FIFO support
**
** PARAMETERS: MV_U32 size
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugManagerFifoSupportSet (MV_U32 enDis)
{
mvOnuGponMacFifoSupportSet(enDis);
}
/*******************************************************************************
**
** onuGponUiDebugManagerAcCouplingSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function configures TX AC coupling parameters
**
** PARAMETERS: MV_U32 mode
** MV_U32 time
** MV_U32 pattern1
** MV_U32 pattern2
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugManagerAcCouplingSet(MV_U32 mode, MV_U32 time, MV_U32 pattern1, MV_U32 pattern2)
{
mvOnuGponMacTxConfigAcCouplingSet(mode, time, pattern1, pattern2);
}
/*******************************************************************************
**
** onuGponUiDebugManagerAcCouplingGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function prints TX AC coupling parameters
**
** PARAMETERS: char *buf
**
** OUTPUTS: char *buf
**
** RETURNS: None
**
*******************************************************************************/
int onuGponUiDebugManagerAcCouplingGet(char *buf)
{
int off = 0;
MV_U32 mode, time;
MV_U8 pattern1, pattern2;
MV_STATUS status;
status = mvOnuGponMacTxConfigAcCouplingGet(&mode, &time, &pattern1, &pattern2);
if (status != MV_OK)
off += mvOsSPrintf(buf+off, "Failed to obtain AC coupling configuration!\n");
else {
off += mvOsSPrintf(buf+off, "------------------------------------\n");
off += mvOsSPrintf(buf+off, "| AC Coupling Parameters (HEX val) |\n");
off += mvOsSPrintf(buf+off, "|-----------------------------------|\n");
off += mvOsSPrintf(buf+off, "| Mode | Time | Pattern1 | Pattern2 |\n");
off += mvOsSPrintf(buf+off, "|-----------------------------------|\n");
off += mvOsSPrintf(buf+off, "| %02x | %04x | %02x | %02x |\n",
mode, time, pattern1, pattern2);
off += mvOsSPrintf(buf+off, "|-----------------------------------|\n");
}
return(off);
}
/*******************************************************************************
**
** onuGponUiDebugManagerActiveTxBitmapSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function configures UTM Active TX Bitmap
**
** PARAMETERS: MV_U32 bitmap - bitmap
** MV_U32 valid - valid
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugManagerActiveTxBitmapSet(MV_U32 bitmap, MV_U32 valid)
{
mvOnuGponMacUtmActiveTxBitmapSet(bitmap);
mvOnuGponMacUtmActiveTxBitmapValidSet(valid);
}
/*******************************************************************************
**
** onuGponUiDebugManagerActiveTxBitmapGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function prints UTM Active TX bitmap
**
** PARAMETERS: char *buf
**
** OUTPUTS: char *buf
**
** RETURNS: None
**
*******************************************************************************/
int onuGponUiDebugManagerActiveTxBitmapGet(char *buf)
{
int off = 0;
MV_U32 bitmap, valid;
MV_STATUS status;
status = mvOnuGponMacUtmActiveTxBitmapConfigGet(&bitmap, &valid);
if (status != MV_OK)
off += mvOsSPrintf(buf+off, "Failed to obtain UTM Active TX bitmap!\n");
else
off += mvOsSPrintf(buf+off, "UTM Active TX bitmap = %#x valid = %d\n", bitmap, valid);
return(off);
}
/*******************************************************************************
**
** onuGponUiGemOmciPortIdConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function change onu omci port Id
**
** PARAMETERS: MV_U32 portId
** MV_U32 valid
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiGemOmciPortIdConfig(MV_U32 portId, MV_U32 valid)
{
mvOnuGponMacGemOmciPortIdSet(portId, valid); /* Rx */
mvOnuGponMacUtmOmciPortIdSet(portId, valid); /* Tx */
onuGponDbOmccPortSet(portId);
onuGponDbOmccValidSet(valid);
}
/*******************************************************************************
**
** onuGponUiGemOmciPortIdShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu omcc port Id
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiGemOmciPortIdShow(char* buf)
{
MV_STATUS rcode;
MV_U32 gemPortId;
MV_U32 gemPortValid;
MV_U32 utmPortId;
MV_U32 utmPortValid;
int off = 0;
rcode = mvOnuGponMacGemOmciPortIdGet(&gemPortId, &gemPortValid);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get Rx(gem) omci portId, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
rcode = mvOnuGponMacUtmOmciPortIdGet(&utmPortId, &utmPortValid);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get Tx(Utm) omci portId, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "OMCI Rx(Gem) PortId %8d valid %s\n", gemPortId, (gemPortValid == 0) ? ("FALSE") : ("TRUE"));
off += mvOsSPrintf(buf+off, "OMCI Tx(Utm) PortId %8d valid %s\n", utmPortId, (utmPortValid == 0) ? ("FALSE") : ("TRUE"));
return(off);
}
/*******************************************************************************
**
** onuGponUiGemFrameLengthShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print onu frame lengths
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiGemFrameLengthShow(char* buf)
{
MV_STATUS rcode;
MV_U32 payloadlen;
MV_U32 maxEthFrameLen;
MV_U32 minEthFrameLen;
MV_U32 maxOmciFrameLen;
MV_U32 minOmciFrameLen;
int off = 0;
rcode = mvOnuGponMacGemPayloadLenGet(&payloadlen);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get gem payload length value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
rcode = mvOnuGponMacGemEthFrameLenGet(&maxEthFrameLen, &minEthFrameLen);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get ethernet frame length value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
rcode = mvOnuGponMacGemOmciFrameLenGet(&maxOmciFrameLen, &minOmciFrameLen);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to get omci frame value, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
off += mvOsSPrintf(buf+off, "\n");
off += mvOsSPrintf(buf+off, "----------------------\n");
off += mvOsSPrintf(buf+off, "|Frame Length |\n");
off += mvOsSPrintf(buf+off, "-----------------------------------\n");
off += mvOsSPrintf(buf+off, "| Frame | VALUE |\n");
off += mvOsSPrintf(buf+off, "-----------------------------------\n");
off += mvOsSPrintf(buf+off, "Gem payload | %10d |\n", payloadlen);
off += mvOsSPrintf(buf+off, "Gem min eth frame | %10d |\n", minEthFrameLen);
off += mvOsSPrintf(buf+off, "Gem max eth frame | %10d |\n", maxEthFrameLen);
off += mvOsSPrintf(buf+off, "Gem min omci frame | %10d |\n", minOmciFrameLen);
off += mvOsSPrintf(buf+off, "Gem max omci frame | %10d |\n", maxOmciFrameLen);
off += mvOsSPrintf(buf+off, "-----------------------------------\n");
return(off);
}
/*******************************************************************************
**
** onuGponUiGemPayloadLenConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function change onu gem payload length
**
** PARAMETERS: MV_U32 payloadLen
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiGemPayloadLenConfig(MV_U32 payloadLen)
{
mvOnuGponMacGemPayloadLenSet(payloadLen);
}
/*******************************************************************************
**
** onuGponUiGemEthFrameLenConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function change onu ethernet min/max frame length
**
** PARAMETERS: MV_U32 minFrameLenArg
** MV_U32 maxFrameLenArg
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiGemEthFrameLenConfig(MV_U32 minFrameLenArg, MV_U32 maxFrameLenArg)
{
mvOnuGponMacGemEthFrameLenSet(maxFrameLenArg, minFrameLenArg);
}
/*******************************************************************************
**
** onuGponUiGemOmciFrameLenConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function change onu omci min/max frame length
**
** PARAMETERS: MV_U32 minFrameLenArg
** MV_U32 maxFrameLenArg
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiGemOmciFrameLenConfig(MV_U32 minFrameLenArg, MV_U32 maxFrameLenArg)
{
mvOnuGponMacGemOmciFrameLenSet(maxFrameLenArg, minFrameLenArg);
}
/*******************************************************************************
**
** onuGponUiProtoHelpShow
** ____________________________________________________________________________
**
** DESCRIPTION: The function print protocol help
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: message length
**
*******************************************************************************/
int onuGponUiProtoHelpShow(char* buf)
{
int off = 0;
MV_U32 devId = mvCtrlModelGet();
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, "Configuration Commands[DEC]\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, " echo [BER Interval] > berIntervalCfg - config ber interval\n");
off += mvOsSPrintf(buf+off, " echo [Numerator] [Denominator] > berCoeffCfg - "
"config ber coeff numerator, denominator\n");
off += mvOsSPrintf(buf+off, " echo [SD] [SF] > berThesholdCfg - "
"config ber SD, SF thresholds\n");
off += mvOsSPrintf(buf+off, " echo [OmccPortId] [State] > omciPortCfg - config omcc gem port state\n");
off += mvOsSPrintf(buf+off, " echo [Len] > gemFrameLenCfg - "
"config gem frame payload len\n");
off += mvOsSPrintf(buf+off, " echo [MinLen] [MaxLen] > ethFrameLenCfg - "
"config eth frame min & max lengths\n");
off += mvOsSPrintf(buf+off, " echo [MinLen] [MaxLen] > omciFrameLenCfg - "
"config omci frame min & max lengths\n");
off += mvOsSPrintf(buf+off, " echo [Start] [Stop] [Order] [Pola] [Mask] > txBurstCfg - config tx burst\n");
off += mvOsSPrintf(buf+off, " echo [MsgId] [OnuId] [Data] [Data] [Data] > ploamMsgSend - "
"simulate transmit of US PLOAM msg\n");
off += mvOsSPrintf(buf+off, " echo [MsgId] [OnuId] [Data] [Data] [Data] > ploamMsgRece - "
"simulate reception and process of DS PLOAM msg\n");
off += mvOsSPrintf(buf+off, " echo [MsgId] [OnuId] [Data] [Data] [Data] > ploamBurstRcv - "
"simulate reception and process of DS burst PLOAM msgs\n");
off += mvOsSPrintf(buf+off, " echo [DS burst size] > ploamBurstCfg - config DS PLOAM burst size\n");
off += mvOsSPrintf(buf+off, " echo 0 > clearFifoCnts - clear all SW FIFO counters\n");
off += mvOsSPrintf(buf+off, " echo [enable(1) or disable(0)] > fifoSupport - config US SW FIFO support\n");
if (devId == MV_6601_DEV_ID){
off += mvOsSPrintf(buf+off, " echo [Mode] [Burst_Time] [Pattern1] [Pattern2] > acCoupling - "
"configure TX AC Coupling parameters\r\n");
off += mvOsSPrintf(buf+off, " echo [Bitmap] [Valid] > activeTxBm - "
"configure UTM Active TX Bitmap\n");
}
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, "Display Commands: cat <file>\n");
off += mvOsSPrintf(buf+off, "============================================================================\n");
off += mvOsSPrintf(buf+off, " cat txBurst - dump tx burst info\n");
off += mvOsSPrintf(buf+off, " cat gemFrameLen - dump frame lengths\n");
if (devId == MV_6601_DEV_ID){
off += mvOsSPrintf(buf+off, " cat acCoupling - "
"dump TX AC Coupling parameters\n");
off += mvOsSPrintf(buf+off, " cat activeTxBm - "
"show UTM Active TX Bitmap\n");
}
off += mvOsSPrintf(buf+off, "============================================================================\n");
return(off);
}
/******************************************************************************/
/* ========================================================================== */
/* Misc Commands */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** onuGponUiDebugSerialNumberSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set ONU serial Number
**
** PARAMETERS: ON_U32 serialNumber1
** MV_U32 serialNumber2
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugSerialNumberSet(MV_U32 serialNumber1, MV_U32 serialNumber2)
{
MV_STATUS rcode;
MV_U8 serialNumber[8];
serialNumber[0] = (MV_U8)((serialNumber1 >> 24) & 0xFF);
serialNumber[1] = (MV_U8)((serialNumber1 >> 16) & 0xFF);
serialNumber[2] = (MV_U8)((serialNumber1 >> 8) & 0xFF);
serialNumber[3] = (MV_U8)((serialNumber1) & 0xFF);
serialNumber[4] = (MV_U8)((serialNumber2 >> 24) & 0xFF);
serialNumber[5] = (MV_U8)((serialNumber2 >> 16) & 0xFF);
serialNumber[6] = (MV_U8)((serialNumber2 >> 8) & 0xFF);
serialNumber[7] = (MV_U8)((serialNumber2) & 0xFF);
rcode = onuGponSrvcSerialNumberSet(serialNumber);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to set Serial Number, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
}
/*******************************************************************************
**
** onuGponUiDebugSerialNumberSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set ONU serial Number
**
** PARAMETERS: ON_U32 serialNumber1
** MV_U32 serialNumber2
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugPasswordSet(MV_U32 passwordNumber1,
MV_U32 passwordNumber2,
MV_U32 passwordNumber3)
{
MV_STATUS rcode;
MV_U8 password[10];
password[0] = (MV_U8)((passwordNumber1 >> 24) & 0xFF);
password[1] = (MV_U8)((passwordNumber1 >> 16) & 0xFF);
password[2] = (MV_U8)((passwordNumber1 >> 8) & 0xFF);
password[3] = (MV_U8)((passwordNumber1) & 0xFF);
password[4] = (MV_U8)((passwordNumber2 >> 24) & 0xFF);
password[5] = (MV_U8)((passwordNumber2 >> 16) & 0xFF);
password[6] = (MV_U8)((passwordNumber2 >> 8) & 0xFF);
password[7] = (MV_U8)((passwordNumber2) & 0xFF);
password[8] = (MV_U8)((passwordNumber3 >> 24) & 0xFF);
password[9] = (MV_U8)((passwordNumber3 >> 16) & 0xFF);
rcode = onuGponDbPasswordSet(password);
if (rcode != MV_OK)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%s:%d, failed to set password, rcode(%d)\n", __FILE_DESC__, __LINE__, rcode);
}
}
/*******************************************************************************
**
** onuGponUiTxEnThresholdConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function change onu tx enable threshold
**
** PARAMETERS: MV_U32 threshold
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiTxEnThresholdConfig(MV_U32 threshold)
{
mvOnuGponMacTxTxEnableCounterThresholdSet(threshold);
}
/*******************************************************************************
**
** onuGponUiUtmTcPeriodConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function change onu utm tc period
**
** PARAMETERS: MV_U32 period
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiUtmTcPeriodConfig(MV_U32 period)
{
mvOnuGponMacUtmTcPeriodSet(period);
}
/*******************************************************************************
**
** onuGponUiUtmTcValidConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function change onu utm tc valid
**
** PARAMETERS: MV_U32 valid
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiUtmTcValidConfig(MV_U32 valid)
{
mvOnuGponMacUtmTcValidSet(valid);
}
/*******************************************************************************
**
** onuGponUitxDbrBlockSizeConfig
** ____________________________________________________________________________
**
** DESCRIPTION: The function change onu dbr block size
**
** PARAMETERS: MV_U32 blockSize
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUitxDbrBlockSizeConfig(MV_U32 blockSize)
{
MV_U32 configuredBlockSize;
onuGponSrvcDbrBlockSizeSet(blockSize, &configuredBlockSize);
}
/*******************************************************************************
**
** onuGponUiDebugMemReadReg
** ____________________________________________________________________________
**
** DESCRIPTION: The function test requested address space
**
** PARAMETERS: MV_U32 readOffset
** MV_U32 readEntry
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugReadReg(MV_U32 readOffset, MV_U32 readEntry)
{
MV_U32 regValue;
#ifndef PON_FPGA
regValue = MV_REG_READ((MV_GPON_MAC_REGS_BASE) + readOffset + (readEntry * sizeof (MV_U32)));
#else /* PON_FPGA */
regValue = MV_REG_READ((MV_GPON_REG_BASE) + readOffset + (readEntry * sizeof (MV_U32)));
#endif /* PON_FPGA */
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"Read register offset 0x%x, entry %d = [0x%08X]\n\r", readOffset, readEntry, regValue);
}
/*******************************************************************************
**
** onuGponUiDebugWriteReg
** ____________________________________________________________________________
**
** DESCRIPTION: The function test requested address space
**
** PARAMETERS: MV_U32 writeOffset
** MV_U32 writeEntry
** MV_U32 regValue
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugWriteReg(MV_U32 writeOffset, MV_U32 writeEntry, MV_U32 regValue)
{
#ifndef PON_FPGA
MV_REG_WRITE((MV_GPON_MAC_REGS_BASE) + writeOffset + (writeEntry * sizeof (MV_U32)), regValue);
#else /* PON_FPGA */
MV_REG_WRITE((MV_GPON_REG_BASE) + writeOffset + (writeEntry * sizeof (MV_U32)), regValue);
#endif /* PON_FPGA */
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"Write register offset 0x%x, entry %d = [0x%08X]\n\r", writeOffset, writeEntry, regValue);
}
/*******************************************************************************
**
** onuGponUiDebugDebugModeSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu denug mode
**
** PARAMETERS: MV_U32 debugMode
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugDebugModeSet(MV_U32 debugMode)
{
MV_BOOL mode;
mode = (debugMode == 0)? MV_FALSE : MV_TRUE;
onuGponPonMngDebugModeSet(mode);
}
/*******************************************************************************
**
** onuGponUiDebugUponModeSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function configure onu UPON mode
**
** PARAMETERS: MV_U32 debugMode
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugUponModeSet(MV_U32 uponMode)
{
MV_BOOL mode;
mode = (uponMode == 0)? MV_FALSE : MV_TRUE;
onuGponApiUponDebugSet(mode);
}
/*******************************************************************************
**** onuGponUiCfgSetUserPatternBurst
** ____________________________________________________________________________
**
** DESCRIPTION: The function config start onu transmission of user-defined
** pattern burst
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: void
**
*******************************************************************************/
void onuGponUiCfgSetUserPatternBurst(MV_U32 patternMSB, MV_U32 pattern, MV_U32 patternLSB)
{
MV_U32 userPattern[3];
userPattern[0] = patternLSB;
userPattern[1] = pattern;
userPattern[2] = patternMSB;
mvOnuPonMacPrbsUserDefinedPatternSet(userPattern);
}
/*******************************************************************************
**** onuGponUiCfgSetDefinedPatternBurst
** ____________________________________________________________________________
**
** DESCRIPTION: The function config start onu transmission of pre-defined
** pattern burst
**
** PARAMETERS: char* buf
**
** OUTPUTS: char* buf
**
** RETURNS: void
**
*******************************************************************************/
void onuGponUiCfgSetDefinedPatternBurst(MV_U32 enable, MV_U32 pattern, MV_U32 burst, MV_U32 duration, MV_U32 period)
{
if (enable == 0) {
onuPonPatternBurstOff();
}
else
{
onuPonTxPowerOn(MV_TRUE);
onuPonPatternBurstOn(pattern, (MV_BOOL)burst, period, duration);
}
}
/*******************************************************************************
**
** onuGponUiDebugAdminMode
** ____________________________________________________________________________
**
** DESCRIPTION: The function handle onu admin mode
**
** PARAMETERS: MV_U32 admin
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponUiDebugAdminMode(MV_U32 mode)
{
onuGponApiAdminStateSet(mode);
}
#ifdef MV_GPON_PERFORMANCE_CHECK
/*******************************************************************************
**
** onuGponCliDebugPerformanceCheck
** ____________________________________________________________________________
**
** DESCRIPTION: The function
**
** PARAMETERS: MV_U32 step
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponCliDebugPerformanceCheck(MV_U32 step)
{
MV_U32 minCheck = 0;
MV_U32 maxCheck = 0;
MV_U32 aveCheck = 0;
MV_U32 aveCount = 0;
MV_U32 tempCheck = 0;
MV_U32 minMaxTemp = 0;
MV_U32 index;
S_GponPerformanceCheckNode *tmpPmCheckNode;
char* pmStepDesc[] =
{
"ISR ",
"MNG1 ",
"MNG2 ",
"MNG3 ",
"ExtB ",
"Key Switch ",
"Cfg Port ",
"Req Key ",
"AllocId ",
"Password ",
"Enc Port ",
"Dis ",
"Dact ",
"Rng ",
"OnuId ",
"Over "
};
if (step >= PON_MAX_PERFORMANCE)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"Invalid performance step(%d)\n", step);
return;
}
tmpPmCheckNode = &(g_GponPmCheck.pmCheckNode[step]);
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
" Interval Minimum Maximum Average\n");
aveCount = 0;
for (index = 0; index < tmpPmCheckNode->uSecCntIdx; index++)
{
tempCheck = tmpPmCheckNode->uSecCntStop[index] -
tmpPmCheckNode->uSecCntStart[index];
if (tempCheck < 1000)
{
aveCheck += tempCheck;
aveCount++;
if (minMaxTemp == 0)
{
minCheck = maxCheck = tempCheck;
minMaxTemp = 1;
}
else
{
if (tempCheck > maxCheck) maxCheck = tempCheck;
else if (tempCheck < minCheck) minCheck = tempCheck;
}
}
}
if (aveCount > 0) aveCheck = aveCheck / aveCount;
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%11s %8u %7lu %7lu %7lu\n",
pmStepDesc[step], tmpPmCheckNode->uSecCntIdx, minCheck, maxCheck, aveCheck);
if (tmpPmCheckNode->uSecCntIdx > 0)
{
for (index = 0; index < tmpPmCheckNode->uSecCntIdx - 1; index++)
{
mvPonPrint(PON_PRINT_INFO, PON_CLI_MODULE,
"%11s Start %u Stop %u diff %u\n",
pmStepDesc[step],
tmpPmCheckNode->uSecCntStart[index],
tmpPmCheckNode->uSecCntStop[index],
(tmpPmCheckNode->uSecCntStop[index] - tmpPmCheckNode->uSecCntStart[index]));
}
}
}
/*******************************************************************************
**
** onuGponCliDebugPerformanceClear
** ____________________________________________________________________________
**
** DESCRIPTION: The function
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/
void onuGponCliDebugPerformanceClear(void)
{
MV_U32 step;
MV_U32 index;
S_GponPerformanceCheckNode *tmpPmCheckNode;
for (step = 0; step < PON_MAX_PERFORMANCE; step++)
{
tmpPmCheckNode = &(