/**************************************************************
***************************************************************
**
** Host Application, Copyright (C) 2002-2004
** Ikanos Communication, Fremont, CA 
** All rights reserved.
**
** The information and contents of this file are the
** proprietary information of Ikanos Communication and may not
** be disclosed or used without the formal written approval of 
** Ikanos Communication
**
***************************************************************

$Revision: 1.1 $
$Date: 2006/10/16 04:34:50 $
**************************************************************/

#include "ipos.h"
#include "appconfig.h"
#include "oampdef.h"
#include "oampstruct.h"
#include "oampproto.h"
#include "eocapp.h"
#include "portmap.h"
#include "rmmapp.h"

extern void hostLedOn(int portNum,int enable);
extern void processLed();
extern int sysClkRateGet (void);

// Global variables
extern unsigned int PortFreq[8];
extern unsigned int CpuFreq;
extern int ON[8];
extern void processTimeout();

void taskOneSec()
{
#if( (defined (BME_CPE_20) && defined (INI_SUPPORT)) || defined (VTU_O))
  ipos_port_id pid;
#endif
#ifdef VTU_O
  unsigned secCnt = 0;
#endif
int i;

    for (i=0;i<10;i++)
      hostLedOn(i,0);

	for (i=0;i<=MAX_NUM_OF_PORTS;i++) { ON[i]=0;PortFreq[i]=0;}

  appEocValidateData(0, 0);

	while (1)
	{

	processTimeout();

	processLed();
#if defined (BME_CPE_20) && defined (INI_SUPPORT)
	if (autoEnetRptEnable)
	{
    if ((getBmePortId(1, &pid) == IPOS_SUCCESS) &&
          (oampGetPortState(pid) == uSHOWTIME))
		appEocRemoteEnetStatus(pid);
	}
#endif

#ifdef VTU_O
    secCnt++;
    for (i = 1; i <= MAX_NUM_OF_PORTS; i++)
    {
      if ((getBmePortId(i, &pid) == IPOS_SUCCESS) &&
          (oampGetPortState(pid) == uSHOWTIME))
      {
        if (!(secCnt & 0x1))
          appEocFeCntrReq(pid);
#ifdef POLL_FE_SNR
        if (!(secCnt & 0x7))
          appEocFeSnrAttnReq(pid);
#endif
      }
      else
        appEocValidateData(i, 0);
    }
#endif
	
	iposTaskDelay(TICKS_PER_SECOND);
        usleep(100); //manju
	}

}

