XilinxProcessorIPLib/drivers/can/src/xcan.c
int XCan_Send(XCan *InstancePtr, u32 *FramePtr)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);

	/* Check if TX FIFO has room. If not, return error code */
	if (XCan_IsTxFifoFull(InstancePtr) == TRUE) {
		return XST_FIFO_NO_ROOM;
	}

	/* Write IDR */
	XCan_WriteReg(InstancePtr->BaseAddress, XCAN_TXFIFO_ID_OFFSET,
			FramePtr[0]);

	/* Write DLC */
	XCan_WriteReg(InstancePtr->BaseAddress, XCAN_TXFIFO_DLC_OFFSET,
			FramePtr[1]);

	/* Write Data Word 1 */
	XCan_WriteReg(InstancePtr->BaseAddress, XCAN_TXFIFO_DW1_OFFSET,
			FramePtr[2]);

	/* Write Data Word 2 */
	XCan_WriteReg(InstancePtr->BaseAddress, XCAN_TXFIFO_DW2_OFFSET,
			FramePtr[3]);

	return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function sends a CAN Frame. This function first checks if TX FIFO is
* full. If not, it then writes the given frame into the TX FIFO;  otherwise,
* it returns error code immediately. This function does not wait for the given
* frame being sent to CAN bus.
*
*
* @param	InstancePtr is a pointer to the XCan instance to be worked on.
* @param	FramePtr is a pointer to a 32-bit aligned buffer containing the
*		CAN frame to be sent.
*
* @return
*		- XST_SUCCESS if TX FIFO was not full and the given frame was
*		written into the FIFO;
*		- XST_FIFO_NO_ROOM if there is no room in the TX FIFO for the
*		given frame
*
* @note		None.
*
******************************************************************************/
This function sends a CAN Frame. This function first checks if TX FIFO is
full. If not, it then writes the given frame into the TX FIFO;  otherwise,
it returns error code immediately. This function does not wait for the given
frame being sent to CAN bus.
This function sends a CAN Frame . This function first checks if TX FIFO is full . If not it then writes the given frame into the TX FIFO ; otherwise it returns error code immediately . This function does not wait for the given frame being sent to CAN bus .
int XCan_Send(XCan *InstancePtr, u32 *FramePtr)
{
	Xil_AssertNonvoid(InstancePtr != NULL);
	Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
	if (XCan_IsTxFifoFull(InstancePtr) == TRUE) {
		return XST_FIFO_NO_ROOM;
	}
	XCan_WriteReg(InstancePtr->BaseAddress, XCAN_TXFIFO_ID_OFFSET,
			FramePtr[0]);
	XCan_WriteReg(InstancePtr->BaseAddress, XCAN_TXFIFO_DLC_OFFSET,
			FramePtr[1]);
	XCan_WriteReg(InstancePtr->BaseAddress, XCAN_TXFIFO_DW1_OFFSET,
			FramePtr[2]);
	XCan_WriteReg(InstancePtr->BaseAddress, XCAN_TXFIFO_DW2_OFFSET,
			FramePtr[3]);
	return XST_SUCCESS;
}
int XCan_Send ( XCan * InstancePtr , u32 * FramePtr ) { Xil_AssertNonvoid ( InstancePtr != NULL ) ; Xil_AssertNonvoid ( InstancePtr -> IsReady == XIL_COMPONENT_IS_READY ) ; if ( XCan_IsTxFifoFull ( InstancePtr ) == TRUE ) { return XST_FIFO_NO_ROOM ; } XCan_WriteReg ( InstancePtr -> BaseAddress , XCAN_TXFIFO_ID_OFFSET , FramePtr [ 0 ] ) ; XCan_WriteReg ( InstancePtr -> BaseAddress , XCAN_TXFIFO_DLC_OFFSET , FramePtr [ 1 ] ) ; XCan_WriteReg ( InstancePtr -> BaseAddress , XCAN_TXFIFO_DW1_OFFSET , FramePtr [ 2 ] ) ; XCan_WriteReg ( InstancePtr -> BaseAddress , XCAN_TXFIFO_DW2_OFFSET , FramePtr [ 3 ] ) ; return XST_SUCCESS ; }
This function sends a CAN Frame.
This function sends a CAN Frame .
/* Check if TX FIFO has room. If not, return error code */ /* Write IDR */ /* Write DLC */ /* Write Data Word 1 */ /* Write Data Word 2 */