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

📄 xuartps_hw.h

📁 自学ZedBoard:使用IP通过ARM PS访问FPGA(源代码)
💻 H
📖 第 1 页 / 共 2 页
字号:
 * * The baud rate divider register (BDIV) controls how much the bit sample * rate is divided by. It sets the baud rate. * Valid values are 0x04 to 0xFF. Writing a value less than 4 will be ignored. * * Baud rate = CCLK / ((BAUDDIV + 1) x BRGR), where the CCLK is selected by * the MR_CCLK bit in the MR register. * @{ */#define XUARTPS_BAUDDIV_MASK  0x000000FF	/**< 8 bit baud divider mask *//* @} *//** @name Receiver Timeout Register * * Use the receiver timeout register (RTR) to detect an idle condition on * the receiver data line. * * @{ */#define XUARTPS_RXTOUT_DISABLE		0x00000000  /**< Disable time out */#define XUARTPS_RXTOUT_MASK		0x000000FF  /**< Valid bits mask *//** @name Receiver FIFO Trigger Level Register * * Use the Receiver FIFO Trigger Level Register (RTRIG) to set the value at * which the RX FIFO triggers an interrupt event. * @{ */#define XUARTPS_RXWM_DISABLE	0x00000000  /**< Disable RX trigger interrupt */#define XUARTPS_RXWM_MASK	0x0000003F  /**< Valid bits mask *//* @} *//** @name Modem Control Register * * This register (MODEMCR) controls the interface with the modem or data set, * or a peripheral device emulating a modem. * * @{ */#define XUARTPS_MODEMCR_FCM	0x00000010  /**< Flow control mode */#define XUARTPS_MODEMCR_RTS	0x00000002  /**< Request to send */#define XUARTPS_MODEMCR_DTR	0x00000001  /**< Data terminal ready *//* @} *//** @name Modem Status Register * * This register (MODEMSR) indicates the current state of the control lines * from a modem, or another peripheral device, to the CPU. In addition, four * bits of the modem status register provide change information. These bits * are set to a logic 1 whenever a control input from the modem changes state. * * Note: Whenever the DCTS, DDSR, TERI, or DDCD bit is set to logic 1, a modem * status interrupt is generated and this is reflected in the modem status * register. * * @{ */#define XUARTPS_MODEMSR_FCMS	0x00000100  /**< Flow control mode (FCMS) */#define XUARTPS_MODEMSR_DCD	0x00000080  /**< Complement of DCD input */#define XUARTPS_MODEMSR_RI	0x00000040  /**< Complement of RI input */#define XUARTPS_MODEMSR_DSR	0x00000020  /**< Complement of DSR input */#define XUARTPS_MODEMSR_CTS	0x00000010  /**< Complement of CTS input */#define XUARTPS_MEDEMSR_DCDX	0x00000008  /**< Delta DCD indicator */#define XUARTPS_MEDEMSR_RIX	0x00000004  /**< Change of RI */#define XUARTPS_MEDEMSR_DSRX	0x00000002  /**< Change of DSR */#define XUARTPS_MEDEMSR_CTSX	0x00000001  /**< Change of CTS *//* @} *//** @name Channel Status Register * * The channel status register (CSR) is provided to enable the control logic * to monitor the status of bits in the channel interrupt status register, * even if these are masked out by the interrupt mask register. * * @{ */#define XUARTPS_SR_FLOWDEL	0x00001000 /**< RX FIFO fill over flow delay */#define XUARTPS_SR_TACTIVE	0x00000800 /**< TX active */#define XUARTPS_SR_RACTIVE	0x00000400 /**< RX active */#define XUARTPS_SR_DMS		0x00000200 /**< Delta modem status change */#define XUARTPS_SR_TOUT		0x00000100 /**< RX timeout */#define XUARTPS_SR_PARITY	0x00000080 /**< RX parity error */#define XUARTPS_SR_FRAME	0x00000040 /**< RX frame error */#define XUARTPS_SR_OVER		0x00000020 /**< RX overflow error */#define XUARTPS_SR_TXFULL	0x00000010 /**< TX FIFO full */#define XUARTPS_SR_TXEMPTY	0x00000008 /**< TX FIFO empty */#define XUARTPS_SR_RXFULL	0x00000004 /**< RX FIFO full */#define XUARTPS_SR_RXEMPTY	0x00000002 /**< RX FIFO empty */#define XUARTPS_SR_RXOVR	0x00000001 /**< RX FIFO fill over trigger *//* @} *//** @name Flow Delay Register * * Operation of the flow delay register (FLOWDEL) is very similar to the * receive FIFO trigger register. An internal trigger signal activates when the * FIFO is filled to the level set by this register. This trigger will not * cause an interrupt, although it can be read through the channel status * register. In hardware flow control mode, RTS is deactivated when the trigger * becomes active. RTS only resets when the FIFO level is four less than the * level of the flow delay trigger and the flow delay trigger is not activated. * A value less than 4 disables the flow delay. * @{ */#define XUARTPS_FLOWDEL_MASK	XUARTPS_RXWM_MASK	/**< Valid bit mask *//* @} *//**************************** Type Definitions *******************************//***************** Macros (Inline Functions) Definitions *********************//****************************************************************************//*** Read a UART register.** @param	BaseAddress contains the base address of the device.* @param	RegOffset contains the offset from the base address of the*		device.** @return	The value read from the register.** @note		C-Style signature:*		u32 XUartPs_ReadReg(u32 BaseAddress, int RegOffset)*******************************************************************************/#define XUartPs_ReadReg(BaseAddress, RegOffset) \	Xil_In32((BaseAddress) + (RegOffset))/***************************************************************************//*** Write a UART register.** @param	BaseAddress contains the base address of the device.* @param	RegOffset contains the offset from the base address of the*		device.* @param	RegisterValue is the value to be written to the register.** @return	None.** @note		C-Style signature:*		void XUartPs_WriteReg(u32 BaseAddress, int RegOffset,*						   u16 RegisterValue)*******************************************************************************/#define XUartPs_WriteReg(BaseAddress, RegOffset, RegisterValue) \	Xil_Out32((BaseAddress) + (RegOffset), (RegisterValue))/****************************************************************************//*** Determine if there is receive data in the receiver and/or FIFO.** @param	BaseAddress contains the base address of the device.** @return	TRUE if there is receive data, FALSE otherwise.** @note		C-Style signature:*		u32 XUartPs_IsReceiveData(u32 BaseAddress)*******************************************************************************/#define XUartPs_IsReceiveData(BaseAddress)			 \	!((Xil_In32((BaseAddress) + XUARTPS_SR_OFFSET) & 	\	XUARTPS_SR_RXEMPTY) == XUARTPS_SR_RXEMPTY)/****************************************************************************//*** Determine if a byte of data can be sent with the transmitter.** @param	BaseAddress contains the base address of the device.** @return	TRUE if the TX FIFO is full, FALSE if a byte can be put in the*		FIFO.** @note		C-Style signature:*		u32 XUartPs_IsTransmitFull(u32 BaseAddress)*******************************************************************************/#define XUartPs_IsTransmitFull(BaseAddress)			 \	((Xil_In32((BaseAddress) + XUARTPS_SR_OFFSET) & 	\	 XUARTPS_SR_TXFULL) == XUARTPS_SR_TXFULL)/************************** Function Prototypes ******************************/void XUartPs_SendByte(u32 BaseAddress, u8 Data);u8 XUartPs_RecvByte(u32 BaseAddress);/************************** Variable Definitions *****************************/#ifdef __cplusplus}#endif#endif /* end of protection macro */

⌨️ 快捷键说明

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