blob: fbb575f149651b4b6b48ae238a6ce79027f37c70 [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.
*******************************************************************************/
/* Include Files
------------------------------------------------------------------------------*/
#include "mvTypes.h"
#include "mvOs.h"
#include "mvPonOnuDefines.h"
#include "mvPonOnuRegs.h"
#include "mvPonOnuMac.h"
/******************************************************************************/
/******************************************************************************/
/* ========================================================================== */
/* ========================================================================== */
/* == == */
/* == ========= ========= ========= === == == */
/* == ========= ========= ========= ==== == == */
/* == == == == == == == == == == */
/* == == == == == == == == == == */
/* == ========= ========= == == == == == == */
/* == ========= ========= == == == == == == */
/* == == == == == == == == == == */
/* == == == == == == == ==== == */
/* == ========= == ========= == === == */
/* == ========= == ========= == == == */
/* == == */
/* ========================================================================== */
/* ========================================================================== */
/******************************************************************************/
/******************************************************************************/
/* Local Constant
------------------------------------------------------------------------------*/
#define __FILE_DESC__ "mv_hal/pon/mvPonOnuMac.c"
/* Global Variables
------------------------------------------------------------------------------*/
/* Local Variables
------------------------------------------------------------------------------*/
MV_U32 onuGponPortAesStatusImage[GPON_ONU_MAX_GEM_PORTS/32];
MV_BOOL onuGponPortValidStatusImage[GPON_ONU_MAX_GEM_PORTS/32];
S_MacTxPloamPm mvOnuGponMacPloamCnt;
S_MacFifoCtrl fifoCtrl;
MV_U32 fifoReadIdx = 0;
MV_U32 fifoWriteIdx = 0;
MV_32 fifoAuditEnter = 0;
MV_32 fifoAuditAction = 0;
MV_32 fifoMacMsgSend = 0;
MV_32 fifoMacMsgAdd = 0;
MV_32 fifoMacMsgFree = 0;
MV_32 fifoMacPloamSend = 0;
MV_32 fifoSupported = 1;
/* Export Functions
------------------------------------------------------------------------------*/
/* Local Functions
------------------------------------------------------------------------------*/
static inline MV_STATUS mvOnuGponMacFifoMsgAlloc(MV_U32 **buffer, MV_U32 *bufferIndex);
static inline void mvOnuGponMacFifoMsgSend(MV_U32 bufferIndex);
static inline MV_STATUS mvOnuGponMacFifoMsgRece(MV_U32 **buffer, MV_U32 *bufferIndex);
static inline void mvOnuGponMacFifoMsgFree(MV_U32 bufferIndex);
static inline int mvOnuGponMacFifoEmpty(void);
/******************************************************************************/
/* ========================================================================== */
/* RX Low Level Routines */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** mvOnuGponMacVersionGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the asic version
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: asic version
**
*******************************************************************************/
MV_STATUS mvOnuGponMacVersionGet(MV_U32 *version)
{
MV_STATUS rcode;
rcode = asicOntGlbRegRead(mvAsicReg_GPON_GEN_MAC_VERSION, version, 0);
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacRxConfigSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set Rx config enable register
**
** PARAMETERS: MV_BOOL enable
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxConfigSet(MV_BOOL enable)
{
MV_STATUS status;
MV_U32 enBit;
enBit = (enable == MV_TRUE) ? 1 : 0;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_CONFIG_EN, enBit, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxConfigBitOrderSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set Rx config bit order register
**
** PARAMETERS: MV_BOOL enable
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxConfigBitOrderSet(MV_U32 value)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_CONFIG_BIT_ORDER, value, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxPsaConfigSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set Rx PSA config register
**
** PARAMETERS: MV_U32 syncFsmM1
** MV_U32 syncFsmM2
** MV_U32 syncFsmM3
** MV_U32 fecHyst
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPsaConfigSet(MV_U32 syncFsmM1,
MV_U32 syncFsmM2,
MV_U32 syncFsmM3,
MV_U32 fecHyst)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_PSA_CONFIG_SFM1, syncFsmM1, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_PSA_CONFIG_SFM2, syncFsmM2, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_PSA_CONFIG_SFM3, syncFsmM3, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_PSA_CONFIG_FHM1, fecHyst, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxFecHysteresisSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set Rx PSA FEC Hysteresis config register
**
** PARAMETERS: MV_U32 fecHyst
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxFecHysteresisSet(MV_U32 fecHyst)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_PSA_CONFIG_FHM1, fecHyst, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxFecConfigSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set Rx FEC config register
**
** PARAMETERS: MV_BOOL swIndication
** MV_BOOL forceSw
** MV_BOOL ignoreParity
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxFecConfigSet(MV_BOOL swIndication,
MV_BOOL forceSw,
MV_BOOL ignoreParity)
{
MV_STATUS status;
MV_U32 swiBit;
MV_U32 fswBit;
MV_U32 ipaBit;
swiBit = (swIndication == MV_TRUE) ? 1 : 0;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_FEC_CONFIG_SWVAL, swiBit, 0);
fswBit = (forceSw == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_FEC_CONFIG_FSW, fswBit, 0);
ipaBit = (ignoreParity == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_FEC_CONFIG_IGNP, ipaBit, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxFecStatusGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function get Rx FEC Ind register
**
** PARAMETERS: MV_U32 *fecStatus
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxFecStatusGet(MV_U32 *fecStatus)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_FEC_CONFIG_IND, fecStatus, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxPloamDataGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx Ploam data
**
** PARAMETERS: MV_U32 *ploamData
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPloamDataGet(MV_U32 *ploamData)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_PLOAMD_DATA_READ, ploamData, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxPloamDataUsedGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the Rx ploam fifo size
**
** PARAMETERS: MV_U32 *ploamFifoSize
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPloamDataUsedGet(MV_U32 *ploamFifoSize)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_PLOAMD_DATA_USED, ploamFifoSize, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxPlenConfigSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set Rx Plen config register
**
** PARAMETERS: MV_BOOL forceNum
** MV_BOOL useForce
** MV_BOOL ignDiff
** MV_BOOL notFix
** MV_BOOL ignCrc
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPlenConfigSet(MV_BOOL forceNum,
MV_BOOL useForce,
MV_BOOL ignDiff,
MV_BOOL notFix,
MV_BOOL ignCrc)
{
MV_STATUS status;
MV_U32 fnBit;
MV_U32 ufBit;
MV_U32 idBit;
MV_U32 nfBit;
MV_U32 icBit;
fnBit = (forceNum == MV_TRUE) ? 1 : 0;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_PLEND_CONFIG_FN, fnBit, 0);
ufBit = (useForce == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_PLEND_CONFIG_UF, ufBit, 0);
idBit = (ignDiff == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_PLEND_CONFIG_IGND, idBit, 0);
nfBit = (notFix == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_PLEND_CONFIG_DFIX, nfBit, 0);
icBit = (ignCrc == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_PLEND_CONFIG_IGNC, icBit, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxPlenConfigSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set Rx Ploam config register
**
** PARAMETERS: MV_BOOL ignCrc
** MV_BOOL ignBrd
** MV_BOOL fwdAll
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPloamConfigSet(MV_BOOL ignCrc,
MV_BOOL ignBrd,
MV_BOOL fwdAll)
{
MV_STATUS status;
MV_U32 icBit;
MV_U32 igBit;
MV_U32 faBit;
icBit = (ignCrc == MV_TRUE) ? 1 : 0;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_PLOAMD_CONFIG_IGNC, icBit, 0);
igBit = (ignBrd == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_PLOAMD_CONFIG_IGNB, igBit, 0);
faBit = (fwdAll == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_PLOAMD_CONFIG_FALL, faBit, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxBwMapConfigSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set Rx BW Map config register
**
** PARAMETERS: MV_U32 minSaDelta
** MV_BOOL notCrcFix
** MV_BOOL ignCrc
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxBwMapConfigSet(MV_U32 minSaDelta,
MV_BOOL notCrcFix,
MV_BOOL ignCrc)
{
MV_STATUS status;
MV_U32 ncfBit;
MV_U32 icBit;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_BWMAP_CONFIG_MSD, minSaDelta, 0);
ncfBit = (notCrcFix == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_BWMAP_CONFIG_DFIX, ncfBit, 0);
icBit = (ignCrc == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_BWMAP_CONFIG_IGNC, icBit, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxBwMapSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the onu Tx bw map table
**
** PARAMETERS: MV_U32 entry
** MV_U32 allocId
** MV_U32 tcontCnt
** MV_BOOL enable
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxBwMapSet(MV_U32 entry,
MV_U32 allocId,
MV_U32 tcontCnt,
MV_BOOL enable)
{
MV_STATUS status;
MV_U32 enableVal;
enableVal = (enable == MV_TRUE) ? 1 : 0;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_BW_MAP_TCN, tcontCnt, entry);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_BW_MAP_EN, enableVal, entry);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_RX_BW_MAP_ALID, allocId, entry);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxBwMapGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the onu Tx bw translation table
**
** PARAMETERS: MV_U32 entry,
** MV_U32 *allocId,
** MV_U32 *enable,
** MV_U32 *tcontCnt
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxBwMapGet(MV_U32 entry,
MV_U32 *allocId,
MV_BOOL *enable,
MV_U32 *tcontCnt)
{
MV_STATUS status;
MV_U32 enableVal;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_BW_MAP_TCN, tcontCnt, entry);
status |= asicOntGlbRegRead(mvAsicReg_GPON_RX_BW_MAP_EN, &enableVal, entry);
*enable = (enableVal == 0) ? MV_FALSE : MV_TRUE;
status |= asicOntGlbRegRead(mvAsicReg_GPON_RX_BW_MAP_ALID, allocId, entry);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxEqualizationDelaySet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the onu equalization delay
**
** PARAMETERS: MV_U32 delay
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxEqualizationDelaySet(MV_U32 delay)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_EQULIZATION_DELAY, delay, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxEqualizationDelayGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the onu equalization delay
**
** PARAMETERS: MV_U32 *delay
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxEqualizationDelayGet(MV_U32 *delay)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_EQULIZATION_DELAY, delay, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxInternalDelaySet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the onu const delay
**
** PARAMETERS: MV_U32 txConstDelay
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxInternalDelaySet(MV_U32 delay)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_RX_INTERNAL_DELAY, delay, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxInternalDelayGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the onu const delay
**
** PARAMETERS: MV_U32 *txConstDelay
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxInternalDelayGet(MV_U32 *delay)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_INTERNAL_DELAY, delay, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRxSuperFrameCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function reads Super Frame Counter
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxSuperFrameCounterGet(MV_U32 *counter)
{
return(asicOntGlbRegRead(mvAsicReg_GPON_RX_SFRAME_COUNTER, counter, 0));
}
/*******************************************************************************
**
** mvOnuGponMacRxSuperFrameCounterSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function sets Super Frame Counter
**
** PARAMETERS: MV_U32 counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxSuperFrameCounterSet(MV_U32 counter)
{
return(asicOntGlbRegWrite(mvAsicReg_GPON_RX_SFRAME_COUNTER, counter, 0));
}
/******************************************************************************/
/* ========================================================================== */
/* TX Low Level Routines */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** mvOnuGponMacTxDelimiterSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the Tx delimiter
**
** PARAMETERS: MV_U32 delimiterPattern
** MV_U32 delimiterSize
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxDelimiterSet(MV_U32 delimiterPattern, MV_U32 delimiterSize)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_DELIMITER_PAT, delimiterPattern, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_DELIMITER_SIZE, delimiterSize, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxDelimiterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the Tx delimiter
**
** PARAMETERS: MV_U32 *pattern
** MV_U32 *size
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxDelimiterGet(MV_U32 *pattern, MV_U32 *size)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_DELIMITER_PAT, pattern, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_TX_DELIMITER_SIZE, size, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxPloamDataFifoSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the Tx ploam data fifo - one entry
**
** PARAMETERS: MV_U32 txPloamData
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxPloamDataFifoSet(MV_U32 txPloamData)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_PLOAM_DATA_WRITE, txPloamData, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxPloamDataFreeGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the Tx ploam data fifo size
**
** PARAMETERS: MV_U32 *ploamFifoSize
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxPloamDataFreeGet(MV_U32 *ploamFifoSize)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_PLOAM_DATA_WRITE_FREE, ploamFifoSize, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacBurstEnParamSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the burst enable parameters
**
** PARAMETERS: MV_U32 mask
** MV_U32 polarity
** MV_U32 delay
** MV_U32 enStop
** MV_U32 enStart
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxBurstEnParamSet(MV_U32 mask,
MV_U32 polarity,
MV_U32 delay,
MV_U32 enStop,
MV_U32 enStart)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_BURST_EN_PARAM_STR, enStart, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_BURST_EN_PARAM_STP, enStop, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_BURST_EN_PARAM_DLY, delay, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_BURST_EN_PARAM_P, polarity, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_BURST_EN_PARAM_MASK, mask, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxBurstEnPolaritySet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the burst enable polarity
**
** PARAMETERS: MV_U32 polarity
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxBurstEnPolaritySet(MV_U32 polarity)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_BURST_EN_PARAM_P, polarity, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxBurstEnParamGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the burst enable parameters
**
** PARAMETERS: MV_U32 *mask
** MV_U32 *polarity
** MV_U32 *delay
** MV_U32 *enStop
** MV_U32 *enStart
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxBurstEnParamGet(MV_U32 *mask,
MV_U32 *polarity,
MV_U32 *order,
MV_U32 *enStop,
MV_U32 *enStart)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_BURST_EN_PARAM_STR, enStart, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_TX_BURST_EN_PARAM_STP, enStop, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_TX_BURST_EN_PARAM_DLY, order, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_TX_BURST_EN_PARAM_P, polarity, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_TX_BURST_EN_PARAM_MASK, mask, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxFinalDelaySet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the Tx final delay
**
** PARAMETERS: MV_U32 txFinalDelay
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxFinalDelaySet(MV_U32 txFinalDelay)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_FDELAY, txFinalDelay, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxFinalDelayGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the Tx final delay
**
** PARAMETERS: MV_U32 *txFinalDelay
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxFinalDelayGet(MV_U32 *txFinalDelay)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_FDELAY, txFinalDelay, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxPreambleSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the Tx preamble type (1,2,3)
**
** PARAMETERS: MV_U32 preamType
** MV_U32 preamCnt
** MV_U32 preamVal
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxPreambleSet(MV_U32 type, MV_U32 pattern, MV_U32 size)
{
MV_STATUS status;
if (type >= 3)
{
return(MV_ERROR);
}
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_PREAMBLE_PATT, pattern, type);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_PREAMBLE_SIZE, size, type);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxPlsSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the Tx PLS
**
** PARAMETERS: MV_U32 pattern
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxPlsSet(MV_U32 pattern)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_PLS_CONSTANT, pattern, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxConstIdleMsgSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the Tx const data ram - one entry
**
** PARAMETERS: MV_U32 onuId
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxConstIdleMsgSet(MV_U32 onuId)
{
MV_STATUS status;
MV_U32 dataWord;
dataWord = ((onuId & 0xFF) << 24) | (ONU_GPON_US_MSG_NO_MESSAGE << 16);
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_CONST_DATA_RAM_IDLE, dataWord, 0);
dataWord = 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_CONST_DATA_RAM_IDLE, dataWord, 1);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_CONST_DATA_RAM_IDLE, dataWord, 2);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxConstIdleMsgSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the Tx const data ram - one entry
**
** PARAMETERS: MV_U32 onuId
** MV_U8 *serialNumber
** MV_U32 randomDelay
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxConstSerialNumberMsgSet(MV_U32 onuId,
MV_U8 *serialNumber,
MV_U32 randomDelay)
{
MV_STATUS status;
MV_U32 dataWord;
dataWord = ((onuId & 0xFF) << 24) | (ONU_GPON_US_MSG_SN_ONU << 16) |
(((MV_U32)(serialNumber[0])) << 8) | (MV_U32)(serialNumber[1]);
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_CONST_DATA_RAM_SN, dataWord, 0);
dataWord = (((MV_U32)(serialNumber[2])) << 24) | (((MV_U32)(serialNumber[3])) << 16) |
(((MV_U32)(serialNumber[4])) << 8) | (MV_U32)(serialNumber[5]);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_CONST_DATA_RAM_SN, dataWord, 1);
dataWord = (((MV_U32)(serialNumber[6])) << 24) | (((MV_U32)(serialNumber[7])) << 16) |
(((randomDelay >> 4) & 0xFF) << 8) | ((randomDelay & 0xF) << 4 | 5);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_TX_CONST_DATA_RAM_SN, dataWord, 2);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxDbrBlockSizeSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the Tx DBR Block size
**
** PARAMETERS: MV_U32 blockSize
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxDbrBlockSizeSet(MV_U32 blockSize)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_DBR_REPORT_BLOCK_IDX, blockSize, 0);
return(status);
}
/******************************************************************************/
/* ========================================================================== */
/* General Low Level Routines */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** mvOnuGponMacOnuIdSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the ONU ID
**
** PARAMETERS: MV_U32 onuId
** MV_BOOL valid
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacOnuIdSet(MV_U32 onuId, MV_BOOL valid)
{
MV_STATUS status;
MV_U32 validBit;
status = asicOntGlbRegWrite(mvAsicReg_GPON_ONU_ID_OID, onuId, 0);
validBit = (valid == MV_TRUE) ? 1 : 0;
status |= asicOntGlbRegWrite(mvAsicReg_GPON_ONU_ID_V, validBit, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacOnuStateSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the onu state
**
** PARAMETERS: MV_U32 onuState
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacOnuStateSet(MV_U32 onuState)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_ONU_STATE, onuState, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacSerialNumberSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set 2 bytes of Serial Number
** it is for ASIC random value creation - so the 2 last bytes
** should be put here
**
** PARAMETERS: MV_U32 serialNum
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacSerialNumberSet(MV_U32 serialNum)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_SERIAL_NUMBER, serialNum, 0);
return(status);
}
/******************************************************************************/
/* ========================================================================== */
/* Gem Low Level Routines */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** mvOnuGponMacGemPayloadLenSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the max gem payload length
**
** PARAMETERS: MV_U32 payloadlen
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemPayloadLenSet(MV_U32 payloadlen)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CONFIG_PLI, payloadlen, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemPayloadLenGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the max gem payload length
**
** PARAMETERS: MV_U32 *payloadlen
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemPayloadLenGet(MV_U32 *payloadlen)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_CONFIG_PLI, payloadlen, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemEthFrameLenSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the max / min ethernet frame length
**
** PARAMETERS: MV_U32 maxFrameLen
** MV_U32 minFrameLen
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemEthFrameLenSet(MV_U32 maxFrameLen, MV_U32 minFrameLen)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CONFIG_ETH_FRAME_LEN_MAX, maxFrameLen, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CONFIG_ETH_FRAME_LEN_MIN, minFrameLen, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemEthFrameLenGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the max / min ethernet frame length
**
** PARAMETERS: MV_U32 maxFrameLen
** MV_U32 minFrameLen
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemEthFrameLenGet(MV_U32 *maxFrameLen, MV_U32 *minFrameLen)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_CONFIG_ETH_FRAME_LEN_MAX, maxFrameLen, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_GEM_CONFIG_ETH_FRAME_LEN_MIN, minFrameLen, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemOmciFrameLenSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the max / min omci frame length
**
** PARAMETERS: MV_U32 maxFrameLen
** MV_U32 minFrameLen
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemOmciFrameLenSet(MV_U32 maxFrameLen, MV_U32 minFrameLen)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CONFIG_OMCI_FRAME_LEN_MAX, maxFrameLen, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CONFIG_OMCI_FRAME_LEN_MIN, minFrameLen, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemOmciFrameLenGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the max / min omci frame length
**
** PARAMETERS: MV_U32 maxFrameLen
** MV_U32 minFrameLen
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemOmciFrameLenGet(MV_U32 *maxFrameLen, MV_U32 *minFrameLen)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_CONFIG_OMCI_FRAME_LEN_MAX, maxFrameLen, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_GEM_CONFIG_OMCI_FRAME_LEN_MIN, minFrameLen, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemOmciPortIdSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the omci port Id
**
** PARAMETERS: MV_U32 portId
** MV_U32 valid
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemOmciPortIdSet(MV_U32 portId, MV_U32 valid)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CONFIG_OMCI_PORT_ID, portId, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CONFIG_OMCI_PORT_VALID, valid, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemOmciPortIdGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the omci port Id
**
** PARAMETERS: MV_U32 portId
** MV_U32 valid
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemOmciPortIdGet(MV_U32 *portId, MV_U32 *valid)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_CONFIG_OMCI_PORT_ID, portId, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_GEM_CONFIG_OMCI_PORT_VALID, valid, 0);
return(status);
}
/******************************************************************************/
/* ========================================================================== */
/* UTM Low Level Routines */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** mvOnuGponMacUtmOmciPortIdSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the omci port Id
**
** PARAMETERS: MV_U32 portId
** MV_U32 valid
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacUtmOmciPortIdSet(MV_U32 portId, MV_U32 valid)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_UTM_CONFIG_OMCI_PORT_ID, portId, 0);
status |= asicOntGlbRegWrite(mvAsicReg_GPON_UTM_CONFIG_OMCI_PORT_VALID, valid, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacUtmOmciPortIdGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the omci port Id
**
** PARAMETERS: MV_U32 *portId
** MV_U32 *valid
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacUtmOmciPortIdGet(MV_U32 *portId, MV_U32 *valid)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_UTM_CONFIG_OMCI_PORT_ID, portId, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_UTM_CONFIG_OMCI_PORT_VALID, valid, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacUtmTcPeriodSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the TC period
**
** PARAMETERS: MV_U32 period
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacUtmTcPeriodSet(MV_U32 period)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_UTM_CONFIG_TC_PERIOD, period, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacUtmTcValidSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the TC valid
**
** PARAMETERS: MV_U32 valid
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacUtmTcValidSet(MV_U32 valid)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_UTM_CONFIG_TC_PERIOD_VALID, valid, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacUtmTcConfigGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the TC configuration
**
** PARAMETERS: MV_U32 *period
** MV_U32 *valid
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacUtmTcConfigGet(MV_U32 *period, MV_U32 *valid)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_UTM_CONFIG_TC_PERIOD, period, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_UTM_CONFIG_TC_PERIOD_VALID, valid, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacUtmActiveTxBitmapSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the active TX bitmap
**
** PARAMETERS: MV_U32 bitmap
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacUtmActiveTxBitmapSet(MV_U32 bitmap)
{
return(asicOntGlbRegWrite(mvAsicReg_GPON_UTM_ACTIVE_TX_BITMAP, bitmap, 0));
}
/*******************************************************************************
**
** mvOnuGponMacUtmActiveTxBitmapValidSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the active TX bitmap valid
**
** PARAMETERS: MV_U32 valid
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacUtmActiveTxBitmapValidSet(MV_U32 valid)
{
return(asicOntGlbRegWrite(mvAsicReg_GPON_UTM_ACTIVE_TX_BITMAP_VALID, valid, 0));
}
/*******************************************************************************
**
** mvOnuGponMacUtmActiveTxBitmapConfigGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the active TX bitmap configuration
**
** PARAMETERS: MV_U32 *bitmap
** MV_U32 *valid
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacUtmActiveTxBitmapConfigGet(MV_U32 *bitmap, MV_U32 *valid)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_UTM_ACTIVE_TX_BITMAP, bitmap, 0);
status |= asicOntGlbRegRead(mvAsicReg_GPON_UTM_ACTIVE_TX_BITMAP_VALID, valid, 0);
return(status);
}
/******************************************************************************/
/* ========================================================================== */
/* Interrupt Low Level Routines */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** mvOnuGponMacPonInterruptGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the interrupt event
**
** PARAMETERS: MV_U32 *interrupt
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacPonInterruptGet(MV_U32 *interrupt)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_INTERRUPT_PON, interrupt, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacPonInterruptMaskGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the interrupt mask
**
** PARAMETERS: MV_U32 *mask
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacPonInterruptMaskGet(MV_U32 *mask)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_INTERRUPT_PON_MASK, mask, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacPonInterruptMaskSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the interrupt mask
**
** PARAMETERS: MV_U32 *mask
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacPonInterruptMaskSet(MV_U32 mask)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_INTERRUPT_PON_MASK, mask, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacBipStatusValueGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the BIP8 general counter
**
** PARAMETERS: MV_U32 *value
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacBipStatusValueGet(MV_U32 *value)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_BIP_STATUS, value, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacBipInterruptIntervalSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the BIP8 interrupt interval (in frames)
**
** PARAMETERS: MV_U32 interval
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacBipInterruptIntervalSet(MV_U32 interval)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_BIP_INTR_INTERVAL, interval, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacBipStatusValueGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the BIP8 interrupt counter
**
** PARAMETERS: MV_U32 *value
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacBipInterruptStatusValueGet(MV_U32 *value)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_RX_BIP_STATUS_FOR_INTERRUPT, value, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacBipInterruptIntervalSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set ram test configuration
**
** PARAMETERS: MV_U32 interval
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRamTestCfgSet(MV_U32 config)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_RAM_TEST_CONFIG, config, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacRamTestCfgGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return ram test configuration
**
** PARAMETERS: MV_U32 *value
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRamTestCfgGet(MV_U32 *config)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_RAM_TEST_CONFIG, config, 0);
return(status);
}
/******************************************************************************/
/* ========================================================================== */
/* Statistics Low Level Routines */
/* ========================================================================== */
/******************************************************************************/
/* ========================================================================== */
/* GEM Statistics Low Level Routines */
/* ========================================================================== */
/*******************************************************************************
**
** mvOnuGponMacGemRcvdIdleGemFramesCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received idle gem frames counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdIdleGemFramesCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_IDLE_GEM_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdValidGemFramesCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received valid gem frames counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdValidGemFramesCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_VALID_GEM_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdUndefGemFramesCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received undefined gem frames counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdUndefGemFramesCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_UNDEF_GEM_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdOmciFramesCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received omci frames counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdOmciFramesCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_VALID_OMCI_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemDropGemFramesCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received dropped gem frames counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemDropGemFramesCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_DROPPED_GEM_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemDropOmciFramesCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received dropped omci frames counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemDropOmciFramesCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_DROPPED_OMCI_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdGemFramesWithUncorrHecErrCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received gem frames with uncorrect hec error counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdGemFramesWithUncorrHecErrCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_ERROR_GEM_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdGemFramesWithOneFixedHecErrCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received gem frames with one fixed hec error counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdGemFramesWithOneFixedHecErrCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_ONE_FIXED_HEC_ERR_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdGemFramesWithTwoFixedHecErrCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received gem frames with two fixed hec error counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdGemFramesWithTwoFixedHecErrCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_TWO_FIXED_HEC_ERR_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdValidGemFramesTotalByteCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received valid gem frames total bytes counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdValidGemFramesTotalByteCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_VALID_GEM_PAYLOAD_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdUndefGemFramesTotalByteCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received undefined gem frames total bytes counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdUndefGemFramesTotalByteCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_UNDEF_GEM_PAYLOAD_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemReassembleMemoryFlushCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received gem reassemble memory flush counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemReassembleMemoryFlushCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_RSMBL_MEM_FLUSH_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemSynchLostCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return gem synch lost counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemSynchLostCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_LCDGi_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdEthFramesWithCorrFcsCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received ethernet frames with correct FCS counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdEthFramesWithCorrFcsCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_CORR_ETH_FRAME_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdEthFramesWithFcsErrCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received ethernet frames with FCS error counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdEthFramesWithFcsErrCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_ERR_ETH_FRAME_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdOmciFramesWithCorrCrcCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received omci frames with correct CRC counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdOmciFramesWithCorrCrcCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_CORR_OMCI_FRAME_CNT, cntValue, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacGemRcvdOmciFramesWithCrcErrCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return received omci frames with CRC error counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemRcvdOmciFramesWithCrcErrCounterGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_GEM_STAT_ERR_OMCI_FRAME_CNT, cntValue, 0);
return(status);
}
/* ========================================================================== */
/* Rx PLOAM Statistics Low Level Routines */
/* ========================================================================== */
/******************************************************************************
**
** mvOnuGponMacRxPloamLostCrcCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx ploam lost crc counter
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPloamLostCrcCounterGet(MV_U32 *counter)
{
MV_STATUS status;
*counter = 0;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_PLOAMD_LOST_CRC_STATUS, counter, 0);
if (status != MV_OK)
{
return(status);
}
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacRxPloamLostFullCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx ploam lost full counter
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPloamLostFullCounterGet(MV_U32 *counter)
{
MV_STATUS status;
*counter = 0;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_PLOAMD_LOST_FULL_STATUS, counter, 0);
if (status != MV_OK)
{
return(status);
}
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacRxPloamRcvdIdleCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx ploam received idle counter
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPloamRcvdIdleCounterGet(MV_U32 *counter)
{
MV_STATUS status;
*counter = 0;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_PLOAMD_RCVD_IDLE_STATUS, counter, 0);
if (status != MV_OK)
{
return(status);
}
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacRxPloamRcvdBroadCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx ploam received broadcast counter
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPloamRcvdBroadCounterGet(MV_U32 *counter)
{
MV_STATUS status;
*counter = 0;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_PLOAMD_RCVD_BROAD_STATUS, counter, 0);
if (status != MV_OK)
{
return(status);
}
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacRxPloamRcvdOnuIdCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx ploam received Onu Id counter
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxPloamRcvdOnuIdCounterGet(MV_U32 *counter)
{
MV_STATUS status;
*counter = 0;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_PLOAMD_RCVD_MYID_STATUS, counter, 0);
if (status != MV_OK)
{
return(status);
}
return(MV_OK);
}
/* ========================================================================== */
/* Tx Statistics Low Level Routines */
/* ========================================================================== */
/*******************************************************************************
**
** mvOnuGponMacTxGemPtiTypeOneFrameCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the num of trans gem frames with pti = 1
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxGemPtiTypeOneFrameCounterGet(MV_U32 *counter)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_STAT_GEM_PTI1, counter, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxGemPtiTypeZeroFrameCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the num of trans gem frames with pti = 0
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxGemPtiTypeZeroFrameCounterGet(MV_U32 *counter)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_STAT_GEM_PTI0, counter, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxIdleGemFramesCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the num of trans idle gem frames
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxIdleGemFramesCounterGet(MV_U32 *counter)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_STAT_GEM_IDLE, counter, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxTxEnableCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return the num of cycles with tx enable asserted
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxTxEnableCounterGet(MV_U32 *counter)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_STAT_TX_EN_CNT, counter, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxTxEnableCounterThresholdGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return tx enable counter threshold
**
** PARAMETERS: MV_U32 *threshold
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxTxEnableCounterThresholdGet(MV_U32 *threshold)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_CONFIG_EN_THRESHOLD, threshold, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxTxEnableCounterThresholdSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set tx enable counter threshold
**
** PARAMETERS: MV_U32 threshold
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxTxEnableCounterThresholdSet(MV_U32 threshold)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_CONFIG_EN_THRESHOLD, threshold, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxGseTransCounterThresholdGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return GSE threshold for starting forwarding data to
** the TX burst FIFO
**
** PARAMETERS: MV_U32 *threshold
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxGseTransCounterThresholdGet(MV_U32 *threshold)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_GSE_TRANS_THRESHOLD, threshold, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxGseTransCounterThresholdSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set GSE threshold for starting forwarding data to
** the TX burst FIFO
**
** PARAMETERS: MV_U32 threshold
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxGseTransCounterThresholdSet(MV_U32 threshold)
{
MV_STATUS status;
status = asicOntGlbRegWrite(mvAsicReg_GPON_TX_GSE_TRANS_THRESHOLD, threshold, 0);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxGseTransConfigAcCouplingSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set GSE Transmit Configuration AC coupling
**
** PARAMETERS: MV_U32 busrtMode - GPON_TX_AC_COUPL_BUST_MODE_0 or
** GPON_TX_AC_COUPL_BUST_MODE_1
** MV_U32 preActiveBurstTime - time from burst to TX pattern2
** MV_U8 dataPattern1 - Pattern1
** MV_U8 dataPattern2 - Pattern2
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxConfigAcCouplingGet(MV_U32 *busrtMode,
MV_U32 *preActiveBurstTime,
MV_U8 *dataPattern1,
MV_U8 *dataPattern2)
{
MV_STATUS status;
MV_U32 reg;
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_CFG_AC_COUPLING, &reg, 0);
if (status == MV_OK) {
*busrtMode = (reg >> 30) & 0x3;
*preActiveBurstTime = (reg >> 16) & 0x3FFF;
*dataPattern2 = (reg >> 8) & 0xFF;
*dataPattern1 = reg & 0xFF;
}
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxGseTransConfigAcCouplingSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set GSE Transmit Configuration AC coupling
**
** PARAMETERS: MV_U32 busrtMode - GPON_TX_AC_COUPL_BUST_MODE_0 or
** GPON_TX_AC_COUPL_BUST_MODE_1
** MV_U32 preActiveBurstTime - time from burst to TX pattern2
** MV_U8 dataPattern1 - Pattern1
** MV_U8 dataPattern2 - Pattern2
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxConfigAcCouplingSet(MV_U32 busrtMode,
MV_U32 preActiveBurstTime,
MV_U8 dataPattern1,
MV_U8 dataPattern2)
{
MV_U32 reg = 0;
if (busrtMode != GPON_TX_AC_COUPL_BUST_MODE_0)
reg = 1 << 30;
reg |= (preActiveBurstTime & 0x3FFF) << 16;
reg |= dataPattern1 | (dataPattern2 << 8);
return(asicOntGlbRegWrite(mvAsicReg_GPON_TX_CFG_AC_COUPLING, reg, 0));
}
/*******************************************************************************
**
** mvOnuGponMacTxEthFramesTcontiCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return number of trans ethernet frames via tcont
**
** PARAMETERS: MV_U32 tcontNum
** MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxEthFramesTcontiCounterGet(MV_U32 tcontNum, MV_U32 *counter)
{
MV_STATUS status;
if (tcontNum >= ONU_GPON_MAX_NUM_OF_T_CONTS)
return(MV_ERROR);
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_STAT_TCONT_i_ETH_FRAMES, counter, tcontNum);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxEthBytesTcontiCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return number of trans ethernet bytes via tcont
**
** PARAMETERS: MV_U32 tcontNum
** MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxEthBytesTcontiCounterGet(MV_U32 tcontNum, MV_U32 *counter)
{
MV_STATUS status;
if (tcontNum >= ONU_GPON_MAX_NUM_OF_T_CONTS)
return(MV_ERROR);
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_STAT_TCONT_i_ETH_BYTES, counter, tcontNum);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxGemFramesTcontiCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return number of trans gem frames via tcont
**
** PARAMETERS: MV_U32 tcontNum
** MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxGemFramesTcontiCounterGet(MV_U32 tcontNum, MV_U32 *counter)
{
MV_STATUS status;
if (tcontNum >= ONU_GPON_MAX_NUM_OF_T_CONTS)
return(MV_ERROR);
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_STAT_TCONT_i_GEM_FRAMES, counter, tcontNum);
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacTxIdleGemFramesTcontiCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return number of trans idle gem frames via tcont
**
** PARAMETERS: MV_U32 tcontNum
** MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxIdleGemFramesTcontiCounterGet(MV_U32 tcontNum, MV_U32 *counter)
{
MV_STATUS status;
if (tcontNum >= ONU_GPON_MAX_NUM_OF_T_CONTS)
return(MV_ERROR);
status = asicOntGlbRegRead(mvAsicReg_GPON_TX_STAT_TCONT_i_IDLE_GEM, counter, tcontNum);
return(status);
}
/* ========================================================================== */
/* FEC Statistics Low Level Routines */
/* ========================================================================== */
/*******************************************************************************
**
** mvOnuGponMacRxFecBytesCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx FEC Bytes counter
**
** PARAMETERS: MV_U32 *counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxFecBytesCounterGet(MV_U32 *counter)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_FEC_STAT0, counter, 0);
if (status != MV_OK)
{
return(status);
}
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacRxFecCorrectBytesCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx FEC correct Bytes counter
**
** PARAMETERS: MV_U32 *bytes
** MV_U32 *bits
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxFecCorrectCounterGet(MV_U32 *bytes, MV_U32 *bits)
{
MV_STATUS status;
MV_U32 regVal;
*bytes = 0;
*bits = 0;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_FEC_STAT1, &regVal, 0);
if (status != MV_OK)
{
return(status);
}
*bits = regVal & 0xFFFF;
*bytes = (regVal >> 16) & 0xFFFF;
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacRxFecInorrectCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx FEC Incorrect Bytes counter
**
** PARAMETERS: MV_U32 *bytes
** MV_U32 *bits
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxFecInorrectCounterGet(MV_U32 *bytes, MV_U32 *bits)
{
MV_STATUS status;
MV_U32 regVal;
*bytes = 0;
*bits = 0;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_FEC_STAT2, &regVal, 0);
if (status != MV_OK)
{
return(status);
}
*bits = regVal & 0xFFFF;
*bytes = (regVal >> 16) & 0xFFFF;
return(MV_OK);
}
/* ========================================================================== */
/* Bw Map Statistics Low Level Routines */
/* ========================================================================== */
/*******************************************************************************
**
** mvOnuGponMacRxBwMapAllocatrionsCounterGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx Bw Map allocation counters
**
** PARAMETERS: MV_U32 *cor
** MV_U32 *incor
** MV_U32 *crcCor
** MV_U32 *errCrc
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxBwMapAllocatrionsCounterGet(MV_U32 *cor,
MV_U32 *incor,
MV_U32 *crcCor,
MV_U32 *errCrc)
{
MV_STATUS status;
MV_U32 regVal;
*cor = 0;
*incor = 0;
*crcCor = 0;
*errCrc = 0;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_BWMAP_STATUS0, &regVal, 0);
if (status != MV_OK)
{
return(status);
}
*incor = regVal & 0xFF;
*crcCor = (regVal >> 8) & 0xFF;
*cor = (regVal >> 16) & 0xFF;
*errCrc = (regVal >> 24) & 0xFF;
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacRxBwMapTotalBwGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return Rx Bw total Bw counter
**
** PARAMETERS: MV_U32 *bw
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacRxBwMapTotalBwGet(MV_U32 *bw)
{
MV_STATUS status;
MV_U32 regVal;
*bw = 0;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_BWMAP_STATUS1, &regVal, 0);
if (status != MV_OK)
{
return(status);
}
*bw = regVal & 0x7FFFF;
return(MV_OK);
}
/* ========================================================================== */
/* Plend Statistics Low Level Routines */
/* ========================================================================== */
/*******************************************************************************
**
** onuGponInComingPlendCntGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return InComing Plend counter
**
** PARAMETERS: MV_U32 *cntValue
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacInComingPlendCntGet(MV_U32 *cntValue)
{
MV_STATUS status;
status = asicOntGlbRegRead(mvAsicReg_GPON_RX_PLEND_STATUS, cntValue, 0);
return(status);
}
/******************************************************************************/
/* ========================================================================== */
/* High-Level MAC Section */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** mvOnuGponMacMessageReceive
** ____________________________________________________________________________
**
** DESCRIPTION: The function read message from the message fifo
** The ploam size is 12 octets - each read get 32 bits
** 3 read actions needed
**
** PARAMETERS: msgData - 10 bytes (buffer is allocated by calling)
** msgOnuId - the ONU ID on the message
** msgId - the message ID on the message
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacMessageReceive(MV_U8 *msgOnuId, MV_U8 *msgId, MV_U8 *msgData)
{
MV_STATUS rcode;
MV_U32 ploamFifoData_1;
MV_U32 ploamFifoData_2;
MV_U32 ploamFifoData_3;
rcode = mvOnuGponMacRxPloamDataGet(&ploamFifoData_1);
rcode |= mvOnuGponMacRxPloamDataGet(&ploamFifoData_2);
rcode |= mvOnuGponMacRxPloamDataGet(&ploamFifoData_3);
if (rcode != MV_OK)
return(rcode);
/* Outputs */
*msgOnuId = (MV_U8)((ploamFifoData_1 >> 24) & UINT8_MASK); /* MSB */
*msgId = (MV_U8)((ploamFifoData_1 >> 16) & UINT8_MASK);
msgData[0] = (MV_U8)((ploamFifoData_1 >> 8) & UINT8_MASK);
msgData[1] = (MV_U8) (ploamFifoData_1 & UINT8_MASK); /* LSB */
msgData[2] = (MV_U8)((ploamFifoData_2 >> 24) & UINT8_MASK); /* MSB */
msgData[3] = (MV_U8)((ploamFifoData_2 >> 16) & UINT8_MASK);
msgData[4] = (MV_U8)((ploamFifoData_2 >> 8) & UINT8_MASK);
msgData[5] = (MV_U8) (ploamFifoData_2 & UINT8_MASK); /* LSB */
msgData[6] = (MV_U8)((ploamFifoData_3 >> 24) & UINT8_MASK); /* MSB */
msgData[7] = (MV_U8)((ploamFifoData_3 >> 16) & UINT8_MASK);
msgData[8] = (MV_U8)((ploamFifoData_3 >> 8) & UINT8_MASK);
msgData[9] = (MV_U8) (ploamFifoData_3 & UINT8_MASK); /* LSB */
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacTxPloamSend
** ____________________________________________________________________________
**
** DESCRIPTION: The function writes PLOAM message to HW FIFO
**
** PARAMETERS: msgData - 10 bytes (buffer is allocated by calling)
** msgOnuId - the ONU ID on the message
** msgId - the message ID on the message
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacTxPloamSend(MV_U8 msgOnuId, MV_U8 msgId, MV_U8 *msgData)
{
MV_STATUS rcode;
MV_U32 ploamFifoData;
fifoMacPloamSend++;
/* Write ONU ID and Message ID and data[0:1] */
ploamFifoData = (((MV_U32)msgOnuId) << 24) | (((MV_U32)msgId) << 16) |
(((MV_U32)msgData[0]) << 8) |(((MV_U32)msgData[1]) << 0);
rcode = mvOnuGponMacTxPloamDataFifoSet(ploamFifoData);
/* Write data[2:5] */
ploamFifoData = (((MV_U32)msgData[2]) << 24) | (((MV_U32)msgData[3]) << 16) |
(((MV_U32)msgData[4]) << 8) |(((MV_U32)msgData[5]) << 0);
rcode |= mvOnuGponMacTxPloamDataFifoSet(ploamFifoData);
/* Write data[6:9] */
ploamFifoData = (((MV_U32)msgData[6]) << 24) | (((MV_U32)msgData[7]) << 16) |
(((MV_U32)msgData[8]) << 8) |(((MV_U32)msgData[9]) << 0);
rcode |= mvOnuGponMacTxPloamDataFifoSet(ploamFifoData);
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacMessageAdd
** ____________________________________________________________________________
**
** DESCRIPTION: The function adds message to the SW FIFO
**
** PARAMETERS: msgData - 10 bytes (buffer is allocated by calling)
** msgOnuId - the ONU ID on the message
** msgId - the message ID on the message
**
** OUTPUTS: None
**
** RETURNS: MV_OK or MV_FULL
**
*******************************************************************************/
MV_STATUS mvOnuGponMacMessageAdd(MV_U8 msgOnuId, MV_U8 msgId, MV_U8 *msgData)
{
MV_STATUS rcode;
MV_U8 *buffer;
MV_U32 bufferIndex;
/* Get pointer to and index of the free SW FIFO entry */
rcode = mvOnuGponMacFifoMsgAlloc((MV_U32**)&buffer, &bufferIndex);
if (rcode == MV_OK)
{
buffer[0] = msgOnuId;
buffer[1] = msgId;
memcpy(&buffer[2], msgData, GPON_PLOAM_MSG_BYTES - 2);
mvOnuGponMacFifoMsgSend(bufferIndex);
}
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacMessageSend
** ____________________________________________________________________________
**
** DESCRIPTION: The function write message to the message fifo
**
** PARAMETERS: msgData - 10 bytes (buffer is allocated by calling)
** msgOnuId - the ONU ID on the message
** msgId - the message ID on the message
**
** OUTPUTS: None
**
** RETURNS: MV_OK, MV_FULL or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacMessageSend(MV_U8 msgOnuId, MV_U8 msgId, MV_U8 *msgData)
{
MV_STATUS rcode;
MV_U32 ploamFifoSize;
MV_U8 *buffer;
MV_U32 bufferIndex;
int i, moved_num;
fifoMacMsgSend++;
/* Check first if PLOAM FIFO has free place */
rcode = mvOnuGponMacTxPloamDataFreeGet(&ploamFifoSize);
if (rcode != MV_OK)
return(rcode);
/* SW FIFO is not supported */
if (!fifoSupported)
{
if (ploamFifoSize < GPON_PLOAM_MSG_WORDS)
return(MV_ERROR);
return mvOnuGponMacTxPloamSend(msgOnuId, msgId, msgData);
}
/* There is no free entries in HW FIFO */
if (ploamFifoSize < GPON_PLOAM_MSG_WORDS)
{
rcode = mvOnuGponMacMessageAdd(msgOnuId, msgId, msgData);
}
else
{
/* HW FIFO has free entries. Verify whether SW FIFO is empty */
if (mvOnuGponMacFifoEmpty())
{
rcode = mvOnuGponMacTxPloamSend(msgOnuId, msgId, msgData);
}
else
{
/* Add received PLOAM to SW FIFO */
rcode = mvOnuGponMacMessageAdd(msgOnuId, msgId, msgData);
/* Move up to GPON_MAX_US_MSG_MOVING (3) PLOAMs from SW to HW FIFO */
moved_num = ploamFifoSize/GPON_PLOAM_MSG_WORDS;
if (moved_num > GPON_MAX_US_MSG_MOVING) {
moved_num = GPON_MAX_US_MSG_MOVING;
}
for (i=0; i<moved_num; i++)
{
rcode = mvOnuGponMacFifoMsgRece((MV_U32**)&buffer, &bufferIndex);
if (rcode == MV_EMPTY)
break;
rcode = mvOnuGponMacTxPloamSend(buffer[0], buffer[1], &buffer[2]);
if(rcode != MV_OK)
break;
mvOnuGponMacFifoMsgFree(bufferIndex);
}
}
}
return rcode;
}
/*******************************************************************************
**
** mvOnuGponMacMessageCleanSwFifo
** ____________________________________________________________________________
**
** DESCRIPTION: The function clean the SW transmit message fifo
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: MV_OK, MV_FULL or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacMessageCleanSwFifo(void)
{
MV_STATUS rcode;
MV_U8 *buffer;
MV_U32 bufferIndex;
do
{
rcode = mvOnuGponMacFifoMsgRece((MV_U32**)&buffer, &bufferIndex);
if (rcode == MV_EMPTY)
break;
mvOnuGponMacFifoMsgFree(bufferIndex);
} while (1);
return MV_OK;
}
/*******************************************************************************
**
** mvOnuGponMacPreambleSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the onu overhead preamble bytes
**
** PARAMETERS: preamType1Val - preamble type 1 value
** preamType1Cnt - preamble type 1 count
** preamType2Val - preamble type 2 value
** preamType2Cnt - preamble type 2 count
** preamType3Val - preamble type 3 value
** preamType3Cnt - preamble type 3 count
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacPreambleSet(MV_U32 preamType1Val,
MV_U32 preamType1Cnt,
MV_U32 preamType2Val,
MV_U32 preamType2Cnt,
MV_U32 preamType3Val,
MV_U32 preamType3Cnt)
{
MV_STATUS rcode;
rcode = mvOnuGponMacTxPreambleSet(ONU_GPON_PREM_TYPE_01, preamType1Val, preamType1Cnt);
if (rcode != MV_OK)
{
return(rcode);
}
rcode = mvOnuGponMacTxPreambleSet(ONU_GPON_PREM_TYPE_02, preamType2Val, preamType2Cnt);
if (rcode != MV_OK)
{
return(rcode);
}
rcode = mvOnuGponMacTxPreambleSet(ONU_GPON_PREM_TYPE_03, preamType3Val, preamType3Cnt);
if (rcode != MV_OK)
{
return(rcode);
}
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacPreambleType3Set
** ____________________________________________________________________________
**
** DESCRIPTION: The function set the onu overhead preamble type3
**
** PARAMETERS: preamType3Val - preamble type 3 value
** preamType3Cnt - preamble type 3 count
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacPreambleType3Set(MV_U32 preamType3Val, MV_U32 preamType3Cnt)
{
MV_STATUS rcode;
rcode = mvOnuGponMacTxPreambleSet(ONU_GPON_PREM_TYPE_03, preamType3Val, preamType3Cnt);
if (rcode != MV_OK)
{
return(rcode);
}
return(MV_OK);
}
/******************************************************************************/
/* ========================================================================== */
/* Upstream Messages MAC Section */
/* ========================================================================== */
/******************************************************************************/
#ifndef PON_FPGA
/*******************************************************************************
**
** mvOnuGponMacDgMessageSend
** ____________________________________________________________________________
**
** DESCRIPTION: The function sends dying gasp message in the US direction
**
** PARAMETERS: MV_U8 onuId
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacDgMessageSend(MV_U8 onuId)
{
MV_U32 i;
MV_STATUS rcode;
MV_U8 data[12];
for (i = 0; i < 3; i++)
{
rcode = mvOnuGponMacMessageSend(onuId, ONU_GPON_US_MSG_DYING_GASP, data);
if (rcode != MV_OK)
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_DYING_GASP, MV_FALSE);
return(rcode);
}
else
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_DYING_GASP, MV_TRUE);
}
}
return(MV_OK);
}
#endif /* PON_FPGA */
/*******************************************************************************
**
** mvOnuGponMacPasswordMessageSend
** ____________________________________________________________________________
**
** DESCRIPTION: The function sends password message in the US direction
**
** PARAMETERS: MV_U8 onuId
** MV_U8 *password
** MV_U32 counter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacPasswordMessageSend(MV_U8 onuId, MV_U8 *password, MV_U32 counter)
{
MV_U32 time;
MV_U32 i;
MV_STATUS rcode;
time = (counter > 3) ? 3 : counter;
for (i = 0; i < time; i++)
{
rcode = mvOnuGponMacMessageSend(onuId, ONU_GPON_US_MSG_PASSWORD, password);
if (rcode != MV_OK)
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_PASSWORD, MV_FALSE);
return(rcode);
}
else
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_PASSWORD, MV_TRUE);
}
}
return(MV_OK);
}
/*******************************************************************************
**
** mvOnuGponMacReiMessageSend
** ____________________________________________________________________________
**
** DESCRIPTION: The function sends dying gasp message in the US direction
**
** PARAMETERS: MV_U8 onuId
** MV_U8 errorsCounter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacReiMessageSend(MV_U8 onuId, MV_U32 errorsCounter)
{
MV_STATUS rcode;
static MV_U8 sequenceNumber = 0;
MV_U8 data[12];
data[0] = (MV_U8)((errorsCounter >> 24) & 0xFF);
data[1] = (MV_U8)((errorsCounter >> 16) & 0xFF);
data[2] = (MV_U8)((errorsCounter >> 8) & 0xFF);
data[3] = (MV_U8)(errorsCounter & 0xFF);
data[4] = sequenceNumber;
sequenceNumber++;
if (sequenceNumber > 0xF) sequenceNumber = 0;
rcode = mvOnuGponMacMessageSend(onuId, ONU_GPON_US_MSG_REI, data);
if (rcode != MV_OK)
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_REI, MV_FALSE);
return(rcode);
}
else
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_REI, MV_TRUE);
}
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacAcknowledgeMessageSend
** ____________________________________________________________________________
**
** DESCRIPTION: The function sends acknowledge message in the US direction
**
** PARAMETERS: MV_U8 onuId
** MV_U8 errorsCounter
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacAcknowledgeMessageSend(MV_U8 onuId, MV_U8 dmId, MV_U8 *dmByte)
{
MV_STATUS rcode;
MV_U8 data[12];
data[0] = dmId;
data[1] = onuId;
data[2] = dmId;
data[3] = dmByte[0];
data[4] = dmByte[1];
data[5] = dmByte[2];
data[6] = dmByte[3];
data[7] = dmByte[4];
data[8] = dmByte[5];
data[9] = dmByte[6];
rcode = mvOnuGponMacMessageSend(onuId, ONU_GPON_US_MSG_ACK, data);
if (rcode != MV_OK)
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_ACK, MV_FALSE);
return(rcode);
}
else
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_ACK, MV_TRUE);
}
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacEncryptionKeyMessageSend
** ____________________________________________________________________________
**
** DESCRIPTION: The function sends encryption key message in the US direction
**
** PARAMETERS: MV_U8 onuId
** MV_U8 KeyIndex
** MV_U8 fragIndex
** MV_U8 *key
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacEncryptionKeyMessageSend(MV_U8 onuId,
MV_U8 KeyIndex,
MV_U8 fragIndex,
MV_U8 *key)
{
MV_STATUS rcode;
MV_U8 data[12];
data[0] = KeyIndex;
data[1] = fragIndex;
data[2] = key[0];
data[3] = key[1];
data[4] = key[2];
data[5] = key[3];
data[6] = key[4];
data[7] = key[5];
data[8] = key[6];
data[9] = key[7];
rcode = mvOnuGponMacMessageSend(onuId, ONU_GPON_US_MSG_ENCRYPT_KEY, data);
if (rcode != MV_OK)
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_ENCRYPT_KEY, MV_FALSE);
return(rcode);
}
else
{
mvOnuGponMacTxSwCountersAdd(ONU_GPON_US_MSG_ENCRYPT_KEY, MV_TRUE);
}
return(rcode);
}
/******************************************************************************/
/* ========================================================================== */
/* AES Support */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** mvOnuGponMacAesInit
** ____________________________________________________________________________
**
** DESCRIPTION: The function init onu AES
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacAesInit(void)
{
MV_U32 i;
MV_STATUS rcode = MV_OK;
for (i = 0 ; i < (GPON_ONU_MAX_GEM_PORTS/32) ; i++)
{
onuGponPortAesStatusImage[i] = 0;
rcode |= asicOntGlbRegWrite(mvAsicReg_GPON_GEM_AES_PID_TABLE, onuGponPortAesStatusImage[i], i);
}
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacAesEnableSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function enable onu AES
**
** PARAMETERS: MV_BOOL enable
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacAesEnableSet(MV_BOOL enable)
{
MV_STATUS rcode = MV_OK;
MV_U32 enableBit;
enableBit = (enable == MV_TRUE) ? 1 : 0;
rcode = asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CONFIG_AES , enableBit, 0);
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacAesPortIdSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function AES for port Id
**
** PARAMETERS: MV_U32 portId
** MV_BOOL status
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacAesPortIdSet(MV_U32 portId, MV_BOOL status)
{
MV_STATUS rcode;
MV_U32 group;
MV_U32 groupOffset;
MV_U32 regData;
MV_U32 statusBit;
group = portId / 32;
groupOffset = portId % 32;
statusBit = (status == MV_TRUE) ? 1 : 0;
/* Get Image */
regData = onuGponPortAesStatusImage[group];
/* Update the bit */
regData &= ~(1 << groupOffset); /* Clear the bit */
regData |= (statusBit << groupOffset); /* Set the status */
onuGponPortAesStatusImage[group] = regData; /* Update the Image */
rcode = asicOntGlbRegWrite (mvAsicReg_GPON_GEM_AES_PID_TABLE , regData, group);
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacAesPortIdGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return port Id AES state
**
** PARAMETERS: MV_U32 portId
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_BOOL mvOnuGponMacAesPortIdGet(MV_U32 portId)
{
MV_U32 group;
MV_U32 groupOffset;
MV_U32 statusBit;
MV_BOOL status;
group = portId / 32;
groupOffset = portId % 32;
statusBit = (onuGponPortAesStatusImage[group] >> groupOffset) & 1;
status = (statusBit == 0) ? MV_FALSE : MV_TRUE;
return(status);
}
/*******************************************************************************
**
** mvOnuGponMacAesKeyShadowWrite
** ____________________________________________________________________________
**
** DESCRIPTION: The function write AES key to GPON MAC
**
** PARAMETERS: MV_U8 *key
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacAesKeyShadowWrite(MV_U8 *key)
{
MV_U32 i;
MV_U32 regData;
MV_STATUS rcode = MV_OK;
for (i = 0 ; i < 4 ; i++)
{
regData = (((MV_U32)(key[i * 4])) << 24) |
(((MV_U32)(key[i * 4 + 1])) << 16) |
(((MV_U32)(key[i * 4 + 2])) << 8) |
((MV_U32)(key[i * 4 + 3]));
rcode |= asicOntGlbRegWrite (mvAsicReg_GPON_GEM_AES_SHADOW_KEY, regData, i);
}
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacIpgValueSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function sets IPG value
**
** PARAMETERS: MV_U32 ipgVal
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacIpgValueSet(MV_U32 ipgVal)
{
return(asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CFG_IPG_VALUE , ipgVal, 0));
}
/*******************************************************************************
**
** mvOnuGponMacIpgValueGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function returns IPG value
**
** PARAMETERS: MV_U32 *ipgVal
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacIpgValueGet(MV_U32 *ipgVal)
{
return(asicOntGlbRegRead(mvAsicReg_GPON_GEM_CFG_IPG_VALUE, ipgVal, 0));
}
/*******************************************************************************
**
** mvOnuGponMacIpgValidSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function enables IPG value settings
**
** PARAMETERS: MV_BOOL enable
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacIpgValidSet(MV_BOOL enable)
{
MV_U32 enableBit = (enable == MV_TRUE) ? 1 : 0;
return(asicOntGlbRegWrite(mvAsicReg_GPON_GEM_CFG_IPG_VALID , enableBit, 0));
}
/*******************************************************************************
**
** mvOnuGponMacIpgValidGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function get IPG value inabled/disabled status
**
** PARAMETERS: MV_BOOL *enable
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacIpgValidGet(MV_BOOL *enable)
{
MV_STATUS rcode = MV_OK;
MV_U32 enableBit;
if (enable == 0)
return(MV_BAD_PARAM);
rcode = asicOntGlbRegRead(mvAsicReg_GPON_GEM_CFG_IPG_VALID , &enableBit, 0);
if (rcode == MV_OK)
*enable = (enableBit == 0) ? MV_FALSE : MV_TRUE;
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacGemInit
** ____________________________________________________________________________
**
** DESCRIPTION: The function init onu Gem
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacGemInit(void)
{
MV_U32 i;
MV_STATUS rcode = MV_OK;
for (i = 0 ; i < (GPON_ONU_MAX_GEM_PORTS/32) ; i++)
{
onuGponPortValidStatusImage[i] = 0;
rcode |= asicOntGlbRegWrite (mvAsicReg_GPON_GEM_VALID_PID_TABLE, onuGponPortValidStatusImage[i], i);
}
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacPortIdValidSet
** ____________________________________________________________________________
**
** DESCRIPTION: The function set valid for port Id
**
** PARAMETERS: MV_U32 portId
** MV_BOOL status
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_STATUS mvOnuGponMacPortIdValidSet(MV_U32 portId, MV_BOOL status)
{
MV_STATUS rcode;
MV_U32 group;
MV_U32 groupOffset;
MV_U32 regData;
MV_U32 statusBit;
group = portId / 32;
groupOffset = portId % 32;
statusBit = (status == MV_TRUE) ? 1 : 0;
/* Get Image */
regData = onuGponPortValidStatusImage[group];
/* Update the bit */
regData &= ~(1 << groupOffset); /* Clear the bit */
regData |= (statusBit << groupOffset); /* Set the status */
onuGponPortValidStatusImage[group] = regData; /* Update the Image */
rcode = asicOntGlbRegWrite (mvAsicReg_GPON_GEM_VALID_PID_TABLE , regData, group);
return(rcode);
}
/*******************************************************************************
**
** mvOnuGponMacPortIdValidGet
** ____________________________________________________________________________
**
** DESCRIPTION: The function return port Id valid state
**
** PARAMETERS: MV_U32 portId
**
** OUTPUTS: None
**
** RETURNS: MV_OK or error
**
*******************************************************************************/
MV_BOOL mvOnuGponMacPortIdValidGet(MV_U32 portId)
{
MV_U32 group;
MV_U32 groupOffset;
MV_U32 statusBit;
MV_BOOL status;
group = portId / 32;
groupOffset = portId % 32;
statusBit = (onuGponPortValidStatusImage[group] >> groupOffset) & 1;
status = (statusBit == 0) ? MV_FALSE : MV_TRUE;
return(status);
}
/******************************************************************************/
/* ========================================================================== */
/* SW FIFO */
/* ========================================================================== */
/******************************************************************************/
/*******************************************************************************
**
** mvOnuGponMacFifoInit
** ____________________________________________________________________________
**
** DESCRIPTION: The function inits SW FIFO
**
** PARAMETERS: None
**
** OUTPUTS: None
**
** RETURNS: None
**
*******************************************************************************/