⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 apcoam.c

📁 Lucent的ATM处理套片APC驱动DEMO
💻 C
📖 第 1 页 / 共 3 页
字号:
	/* In either case, write the CC Flow Type to the EVT */	apcWriteConnInfo_Eg(devNum, ccInfo->vcx, ccInfo->ccflowtype, CCFLOWTYP);	return APC_SUCCESS;}/******************************************************************************* * * Function Name:	ApcRtn_t apcDisableOAMContinuityCheck(u8 devNum) * * Description:		Call to disable Continuity Check upon notification *			from deactivation/activation cells.  This is *			called by the application. * *			Zero the ccsink, ccsink, ccsource, and ccflowtype * * Return Value:	Error/Success flag. * * Side Effects:	none. * * Special Considerations: none. * ******************************************************************************/ApcRtn_tapcDisableOAMContinuityCheck(OAMCCInfo_t *ccInfo, u32 lut3Addr){	u8	devNum = ccInfo->devNum;	u8 connType;	u32 lut2Entry, lut2Addr;	u32	lut3OamEntry;	LUT3_OAM_t lut3oam;	ApcRtn_t retval;	lut2Addr = APC_LUT2_INDEX(devNum,ccInfo->mphy,ccInfo->vpi);	lut2Entry = APC_RD_LUT2_ENTRY(devNum,ccInfo->mphy,ccInfo->vpi);	/* connection type - if S == 0 -> VC switched */	connType = ((lut2Entry & APC_LUT2_S_VPC) ? APC_VP_FLAG : APC_VC_FLAG);	/* check switching and vci 3/4, write to IVT or OAM entry */	if (connType == APC_VC_FLAG && (ccInfo->vci == F4_SEG_VCI || ccInfo->vci == F4_E2E_VCI))	{		 /* this Read sets Selective Update mode for subsequent Write */		lut3OamEntry = apcReadCRAMselectiveFix(devNum, apcLUT3BaseAddr[devNum]+lut3Addr,			ApcLUT3OAMselectiveUpdate);		APC_GET_LUT3_OAM(lut3oam, lut3OamEntry);		lut3oam.cc_ftype = 0;		lut3oam.cc_sink = 0;		lut3oam.cc_src = 0;		lut3OamEntry = APC_LUT3_OAM(lut3oam);		/* this Write clears Selective Update mode */		retval = apcWriteCRAMselectiveFix(devNum, apcLUT3BaseAddr[devNum]+lut3Addr, lut3OamEntry, ccInfo->mphy);		return retval;	}	else	{		/* Write the CCSink and CCSource to the IVT */		apcWriteConnInfo_Ing(devNum, ccInfo->vcx, 0, CCSINK);		apcWriteConnInfo_Ing(devNum, ccInfo->vcx, 0, CCSOURCE);	}	return APC_SUCCESS;}/******************************************************************************* * * Function Name:	INT apcGetOAM_FMState(u8 devNum) * * Description:		Get the FM state from LUT3 OAM entry * * Return Value:	FM State * ******************************************************************************/INTapcGetOAM_FMState(u8 devNum, u32 lut3Addr){	u32	lut3OamEntry;	LUT3_OAM_t lut3oam;	u8 fmstate;	lut3OamEntry = apcReadCRAM(devNum, apcLUT3BaseAddr[devNum]+lut3Addr);	APC_GET_LUT3_OAM(lut3oam, lut3OamEntry);	fmstate = lut3oam.fm_state;	return fmstate;}/******************************************************************************* * * Function Name:	INT apcGetOAM_FaultProp(u8 devNum) * * Description:		Get the FM Propagation from the IVT entry * * Return Value:	fmvpprop - fault management propagation * ******************************************************************************/INTapcGetOAM_FaultProp(u8 devNum, VCIndex_t vcEntry){	u8 fmvpprop;	u32		data[MAX_IVT_WORDS];	IngVCTEntry_t	ivt;	/* get the IVT fields */	apcReadIVTWords(devNum, vcEntry, data);	apcGetIVTFields(data, &ivt);	fmvpprop = ivt.word4.f_prop_en;	return fmvpprop;}/******************************************************************************* * * Function Name:	INT apcSetOAM_FaultProp(u8 devNum) * * Description:		Set the FM Propagation in the IVT entry * * Return Value:	ApcRtn_t APC_SUCCESS * ******************************************************************************/ApcRtn_tapcSetOAM_FaultProp(u8 devNum, u8 fmvpprop, u32 vcx){	/* write the fault management propagation enable flag to the IVT */	apcWriteConnInfo_Ing(devNum, vcx, fmvpprop, FMVPPROPEN);	return APC_SUCCESS;}/********************************************************************************* Function Name:	ApcRtn_t apcOAM_FMStateChange()** Description:		This API is called by the application to*			change OAM Fault Management State**			In LUT3: set fmstate = I_FAULT*				fmDefType = 1*				Timer = 0** Return Value:		Error/Success flag.** Side Effects:		None.********************************************************************/ApcRtn_tapcOAM_FMStateChange(OAMFMInfo_t *fmInfo, u32 lut3Addr){	u8 devNum = fmInfo->devNum;	u32	lut3OamEntry;	LUT3_OAM_t lut3oam;	InsEgressOAMInfo_t eInsCell;	InsIngressOAMInfo_t iInsCell;	ApcRtn_t lret=APC_SUCCESS;	if (fmInfo->connType == APC_VC_FLAG && (fmInfo->vci == F4_SEG_VCI || fmInfo->vci == F4_E2E_VCI))	{		lut3OamEntry = apcReadCRAM(fmInfo->devNum, apcLUT3BaseAddr[devNum]+lut3Addr);		APC_GET_LUT3_OAM(lut3oam, lut3OamEntry);		lut3oam.fm_state = fmInfo->fmstate;		lut3oam.timer = 0;		lut3OamEntry = APC_LUT3_OAM(lut3oam);		if(fmInfo->fmstate == I_FAULT )		{			lut3oam.fm_deftype = PHYS_LAYER;			eInsCell.devNum = fmInfo->devNum;			eInsCell.fmDefectType = PHYS_LAYER;			eInsCell.egressMPHY = fmInfo->mphy;			eInsCell.egressVCX = fmInfo->vcx;			/* Insert an RDI cell in the Egress Insertion FIFO */			eInsCell.insertedCellType = EOAM_RDI_CELL;			lret = apcSendEgressOAMcell(&eInsCell);		} else {			lut3oam.fm_deftype = FM_DEFAULT;		}		/* write back to CRAM (lut3oam) */		apcWriteCRAM(devNum, apcLUT3BaseAddr[devNum]+lut3Addr, lut3OamEntry);		return APC_SUCCESS;	}	/* write the FMState, and FMDeftype to the IVT */	apcWriteConnInfo_Ing(devNum, fmInfo->vcx, fmInfo->fmstate, FMSTATE);	if(fmInfo->fmstate == I_FAULT)	{		apcWriteConnInfo_Ing(devNum, fmInfo->vcx, PHYS_LAYER, FMDEFTYP);		iInsCell.devNum = fmInfo->devNum;		iInsCell.fmDefectType = PHYS_LAYER;		iInsCell.insertedCellType = IOAM_AIS_CELL;		iInsCell.ingressLUT3Index = lut3Addr;		if (fmInfo->connType == APC_VC_FLAG)		{			iInsCell.oamFlowType = IOAM_F5_FLOW;		} else {			iInsCell.oamFlowType = IOAM_F4_FLOW;		}		lret = apcSendIngressOAMcell(&iInsCell);	} else {		if (fmInfo->fmstate == E_FAULT)		{			apcWriteConnInfo_Ing(devNum, fmInfo->vcx, ATM_LAYER, FMDEFTYP);			eInsCell.devNum = fmInfo->devNum;			eInsCell.fmDefectType = ATM_LAYER;			eInsCell.egressMPHY = fmInfo->mphy;			eInsCell.egressVCX = fmInfo->vcx;			/* Insert an AIS cell in the Egress Insertion FIFO */			eInsCell.insertedCellType = EOAM_AIS_CELL;			lret = apcSendEgressOAMcell(&eInsCell);		} else {			apcWriteConnInfo_Ing(devNum, fmInfo->vcx, FM_DEFAULT, FMDEFTYP);		}	}	return APC_SUCCESS;}/******************************************************************************* * * Function Name:	ApcRtn_t apcEnableOAM_PM(OAMPMInfo_t *pmInfo) * * Description:		Call to enable Performance Monitoring upon *				notification from deactivation/activation cells * * * Return Value:	Error/Success flag. * * Side Effects:	none. * * Special Considerations: none. * ******************************************************************************/ApcRtn_tapcEnableOAM_PM(OAMPMInfo_t *pmInfo, u32 lut3Addr){	u8 devNum = pmInfo->devNum;	u8 connType;	u32 lut2Entry, lut2Addr;	u32	lut3OamAddr, lut3OamEntry, lut3Entry;	LUT3_NOR_t	lut3Fields;	LUT3_OAM_t lut3oam;	OAMPrgPMTbl_t pmTblFields;	INT pmx, pmxsnk, pmxsrc;    ApcRtn_t retval;	lut2Addr = APC_LUT2_INDEX(devNum,pmInfo->mphy,pmInfo->vpi);	lut2Entry = APC_RD_LUT2_ENTRY(devNum,pmInfo->mphy,pmInfo->vpi);	/* connection type - if S == 0 -> VC switched */	connType = ((lut2Entry & APC_LUT2_S_VPC) ? APC_VP_FLAG : APC_VC_FLAG);	lut3Entry = apcReadCRAM(devNum, apcLUT3BaseAddr[devNum]+lut3Addr);	APC_GET_LUT3_NOR(lut3Fields, lut3Entry);	/* get these settings from the LUT3 (Normal) Entry */	pmTblFields.devNum = devNum;	pmTblFields.mphy = pmInfo->mphy;	pmTblFields.vci = pmInfo->vci;	pmTblFields.vpi = pmInfo->vpi;	pmTblFields.sink = pmInfo->sink;	pmTblFields.source = pmInfo->source;	pmTblFields.oamSeg = lut3Fields.oam_seg;	pmTblFields.oamE2E = lut3Fields.oam_e2e;	/* application settings */	pmTblFields.pFlow_seg = pmInfo->pmFlow_seg;	pmTblFields.pFlow_end = pmInfo->pmFlow_end;	pmTblFields.BackRep = pmInfo->pmBackRep;	pmTblFields.DataEn = pmInfo->pmDataEn;	pmTblFields.BlkSize = pmInfo->pmBlkSize;	/* allocate a PMX and write it to LUT3 after the PM Table is configured */	/* if we are VC switched and vci = 3/4, program the LUT3 OAM pmx entries */	if (connType == APC_VC_FLAG && (pmInfo->vci == F4_SEG_VCI || pmInfo->vci == F4_E2E_VCI))	{		apcGetLUT3Index(&lut3Addr, &lut3OamAddr, pmInfo->devNum, lut2Entry, pmInfo->vci, connType);		 /* this Read sets Selective Update mode for subsequent Write */		lut3OamEntry = apcReadCRAMselectiveFix(devNum, apcLUT3BaseAddr[pmInfo->devNum]+lut3OamAddr,			ApcLUT3OAMselectiveUpdate);		APC_GET_LUT3_OAM(lut3oam, lut3OamEntry);		/* get the pmx(s) for the LUT3 OAM entry */		if (pmInfo->source)		{			pmxsrc = apcGetPMX(devNum);			if(pmxsrc == -1)				return APC_NO_MORE_PMPROCESSES;			lut3oam.pmx_src = pmxsrc;			pmTblFields.pmx_src = pmxsrc;			/* Program the PM Table */			apcPrgPM_Table(&pmTblFields, lut3Fields.vcx);		}		else		{			pmTblFields.pmx_src = 0;		}		if (pmInfo->sink)		{			pmxsnk = apcGetPMX(devNum);			if(pmxsnk == -1)				return APC_NO_MORE_PMPROCESSES;			lut3oam.pmx_sink = pmxsnk;			pmTblFields.pmx_sink = pmxsnk;			/* Program the PM Table */			apcPrgPM_Table(&pmTblFields, lut3Fields.vcx);		}		else		{			pmTblFields.pmx_sink = 0;		}		lut3OamEntry = APC_LUT3_OAM(lut3oam);		/* this Write clears Selective Update mode */		retval = apcWriteCRAMselectiveFix(devNum, apcLUT3BaseAddr[devNum]+lut3OamAddr, lut3OamEntry, pmInfo->mphy);	}	else	{         /* this Read sets Selective Update mode for subsequent Write */        lut3Entry = apcReadCRAMselectiveFix(devNum, apcLUT3BaseAddr[devNum]+lut3Addr,            ApcLUT3NORselectiveUpdate);        APC_GET_LUT3_NOR(lut3Fields, lut3Entry);        pmx = apcGetPMX(pmInfo->devNum);        if (pmx == -1) return APC_NO_MORE_PMPROCESSES;        if ((pmInfo->pmFlow_seg && pmInfo->pmFlow_end) && (lut3Fields.oam_seg == 0))        {               /* case e */            pmTblFields.pmx_seg = pmx;            pmx = apcGetPMX(pmInfo->devNum);            if (pmx == -1) return APC_NO_MORE_PMPROCESSES;            pmTblFields.pmx_end = pmx;            apcPrgPM_Table(&pmTblFields, lut3Fields.vcx);            /* set the LUT3 PMX to pmx_seg */            lut3Fields.pmx = pmTblFields.pmx_seg;        }        else if (pmInfo->source && pmInfo->sink)        {               /* cases b & h */            pmTblFields.pmx_sink = pmx;            apcPrgPM_Table(&pmTblFields, lut3Fields.vcx);            pmx = apcGetPMX(pmInfo->devNum);            if (pmx == -1) return APC_NO_MORE_PMPROCESSES;            pmTblFields.pmx_src = pmx;            apcPrgPM_Table(&pmTblFields, lut3Fields.vcx);            /* set the LUT3 PMX to pmx_sink */            lut3Fields.pmx = pmTblFields.pmx_sink;        }        else        {               /* cases c, d, f, g */            pmTblFields.pmx = pmx;            if (pmInfo->sink)            {                pmTblFields.pmx_sink = pmx;            }            else if (pmInfo->source)            {                pmTblFields.pmx_src = pmx;            }            else            {                pmTblFields.pmx_sink = 0;                pmTblFields.pmx_src = 0;            }            apcPrgPM_Table(&pmTblFields, lut3Fields.vcx);            lut3Fields.pmx = pmx;        }        lut3Entry = APC_LUT3_NOR(lut3Fields);        /* this Write clears Selective Update mode */        retval = apcWriteCRAMselectiveFix(devNum, apcLUT3BaseAddr[devNum]+lut3Addr, lut3Entry, pmInfo->mphy);	}	return retval;}/******************************************************************************* *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -