/**************************************************************
$Workfile:   rfmobjs.c  $
***************************************************************
**
** FIRMWARE, Copyright (C) 2000-2002
** Ikanos Communications, 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 $
***************************************************************/

/*********************************************************************
	 
	 this file defines the intantiation of the objects and conversion 
		between the portid and object
	
*********************************************************************/

#include	<stdio.h>

#include "ipos.h"
#include "rfmdef.h"
#include "rfmifcpe.h"
#include "rfmifco.h"
#include "rfmlocal.h"
#include "appconfig.h"   			   
#include "portmap.h"
#include "apperrCode.h"

	   
// #ifdef	VTU_R
ipos_rfm_cpe		iposRFMCpe[MAX_NUM_OF_PORTS];

ipos_rfm_cpe	*iposRFMIndxGetCpe( int index)
{
	if(index>MAX_NUM_OF_PORTS-1||index<0)
	{
		printf("Failed to get the RFM object: index=%d \n", index);
		return	NULL;
	}

	return(&iposRFMCpe[index]);
}



ipos_rfm_cpe	*iposRFMGetCpePe(ipos_port_id	pid)
{

	int	lineNum;
	int	ival = getLineNum(pid, &lineNum);

	if(ival!=IPOS_SUCCESS && ival !=PM_ERROR_NOT_VALID)
	{
		printf("Failed to get the RFM object for port b%dp%d\n", pid.bmeNum, pid.portNum );
		return	NULL;
	}

	if(lineNum>MAX_NUM_OF_PORTS)
	{
		printf("Failed to get the RFM object: LineNum=%d \n", lineNum);
		return	NULL;
	}

	lineNum=lineNum-1;
	return(&iposRFMCpe[lineNum]);
}
// #endif


// #ifdef	VTU_O
ipos_rfm_co	   	iposRFMCo[MAX_NUM_OF_PORTS];


ipos_rfm_co	*iposRFMIndxGetCo( int index)
{
	if(index>MAX_NUM_OF_PORTS-1||index<0)
	{
		printf("Failed to get the RFM object: index=%d \n", index);
		return	NULL;
	}

	return(&iposRFMCo[index]);
}


ipos_rfm_co	*iposRFMGetCoPe(ipos_port_id	pid)
{

	int	lineNum;
	if(getLineNum(pid, &lineNum)!=IPOS_SUCCESS)
	{
//		printf("Failed to get the RFM object \n");
//		return	NULL;
	}

	if(lineNum>MAX_NUM_OF_PORTS)
	{
		printf("Failed to get the RFM object: LineNum=%d \n", lineNum);
		return	NULL;
	}

	lineNum=lineNum-1;
	return(&iposRFMCo[lineNum]);
}

//#endif





