XilinxProcessorIPLib/drivers/can/src/xcan.c
u8 XCan_GetMode(XCan *InstancePtr)
{
	u32 Value;

	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	Value = XCan_GetStatus(InstancePtr);

	if (Value & XCAN_SR_CONFIG_MASK) {	/* Configuration Mode */
		return XCAN_MODE_CONFIG;
	}
	else if (Value & XCAN_SR_SLEEP_MASK) {	/* Sleep Mode */
		return XCAN_MODE_SLEEP;
	}
	else if (Value & XCAN_SR_NORMAL_MASK) {	/* Normal Mode */
		return XCAN_MODE_NORMAL;
	}
	else {	/* If this line is reached, the device is in Loop Back Mode. */

		return XCAN_MODE_LOOPBACK;
	}
}
/****************************************************************************/
/**
*
* This routine returns current operation mode the CAN device is in.
*
* @param	InstancePtr is a pointer to the XCan instance to be worked on.
*
* @return
* 		- XCAN_MODE_CONFIG if the device is in Configuration Mode.
* 		- XCAN_MODE_SLEEP if the device is in Sleep Mode.
* 		- XCAN_MODE_NORMAL if the device is in Normal Mode.
* 		- XCAN_MODE_LOOPBACK if the device is in Loop Back Mode.
*
* @note		None.
*
*****************************************************************************/
This routine returns current operation mode the CAN device is in.
This routine returns current operation mode the CAN device is in .
u8 XCan_GetMode(XCan *InstancePtr)
{
	u32 Value;
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	Value = XCan_GetStatus(InstancePtr);
	if (Value & XCAN_SR_CONFIG_MASK) {	
		return XCAN_MODE_CONFIG;
	}
	else if (Value & XCAN_SR_SLEEP_MASK) {	
		return XCAN_MODE_SLEEP;
	}
	else if (Value & XCAN_SR_NORMAL_MASK) {	
		return XCAN_MODE_NORMAL;
	}
	else {	
		return XCAN_MODE_LOOPBACK;
	}
}
u8 XCan_GetMode ( XCan * InstancePtr ) { u32 Value ; Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; Value = XCan_GetStatus ( InstancePtr ) ; if ( Value & XCAN_SR_CONFIG_MASK ) { return XCAN_MODE_CONFIG ; } else if ( Value & XCAN_SR_SLEEP_MASK ) { return XCAN_MODE_SLEEP ; } else if ( Value & XCAN_SR_NORMAL_MASK ) { return XCAN_MODE_NORMAL ; } else { return XCAN_MODE_LOOPBACK ; } }
This routine returns current operation mode the CAN device is in.
This routine returns current operation mode the CAN device is in .
/* Configuration Mode */ /* Sleep Mode */ /* Normal Mode */ /* If this line is reached, the device is in Loop Back Mode. */