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

📄 xuartps.h

📁 自学ZedBoard:使用IP通过ARM PS访问FPGA(源代码)
💻 H
📖 第 1 页 / 共 2 页
字号:
#define XUARTPS_EVENT_MODEM		5 /**< Modem status changed *//*@}*//**************************** Type Definitions ******************************//** * This typedef contains configuration information for the device. */typedef struct {	u16 DeviceId;	 /**< Unique ID  of device */	u32 BaseAddress; /**< Base address of device (IPIF) */	u32 InputClockHz;/**< Input clock frequency */	int ModemPinsConnected; /** Specifies whether modem pins are connected				 *  to MIO or FMIO */} XUartPs_Config;/* * Keep track of state information about a data buffer in the interrupt mode. */typedef struct {	u8 *NextBytePtr;	unsigned int RequestedBytes;	unsigned int RemainingBytes;} XUartPsBuffer;/** * Keep track of data format setting of a device. */typedef struct {	u32 BaudRate;	/**< In bps, ie 1200 */	u32 DataBits;	/**< Number of data bits */	u32 Parity;	/**< Parity */	u8 StopBits;	/**< Number of stop bits */} XUartPsFormat;/******************************************************************************//** * This data type defines a handler that an application defines to communicate * with interrupt system to retrieve state information about an application. * * @param	CallBackRef is a callback reference passed in by the upper layer *		when setting the handler, and is passed back to the upper layer *		when the handler is called. It is used to find the device driver *		instance. * @param	Event contains one of the event constants indicating events that *		have occurred. * @param	EventData contains the number of bytes sent or received at the *		time of the call for send and receive events and contains the *		modem status for modem events. * ******************************************************************************/typedef void (*XUartPs_Handler) (void *CallBackRef, u32 Event,				  unsigned int EventData);/** * The XUartPs driver instance data structure. A pointer to an instance data * structure is passed around by functions to refer to a specific driver * instance. */typedef struct {	XUartPs_Config Config;	/* Configuration data structure */	u32 InputClockHz;	/* Input clock frequency */	u32 IsReady;		/* Device is initialized and ready */	u32 BaudRate;		/* Current baud rate */	XUartPsBuffer SendBuffer;	XUartPsBuffer ReceiveBuffer;	XUartPs_Handler Handler;	void *CallBackRef;	/* Callback reference for event handler */} XUartPs;/***************** Macros (Inline Functions) Definitions ********************//****************************************************************************//*** Get the UART Channel Status Register.** @param	InstancePtr is a pointer to the XUartPs instance.** @return	The value read from the register.** @note		C-Style signature:*		u16 XUartPs_GetChannelStatus(XUartPs *InstancePtr)*******************************************************************************/#define XUartPs_GetChannelStatus(InstancePtr)   \	Xil_In32(((InstancePtr)->Config.BaseAddress) + XUARTPS_SR_OFFSET)/****************************************************************************//*** Get the UART Mode Control Register.** @param	InstancePtr is a pointer to the XUartPs instance.** @return	The value read from the register.** @note		C-Style signature:*		u32 XUartPs_GetControl(XUartPs *InstancePtr)*******************************************************************************/#define XUartPs_GetModeControl(InstancePtr)  \	Xil_In32(((InstancePtr)->Config.BaseAddress) + XUARTPS_CR_OFFSET)/****************************************************************************//*** Set the UART Mode Control Register.** @param	InstancePtr is a pointer to the XUartPs instance.* @param	RegisterValue is the value to be written to the register.** @return	None.** @note		C-Style signature:*	void XUartPs_SetModeControl(XUartPs *InstancePtr, u16 RegisterValue)*******************************************************************************/#define XUartPs_SetModeControl(InstancePtr, RegisterValue) \   Xil_Out32(((InstancePtr)->Config.BaseAddress) + XUARTPS_CR_OFFSET, \			(RegisterValue))/****************************************************************************//*** Enable the transmitter and receiver of the UART.** @param	InstancePtr is a pointer to the XUartPs instance.** @return	None.** @note		C-Style signature:*		void XUartPs_EnableUart(XUartPs *InstancePtr)*******************************************************************************/#define XUartPs_EnableUart(InstancePtr) \   Xil_Out32(((InstancePtr)->Config.BaseAddress + XUARTPS_CR_OFFSET), \	  ((Xil_In32((InstancePtr)->Config.BaseAddress + XUARTPS_CR_OFFSET) & \	  ~XUARTPS_CR_EN_DIS_MASK) | (XUARTPS_CR_RX_EN | XUARTPS_CR_TX_EN)))/****************************************************************************//*** Disable the transmitter and receiver of the UART.** @param	InstancePtr is a pointer to the XUartPs instance.** @return	None.** @note		C-Style signature:*		void XUartPs_DisableUart(XUartPs *InstancePtr)*******************************************************************************/#define XUartPs_DisableUart(InstancePtr) \   Xil_Out32(((InstancePtr)->Config.BaseAddress + XUARTPS_CR_OFFSET), \	  (((Xil_In32((InstancePtr)->Config.BaseAddress + XUARTPS_CR_OFFSET)) & \	  ~XUARTPS_CR_EN_DIS_MASK) | (XUARTPS_CR_RX_DIS | XUARTPS_CR_TX_DIS)))/****************************************************************************//*** Determine if the transmitter FIFO is empty.** @param	InstancePtr is a pointer to the XUartPs instance.** @return*		- TRUE if a byte can be sent*		- FALSE if the Transmitter Fifo is not empty** @note		C-Style signature:*		u32 XUartPs_IsTransmitEmpty(XUartPs InstancePtr)*******************************************************************************/#define XUartPs_IsTransmitEmpty(InstancePtr)				\	((Xil_In32(((InstancePtr)->Config.BaseAddress) + XUARTPS_SR_OFFSET) & \	 XUARTPS_SR_TXEMPTY) == XUARTPS_SR_TXEMPTY)/************************** Function Prototypes *****************************//* * Static lookup function implemented in xuartps_sinit.c */XUartPs_Config *XUartPs_LookupConfig(u16 DeviceId);/* * Interface functions implemented in xuartps.c */int XUartPs_CfgInitialize(XUartPs *InstancePtr,				   XUartPs_Config * Config, u32 EffectiveAddr);unsigned int XUartPs_Send(XUartPs *InstancePtr, u8 *BufferPtr,			   unsigned int NumBytes);unsigned int XUartPs_Recv(XUartPs *InstancePtr, u8 *BufferPtr,			   unsigned int NumBytes);int XUartPs_SetBaudRate(XUartPs *InstancePtr, u32 BaudRate);/* * Options functions in xuartps_options.c */void XUartPs_SetOptions(XUartPs *InstancePtr, u16 Options);u16 XUartPs_GetOptions(XUartPs *InstancePtr);void XUartPs_SetFifoThreshold(XUartPs *InstancePtr, u8 TriggerLevel);u8 XUartPs_GetFifoThreshold(XUartPs *InstancePtr);u16 XUartPs_GetModemStatus(XUartPs *InstancePtr);u32 XUartPs_IsSending(XUartPs *InstancePtr);u8 XUartPs_GetOperMode(XUartPs *InstancePtr);void XUartPs_SetOperMode(XUartPs *InstancePtr, u8 OperationMode);u8 XUartPs_GetFlowDelay(XUartPs *InstancePtr);void XUartPs_SetFlowDelay(XUartPs *InstancePtr, u8 FlowDelayValue);u8 XUartPs_GetRecvTimeout(XUartPs *InstancePtr);void XUartPs_SetRecvTimeout(XUartPs *InstancePtr, u8 RecvTimeout);int XUartPs_SetDataFormat(XUartPs *InstancePtr, XUartPsFormat * Format);void XUartPs_GetDataFormat(XUartPs *InstancePtr, XUartPsFormat * Format);/* * interrupt functions in xuartps_intr.c */u32 XUartPs_GetInterruptMask(XUartPs *InstancePtr);void XUartPs_SetInterruptMask(XUartPs *InstancePtr, u32 Mask);void XUartPs_InterruptHandler(XUartPs *InstancePtr);void XUartPs_SetHandler(XUartPs *InstancePtr, XUartPs_Handler FuncPtr,			 void *CallBackRef);/* * self-test functions in xuartps_selftest.c */int XUartPs_SelfTest(XUartPs *InstancePtr);#ifdef __cplusplus}#endif#endif /* end of protection macro */

⌨️ 快捷键说明

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