📄 uart.h
字号:
*/#define UART_GETTXBUFLWMARK 0x0121/*! \brief UART _ioctl() command code to set the transmit buffer high watermark. * * The configuration parameter specifies the number of bytes. */#define UART_SETTXBUFHWMARK 0x0122/*! \brief UART _ioctl() command code to query the transmit buffer high watermark. * * The configuration parameter specifies the number of bytes. */#define UART_GETTXBUFHWMARK 0x0123/*! \brief UART _ioctl() command code to set the receive buffer low watermark. * * The configuration parameter specifies the number of bytes. */#define UART_SETRXBUFLWMARK 0x0124/*! \brief UART _ioctl() command code to query the receive buffer low watermark. * * The configuration parameter specifies the number of bytes. */#define UART_GETRXBUFLWMARK 0x0125/*! \brief UART _ioctl() command code to set the receive buffer high watermark. * * The configuration parameter specifies the number of bytes. */#define UART_SETRXBUFHWMARK 0x0126/*! \brief UART _ioctl() command code to query the receive buffer high watermark. * * The configuration parameter specifies the number of bytes. */#define UART_GETRXBUFHWMARK 0x0127/*! \brief UART _ioctl() command code to set the block read mode** The configuration parameter specifies the block read mode.*/#define UART_SETBLOCKREAD 0x0128/*! \brief UART _ioctl() command code to query the receive buffer high watermark.** The configuration parameter specifies the block read mode.*/#define UART_GETBLOCKREAD 0x0129/*! \brief UART _ioctl() command code to set physical device to the raw mode. * * The configuration parameter specifies the raw mode for device. In raw mode * data encapsulation is not allowed to be done. This allows other processing to * be done on physical device. */#define UART_SETRAWMODE 0x012a/*! \brief UART _ioctl() command code to query the raw mode. * * The configuration parameter specified the raw mode. */#define UART_GETRAWMODE 0x012b/*! * \addtogroup xgUARTStatus * \brief UART device status flags, * * A combination of these status flags is used by the _ioctl() commands * \ref UART_SETSTATUS and \ref UART_GETSTATUS. *//*@{*//*! \brief Framing error. * * \ref UART_SETSTATUS will clear this error. */#define UART_FRAMINGERROR 0x00000001UL/*! \brief Overrun error. * * \ref UART_SETSTATUS will clear this error. */#define UART_OVERRUNERROR 0x00000002UL/*! \brief Parity error. * * \ref UART_SETSTATUS will clear this error. */#define UART_PARITYERROR 0x00000004UL/*! \brief UART errors. * * \ref UART_SETSTATUS will clear all errors. */#define UART_ERRORS (UART_FRAMINGERROR | UART_OVERRUNERROR | UART_PARITYERROR)/*! \brief Receiver buffer empty. */#define UART_RXBUFFEREMPTY 0x00000040UL/*! \brief Transmitter buffer empty. * * \ref UART_SETSTATUS will immediately clear the buffer. It will not * wait until the remaining characters have been transmitted. */#define UART_TXBUFFEREMPTY 0x00000080UL/*! \brief RTS handshake output enabled. */#define UART_RTSENABLED 0x00000100UL/*! \brief RTS handshake output disabled. */#define UART_RTSDISABLED 0x00000200UL/*! \brief CTS handshake input enabled. */#define UART_CTSENABLED 0x00000400UL/*! \brief CTS handshake input disabled. */#define UART_CTSDISABLED 0x00000800UL/*! \brief DTR handshake output enabled. */#define UART_DTRENABLED 0x00001000UL/*! \brief DTR handshake output disabled. */#define UART_DTRDISABLED 0x00002000UL/*! \brief Receiver enabled. */#define UART_RXENABLED 0x00010000UL/*! \brief Receiver enabled. */#define UART_RXDISABLED 0x00020000UL/*! \brief Transmitter enabled. */#define UART_TXENABLED 0x00040000UL/*! \brief Transmitter enabled. */#define UART_TXDISABLED 0x00080000UL/*! \brief Receive address frames only. * * Used in multidrop communication. May only work if 9 databits have * been configured. */#define UART_RXADDRFRAME 0x00100000UL/*! \brief Receive all frames. * * Used in multidrop communication. */#define UART_RXNORMFRAME 0x00200000UL/*! \brief Transmit as address frame. * * Used in multidrop communication. May only work if 9 databits have * been configured. */#define UART_TXADDRFRAME 0x00400000UL/*! \brief Transmit as normal frame. * * Used in multidrop communication. */#define UART_TXNORMFRAME 0x00800000UL/*@}*//*! * \addtogroup xgUARTHS * \brief UART handshake modes. * * Any of these values may be used by the _ioctl() commands * \ref UART_SETFLOWCONTROL and \ref UART_GETFLOWCONTROL. *//*@{*//*! \brief RTS / CTS hardware handshake. * * Nut/OS uses DTE definitions, where RTS is output and CTS is input. */#define UART_HS_RTSCTS 0x0003/*! \brief Full modem hardware handshake. * * Not supported yet by the standard drivers. */#define UART_HS_MODEM 0x001F/*! \brief XON / XOFF software handshake. * * It is recommended to set a proper read timeout with software handshake. * In this case a timeout may occur, if the communication peer lost our * last XON character. The application may then use ioctl() to disable the * receiver and do the read again. This will send out another XON. */#define UART_HS_SOFT 0x0020/*@}*//*! * \addtogroup xgUARTClock * \brief UART device clock modes. * * Any of these values may be used by the _ioctl() commands * \ref UART_SETCLOCKMODE and \ref UART_GETCLOCKMODE. Most drivers * require to set the bit rate after modifying the clock mode. In order * to avoid unknown clock output frequencies in master mode, set the * clock mode to \ref UART_SYNCSLAVE first, than use \ref UART_SETSPEED * to select the bit rate and finally switch to \ref UART_SYNCMASTER or * \ref UART_NSYNCMASTER. *//*@{*/#define UART_SYNC 0x01#define UART_MASTER 0x02#define UART_NCLOCK 0x04#define UART_HIGHSPEED 0x20/*! \brief Normal asynchronous mode. */#define UART_ASYNC 0x00/*! \brief Synchronous slave mode. * * Transmit data changes on rising edge and receive data is sampled on * the falling edge of the clock input. */#define UART_SYNCSLAVE UART_SYNC/*! \brief Synchronous master mode. * * Transmit data changes on rising edge and receive data is sampled on * the falling edge of the clock output. */#define UART_SYNCMASTER (UART_SYNC | UART_MASTER)/*! \brief Synchronous slave mode, clock negated. * * Similar to \ref UART_SYNCSLAVE, but transmit data changes on falling * edge and receive data is sampled on the rising edge of the clock input. */#define UART_NSYNCSLAVE (UART_SYNC | UART_NCLOCK)/*! \brief Synchronous master mode, clock negated * * Similar to \ref UART_SYNCMASTER, but transmit data changes on falling * edge and receive data is sampled on the rising edge of the clock output. */#define UART_NSYNCMASTER (UART_SYNC | UART_NCLOCK | UART_MASTER)/*! \brief Asynchronous high speed mode. * * More deviation sensitive than normal mode, but supports higher speed. */#define UART_ASYNC_HS UART_HIGHSPEED/*@}*//*@}*/__BEGIN_DECLS/* * The following prototypes are misplaced and should be removed * from here. * * A note by Jan Dubiec: I suggest move them to dev/uart[01].c; * more, those files could be even merged. * */extern int UartAvrInit(NUTDEVICE * dev);extern int UartAvrIOCtl(NUTDEVICE * dev, int req, void *conf);extern int UartAvrInput(NUTDEVICE * dev);extern int UartAvrOutput(NUTDEVICE * dev);extern int UartAvrFlush(NUTDEVICE * dev);extern int UartAvrGetRaw(u_char * cp);extern int UartAvrPutRaw(u_char ch);extern int UartAvrRead(NUTFILE * fp, void *buffer, int size);extern int UartAvrWrite(NUTFILE * fp, CONST void *buffer, int len);#ifdef __HARVARD_ARCH__extern int UartAvrWrite_P(NUTFILE * fp, PGM_P buffer, int len);#endifextern NUTFILE *UartAvrOpen(NUTDEVICE * dev, CONST char *name, int mode, int acc);extern long UartAvrSize(NUTFILE * fp);extern int UartAvrClose(NUTFILE * fp);__END_DECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -