XilinxProcessorIPLib/drivers/clockps/src/xclockps_mux.c
static u8 XClock_MuxFetchDefaultParent(u8 NodeIdx)
{
	u8  Parent;
	u8  Shift;
	u32 Value;
	u32 Reg;

	switch (NodeIdx) {
		case IOPLL_INT_MUX:
			Reg = IOPLL_CTRL;
			Shift = 16;
			break;
		case IOPLL_MUX:
			Reg = IOPLL_CTRL;
			Shift = 3;
			break;
		case RPLL_INT_MUX:
			Reg = RPLL_CTRL;
			Shift = 16;
			break;
		case RPLL_MUX:
			Reg = RPLL_CTRL;
			Shift = 3;
			break;
		case APLL_INT_MUX:
			Reg = APLL_CTRL;
			Shift = 16;
			break;
		case APLL_MUX:
			Reg = APLL_CTRL;
			Shift = 3;
			break;
		case DPLL_INT_MUX:
			Reg = DPLL_CTRL;
			Shift = 16;
			break;
		case DPLL_MUX:
			Reg = DPLL_CTRL;
			Shift = 3;
			break;
		case VPLL_INT_MUX:
			Reg = VPLL_CTRL;
			Shift = 16;
			break;
		case VPLL_MUX:
			Reg = VPLL_CTRL;
			Shift = 3;
			break;
		default:
			return ((u8)XCLOCK_INVALID_PARENT);
			break;
	}

	if (XST_SUCCESS != XClock_ReadReg(Reg, &Value)) {
		Parent = (u8)XCLOCK_INVALID_PARENT;
	} else {
		Parent = (Value & BIT(Shift)) >> Shift;
	}

	return Parent;
}
/*****************************************************************************/
/*
*
* This function fetches current default parent for the mux specified by
* mux index.
*
* @param	NodeIdx is the index of mux in database for which parent is to
*		be fetched.
*
* @return	Index of default parent.
*
* @note		This function returns XCLOCK_INVALID_PARENT in case invalid
*		node index occurs.
*
******************************************************************************/
This function fetches current default parent for the mux specified by
mux index.
This function fetches current default parent for the mux specified by mux index .
static u8 XClock_MuxFetchDefaultParent(u8 NodeIdx)
{
	u8  Parent;
	u8  Shift;
	u32 Value;
	u32 Reg;
	switch (NodeIdx) {
		case IOPLL_INT_MUX:
			Reg = IOPLL_CTRL;
			Shift = 16;
			break;
		case IOPLL_MUX:
			Reg = IOPLL_CTRL;
			Shift = 3;
			break;
		case RPLL_INT_MUX:
			Reg = RPLL_CTRL;
			Shift = 16;
			break;
		case RPLL_MUX:
			Reg = RPLL_CTRL;
			Shift = 3;
			break;
		case APLL_INT_MUX:
			Reg = APLL_CTRL;
			Shift = 16;
			break;
		case APLL_MUX:
			Reg = APLL_CTRL;
			Shift = 3;
			break;
		case DPLL_INT_MUX:
			Reg = DPLL_CTRL;
			Shift = 16;
			break;
		case DPLL_MUX:
			Reg = DPLL_CTRL;
			Shift = 3;
			break;
		case VPLL_INT_MUX:
			Reg = VPLL_CTRL;
			Shift = 16;
			break;
		case VPLL_MUX:
			Reg = VPLL_CTRL;
			Shift = 3;
			break;
		default:
			return ((u8)XCLOCK_INVALID_PARENT);
			break;
	}
	if (XST_SUCCESS != XClock_ReadReg(Reg, &Value)) {
		Parent = (u8)XCLOCK_INVALID_PARENT;
	} else {
		Parent = (Value & BIT(Shift)) >> Shift;
	}
	return Parent;
}
static u8 XClock_MuxFetchDefaultParent ( u8 NodeIdx ) { u8 Parent ; u8 Shift ; u32 Value ; u32 Reg ; switch ( NodeIdx ) { case IOPLL_INT_MUX : Reg = IOPLL_CTRL ; Shift = 16 ; break ; case IOPLL_MUX : Reg = IOPLL_CTRL ; Shift = 3 ; break ; case RPLL_INT_MUX : Reg = RPLL_CTRL ; Shift = 16 ; break ; case RPLL_MUX : Reg = RPLL_CTRL ; Shift = 3 ; break ; case APLL_INT_MUX : Reg = APLL_CTRL ; Shift = 16 ; break ; case APLL_MUX : Reg = APLL_CTRL ; Shift = 3 ; break ; case DPLL_INT_MUX : Reg = DPLL_CTRL ; Shift = 16 ; break ; case DPLL_MUX : Reg = DPLL_CTRL ; Shift = 3 ; break ; case VPLL_INT_MUX : Reg = VPLL_CTRL ; Shift = 16 ; break ; case VPLL_MUX : Reg = VPLL_CTRL ; Shift = 3 ; break ; default : return ( ( u8 ) XCLOCK_INVALID_PARENT ) ; break ; } if ( XST_SUCCESS != XClock_ReadReg ( Reg , & Value ) ) { Parent = ( u8 ) XCLOCK_INVALID_PARENT ; } else { Parent = ( Value & BIT ( Shift ) ) >> Shift ; } return Parent ; }
This function fetches current default parent for the mux specified by
mux index.
This function fetches current default parent for the mux specified by mux index .