示例#1
0
/*******************************************************************************
**
**  onuEponMaxSleepTimerHndl
**  ____________________________________________________________________________
**
**  DESCRIPTION: The function is the timer callback when timer for 
**               keeping power saving mode is expired
**
**  PARAMETERS:  void
**
**  OUTPUTS:     void
**
**  RETURNS:     void
**
*******************************************************************************/
void onuEponMaxSleepTimerHndl(void)
{
    unsigned long flags;
    
    spin_lock_irqsave(&onuPonIrqLock, flags);
    
    onuPonTimerDisable(&(onuPonResourceTbl_s.onuEponMaxSleepTimerId));

    if (onuPonResourceTbl_s.onuEponSleepDurationTimerId.onuPonTimerActive == ONU_PON_TIMER_ACTIVE)
    {
        onuPonTimerDisable(&(onuPonResourceTbl_s.onuEponSleepDurationTimerId));
    }

    /* Leave power saving mode */
    onuEponDbOnuSleepWakeupStatusSet(E_EPON_NOT_POWER_SAVING_STATUS);

    /* Enable TX/RX */
    mvEponApiSleepModeCtrl(MV_FALSE);

    /* Send SleepStatusUpdate alarm to OLT */
    // todo
    

    spin_unlock_irqrestore(&onuPonIrqLock, flags);
}
示例#2
0
/*******************************************************************************
**
**  onuEponTxControlTimerHndl
**  ____________________________________________________________________________
**
**  DESCRIPTION: The function is the timer callback when timer for 
**               shutting the Tx is expired
**
**  PARAMETERS:  void
**
**  OUTPUTS:     void
**
**  RETURNS:     void
**
*******************************************************************************/
void onuEponTxControlTimerHndl(void)
{
    unsigned long flags;
    
    spin_lock_irqsave(&onuPonIrqLock, flags);
    
    onuPonTimerDisable(&(onuPonResourceTbl_s.onuEponTxControlTimerId));

    /* Turn off the tx power */
    onuPonTxPowerOn(MV_FALSE);

    spin_unlock_irqrestore(&onuPonIrqLock, flags);
}
/*******************************************************************************
**
**  onuPonTxPowerTimerStateSet
**  ____________________________________________________________________________
**
**  DESCRIPTION: The function enable / disable TX power off timer
**
**  PARAMETERS:  MV_BOOL mode - MV_TRUE  - start timer
**                              MV_FALSE - stop timer
**  OUTPUTS:     None
**
**  RETURNS:     MV_OK or error
**
*******************************************************************************/
MV_STATUS onuPonTxPowerTimerStateSet(MV_BOOL mode)
{
  MV_STATUS rcode = MV_OK;

  if (mode == MV_TRUE)
  {
    onuPonTimerEnable(&(onuPonResourceTbl_s.onuPonTxPwrTimerId));
  }
  else
  {
    onuPonTimerDisable(&(onuPonResourceTbl_s.onuPonTxPwrTimerId));
  }

  return (rcode);
}
/*******************************************************************************
**
**  onuPonPatternBurstOff
**  ____________________________________________________________________________
**
**  DESCRIPTION: The function Turn off  pattern burst and reconnect PON MAC
**
**  PARAMETERS:  None
**
**  OUTPUTS:     None
**
**  RETURNS:     MV_OK or error
**
*******************************************************************************/
MV_STATUS onuPonPatternBurstOff(void)
{
	MV_STATUS  status;

	onuPonPatternBurstTransmit(MV_TRUE);
	onuPonPatternBurstEnable(MV_FALSE);

	status  = asicOntMiscRegWrite(mvAsicReg_PON_SERDES_INTERNAL_EN_LOOP_TIMING, 0x1, 0);
	if (status != MV_OK)
		return(status);

	/*Set system in MAC mode, meaning connect the PON MAC*/
	status  = asicOntMiscRegWrite(mvAsicReg_PON_SERDES_INTERNAL_OPEN_TX_DOOR_15, 0x0, 0);
	if (status != MV_OK)
		return(status);

	/*Set serdes power down in phy mode*/
	status = asicOntMiscRegWrite(mvAsicReg_PON_SERDES_POWER_PHY_MODE, 0x8d00,0);
	if (status != MV_OK)
		return(status);


	/* Set the output enable of the GP_BEN IO to Output */
	status  = asicOntMiscRegWrite(mvAsicReg_PON_SERDES_PHY_CTRL_1_BEN_IO_EN, ONU_PHY_OUTPUT, 0);
	if (status != MV_OK)
		return(status);

	/*turn off selected pattern*/
	status  = asicOntMiscRegWrite(mvAsicReg_PT_PATTERN_ENABLED, 0x0, 0);
	if (status != MV_OK)
		return(status);

	/*stop tranmission */
	status = onuPonPatternBurstTransmit(MV_FALSE);
	if (status != MV_OK)
		return(status);
	/*stop timer operation*/
	onuPonTimerDisable(&(onuPonResourceTbl_s.onuPonPatternBurstTimerId));

	time_interval_up     = 0;
	time_interval_down   = 0;

	return(MV_OK);
}
示例#5
0
/*******************************************************************************
**
**  onuEponAsicReInit
**  ____________________________________________________________________________
** 
**  DESCRIPTION: The function re-init default onu EPON MAC configuration 
**               
**  PARAMETERS:  MV_U32 macId
**
**  OUTPUTS:     None
**
**  RETURNS:     MV_OK or error
**                   
*******************************************************************************/
MV_STATUS onuEponAsicReInit(MV_U32 macId, MV_U32 silenceMode)
{
  MV_STATUS status;
  MV_U32    rxGenFecEn = 0;
  MV_U32    txGenFecEn = 0;
  MV_U32    txMacFecEn[8] = {0,0,0,0,0,0,0,0};

  status = mvOnuEponMacOnuStateSet(ONU_EPON_NOT_REGISTERD, macId);
  if (status != MV_OK)
  {
    mvPonPrint(PON_PRINT_ERROR, PON_INIT_MODULE,
               "ERROR: (%s:%d) mvOnuEponMacOnuStateSet\n\r", __FILE_DESC__, __LINE__);
    return(MV_ERROR);
  }

  status = mvOnuEponMacTxmLlidSet(ONU_DEF_TX_LLID, macId); 
  if (status != MV_OK)
  {
    mvPonPrint(PON_PRINT_ERROR, PON_INIT_MODULE,
               "ERROR: (%s:%d) mvOnuEponMacTxmLlidSet\n\r", __FILE_DESC__, __LINE__);
    return(MV_ERROR);
  }

  status = mvOnuEponMacRxpLlidDataSet(ONU_DEF_RX_LLID, macId); 
  if (status != MV_OK)
  {
    mvPonPrint(PON_PRINT_ERROR, PON_INIT_MODULE,
               "ERROR: (%s:%d) mvOnuEponMacRxpLlidDataSet\n\r", __FILE_DESC__, __LINE__);
    return(MV_ERROR);
  }

  /* handle silence mode */
  if ((onuEponDbOnuSilenceStateGet() != ONU_SILENCE_NOT_ACTIVE) &&
	  (silenceMode == ONU_SILENCE_ENABLED))
  {
	/* Clear onu Silence Timers */
	onuPonTimerDisable(&(onuPonResourceTbl_s.onuPonSilenceTimerId[macId]));

	status  = mvOnuEponMacGenOnuConfigAutoAckSet(ONU_REG_ACK_AUTO_RES);
	status |= mvOnuEponMacGenOnuConfigAutoRequestSet(ONU_REG_REQ_AUTO_RES);
	if (status != MV_OK)
	{
	  mvPonPrint(PON_PRINT_ERROR, PON_MNG_MODULE,
				 "ERROR: (%s:%d) Failed to enable auto request / ack\n\r", __FILE_DESC__, __LINE__);
	  return(status);
	}

	onuEponDbOnuCfgAutoSet(ONU_REG_REQ_AUTO_RES, ONU_REG_ACK_AUTO_RES, ONU_REPORT_AUTO_RES);
  }

  mvPonPrint(PON_PRINT_DEBUG, PON_MNG_MODULE,
			 "DEBUG: (%s:%d) onuEponAsicReInit, rxGenFecEn(%d), txGenFecEn(%d), txMacFecEn(%d,%d,%d,%d,%d,%d,%d,%d)\n", 
			 __FILE_DESC__, __LINE__, rxGenFecEn, txGenFecEn, txMacFecEn[0], txMacFecEn[1], txMacFecEn[2], txMacFecEn[3],
             txMacFecEn[4], txMacFecEn[5], txMacFecEn[6], txMacFecEn[7]);

  status = onuEponApiFecConfig(rxGenFecEn, txGenFecEn, txMacFecEn, ONU_FEC_CFG_RE_INIT); 
  if (status != MV_OK)
  {
    mvPonPrint(PON_PRINT_ERROR, PON_INIT_MODULE,
    		   "ERROR: (%s:%d) onuEponApiFecConfig\n\r", __FILE_DESC__, __LINE__);
    return(MV_ERROR);
  }

  /* clear OAM SW FIFO - Tx */
  onuEponOamFlushAllMsg();

  mvPonPrint(PON_PRINT_DEBUG, PON_MNG_MODULE,
			 "DEBUG: (%s:%d) onuEponAsicReInit, onuEponOamFlushAllMsg\n\r", __FILE_DESC__, __LINE__);

#if 0 /* NOT USED */
  status = onuEponAsicQueueDisable(macId); 
  if (status != MV_OK)
  {
    mvPonPrint(PON_PRINT_ERROR, PON_INIT_MODULE,
               "ERROR: (%s:%d) onuEponAsicQueueDisable\n\r", __FILE_DESC__, __LINE__);
    return(MV_ERROR);
  }

  if (macId == 0) 
  {
    status = onuEponAsicFiFoReInit(); 
    if (status != MV_OK)
    {
      mvPonPrint(PON_PRINT_ERROR, PON_INIT_MODULE,
                 "ERROR: (%s:%d) onuEponMacFiFoReInit\n\r", __FILE_DESC__, __LINE__);
      return(MV_ERROR);
    }
  }
#endif  /* NOT USED */
  
  return(MV_OK);
}
/*******************************************************************************
**
**  onuPonPatternBurstOn
**  ____________________________________________________________________________
**
**  DESCRIPTION: The function start TX transmissions of a selected pattern as periodic or static burst
**
**  PARAMETERS:
**      MV_U32 pattern      0x1     1T
**                          0x2     2T
**                          0x80    PRBS - 9
**                          0x82    PRBS - 15
**                          0x83    PRBS - 23
**     MV_BOOL isPeriodic   TX burst can be either static (in this case the following parameters has no effect)
**                          and this parameter is FALSE OR periodic in this case this parameters is TRUE
**     MV_U32 period        cycle time - the time in micro seconds between the start of on peak and the other
**                          (must be greater then the duration interval)
**     MV_U32 duration      peak time interval in micro seconds  (must be smaller then the duration interval)

**
**  OUTPUTS:     None
**
**  RETURNS:     MV_OK or error
**
*******************************************************************************/
MV_STATUS onuPonPatternBurstOn(MV_U32 pattern, MV_BOOL isPeriodic, MV_U32 period, MV_U32 duration)
{
	MV_STATUS  status;

	/*pattern validation*/
	if (!((pattern == ONU_PON_TX_PATTERN_TYPE_T1) ||
	      (pattern == ONU_PON_TX_PATTERN_TYPE_T2) ||
	      (pattern == ONU_PON_TX_PATTERN_TYPE_PRBS_9) ||
	      (pattern == ONU_PON_TX_PATTERN_TYPE_PRBS_15) ||
	      (pattern == ONU_PON_TX_PATTERN_TYPE_PRBS_23))) {

		mvPonPrint(PON_PRINT_ERROR, PON_INIT_MODULE, "Wrong pattern type value %d \n", pattern);
		return MV_BAD_VALUE;
	}

	if ((isPeriodic == MV_TRUE) && (duration >= period)) {
		mvPonPrint(PON_PRINT_ERROR, PON_INIT_MODULE,
			   "Period value %d MUST be greater then duration value %d \n", period, duration);
		return MV_BAD_VALUE;
	}

	/*in case of sequential call to onuPonPatternBurstOn*/
	/*stop timer operation and transmissions*/
	onuPonTimerDisable(&(onuPonResourceTbl_s.onuPonPatternBurstTimerId));
	onuPonPatternBurstTransmit(MV_TRUE);
	onuPonPatternBurstEnable(MV_FALSE);
	time_interval_up     = 0;
	time_interval_down   = 0;

	if (mvCtrlRevGet() == ONU_ASIC_REV_Z2) {

		/* ASIC Rev Z2 */
		/* =========== */
		status  = asicOntMiscRegWrite(mvAsicReg_PON_SERDES_PHY_CTRL_1_BEN_IO_EN, ONU_PHY_INPUT, 0);
		if (status != MV_OK)
			return(status);

	} else if (mvCtrlRevGet() == ONU_ASIC_REV_A0) {

		/* ASIC Rev A0 */
		/* =========== */
		status  = asicOntMiscRegWrite(mvAsicReg_PON_SERDES_PHY_CTRL_1_BEN_IO_EN, ONU_PHY_OUTPUT, 0);
		if (status != MV_OK)
			return(status);
	}

	status  = asicOntMiscRegWrite(mvAsicReg_PON_SERDES_INTERNAL_EN_LOOP_TIMING, 0x0, 0);
	if (status != MV_OK)
		return(status);

	/*Set system in PHY mode, meaning disconnect the PON MAC*/
	status  = asicOntMiscRegWrite(mvAsicReg_PON_SERDES_INTERNAL_OPEN_TX_DOOR_15, 0x1, 0);
	if (status != MV_OK)
		return(status);

	/*Set sedes power up in phy mode*/
	status = asicOntMiscRegWrite(mvAsicReg_PON_SERDES_POWER_PHY_MODE, 0xfd04,0);
	if (status != MV_OK)
		return(status);

	/*set select on pattern*/
	status  = asicOntMiscRegWrite(mvAsicReg_PT_PATTERN_SELECT, 0x7, 0);
	if (status != MV_OK)
		return(status);

	/*set pattern type*/
	status  = asicOntMiscRegWrite(mvAsicReg_PT_PATTERN_DATA, pattern, 0);
	if (status != MV_OK)
		return(status);

	/*turn on selected pattern*/
	status  = asicOntMiscRegWrite(mvAsicReg_PT_PATTERN_ENABLED, 0x1, 0);
	if (status != MV_OK)
		return(status);


	onuPonPatternBurstEnable(MV_TRUE);
	if (isPeriodic == MV_TRUE) {
		/*periosic burst*/
		time_interval_up     = duration;
		time_interval_down   = (period - duration);
		transmit_up          = MV_TRUE;
		onuPonTimerUpdate(&(onuPonResourceTbl_s.onuPonPatternBurstTimerId),0,time_interval_up,1);

	}

	return(MV_OK);
}