Nut/OS  5.0.5
API Reference
UART I/O Control Functions

UART _ioctl() commands. More...

Collaboration diagram for UART I/O Control Functions:

Modules

 UART Status
 

UART device status flags,.


 XgUARTHS
 

UART handshake modes.


 XgUARTClock
 

UART device clock modes.


Defines

#define UART_SETSPEED   0x0101
 UART _ioctl() command code to set the line speed.
#define UART_GETSPEED   0x0102
 UART _ioctl() command code to query the line speed.
#define UART_SETDATABITS   0x0103
 UART _ioctl() command code to set the number of data bits.
#define UART_GETDATABITS   0x0104
 UART _ioctl() command code to query the number of data bits.
#define UART_SETPARITY   0x0105
 UART _ioctl() command code to set the parity mode.
#define UART_GETPARITY   0x0106
 UART _ioctl() command code to query the parity mode.
#define UART_SETSTOPBITS   0x0107
 UART _ioctl() command code to set the number of stop bits.
#define UART_GETSTOPBITS   0x0108
 UART _ioctl() command code to query the number of stop bits.
#define UART_SETSTATUS   0x0109
 UART _ioctl() command code to set the status.
#define UART_GETSTATUS   0x010a
 UART _ioctl() command code to query the status.
#define UART_SETREADTIMEOUT   0x010b
 UART _ioctl() command code to set the read timeout.
#define UART_GETREADTIMEOUT   0x010c
 UART _ioctl() command code to query the read timeout.
#define UART_SETWRITETIMEOUT   0x010d
 UART _ioctl() command code to set the write timeout.
#define UART_GETWRITETIMEOUT   0x010e
 UART _ioctl() command code to query the write timeout.
#define UART_SETLOCALECHO   0x010f
 UART _ioctl() command code to set the local echo mode.
#define UART_GETLOCALECHO   0x0110
 UART _ioctl() command code to query the local echo mode.
#define UART_SETFLOWCONTROL   0x0111
 UART _ioctl() command code to set the flow control mode.
#define UART_GETFLOWCONTROL   0x0112
 UART _ioctl() command code to query the flow control mode.
#define UART_SETCOOKEDMODE   0x0113
 UART _ioctl() command code to set the cooking mode.
#define UART_GETCOOKEDMODE   0x0114
 UART _ioctl() command code to query the cooking mode.
#define UART_SETBUFFERMODE   0x0115
 UART _ioctl() command code to set the buffering mode.
#define UART_GETBUFFERMODE   0x0116
 UART _ioctl() command code to query the buffering mode.
#define HDLC_SETIFNET   0x0117
 UART _ioctl() command code to set the network interface mode.
#define HDLC_GETIFNET   0x0118
 UART _ioctl() command code to query the network interface mode.
#define UART_SETCLOCKMODE   0x0119
 UART _ioctl() command code to set the clock mode.
#define UART_GETCLOCKMODE   0x011a
 UART _ioctl() command code to query the clock mode.
#define UART_SETTXBUFSIZ   0x011b
 UART _ioctl() command code to set the transmit buffer size.
#define UART_GETTXBUFSIZ   0x011c
 UART _ioctl() command code to query the transmit buffer size.
#define UART_SETRXBUFSIZ   0x011d
 UART _ioctl() command code to set the receive buffer size.
#define UART_GETRXBUFSIZ   0x011e
 UART _ioctl() command code to query the receive buffer size.
#define UART_SETTXBUFLWMARK   0x0120
 UART _ioctl() command code to set the transmit buffer low watermark.
#define UART_GETTXBUFLWMARK   0x0121
 UART _ioctl() command code to query the transmit buffer low watermark.
#define UART_SETTXBUFHWMARK   0x0122
 UART _ioctl() command code to set the transmit buffer high watermark.
#define UART_GETTXBUFHWMARK   0x0123
 UART _ioctl() command code to query the transmit buffer high watermark.
#define UART_SETRXBUFLWMARK   0x0124
 UART _ioctl() command code to set the receive buffer low watermark.
#define UART_GETRXBUFLWMARK   0x0125
 UART _ioctl() command code to query the receive buffer low watermark.
#define UART_SETRXBUFHWMARK   0x0126
 UART _ioctl() command code to set the receive buffer high watermark.
#define UART_GETRXBUFHWMARK   0x0127
 UART _ioctl() command code to query the receive buffer high watermark.
#define UART_SETBLOCKREAD   0x0128
 UART _ioctl() command code to set the block read mode.
#define UART_GETBLOCKREAD   0x0129
 UART _ioctl() command code to query the the block read mode.
#define UART_SETBLOCKWRITE   0x012a
 UART _ioctl() command code to set the block write mode.
#define UART_GETBLOCKWRITE   0x012b
 UART _ioctl() command code to query the the block write mode.
#define UART_SETRAWMODE   0x012c
 UART _ioctl() command code to set physical device to the raw mode.
#define UART_GETRAWMODE   0x012d
 UART _ioctl() command code to query the raw mode.
#define HDLC_SETTXACCM   0x012e
 AHDLC _ioctl() command code to set the ACCM (Control Character Mask).
#define HDLC_GETTXACCM   0x012f
 AHDLC _ioctl() command code to get the ACCM (Control Character Mask).
#define UART_SETHDPXMODE   0x0130
 UART _ioctl() command code to set physical device to half duplex mode.
#define UART_GETHDPXMODE   0x0131
 UART _ioctl() command code to query the halfduplex mode.

Detailed Description

UART _ioctl() commands.

These commands are used to control and retrieve hardware specific configurations. The definitions are kept independent from the underlying hardware, but not all commands may be fully implemented in each UART driver.

The _ioctl() function expects three parameters:


Define Documentation

#define UART_SETSPEED   0x0101

UART _ioctl() command code to set the line speed.

The configuration parameter must be a pointer to a uint32_t variable, which contains the bit rate per second (baud rate). The command sets both, input and output speed.

Which speeds are available depends on the target platform and the current peripheral clock frequency. If available, the initial speed will be 115200, but may be re-configured via UART_INIT_BAUDRATE.

See also UART_GETSPEED.

Examples:
caltime/caltime.c, cppdemo/cppdemo.cc, editconf/editconf.c, events/events.c, ftpd/ftpserv.c, httpd/httpserv.c, httpd_simple/httpd_simple.c, httpd_upnp/httpserv.c, icmp-udp/icmp-udp.c, inetq/inetq.c, logtime/logtime.c, pingnet/pingnet.c, pppc/pppc.c, rs232d/rs232d.c, snmpd/snmpd.c, tcps/tcps.c, threads/threads.c, timers/timers.c, and uart/uart.c.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrInit(), AhdlcAvrIOCtl(), At91DevDebugIOCtl(), InitDebugDevice(), main(), UartAvrInit(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETSPEED   0x0102

UART _ioctl() command code to query the line speed.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current bit rate per second.

See also UART_SETSPEED.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_SETDATABITS   0x0103

UART _ioctl() command code to set the number of data bits.

The configuration parameter must be a pointer to a uint8_t variable, which contains the number of data bits.

Typically the number of data bits is initially set to 8. Most platforms aloow to change this to 7 bits, some may support 5, 6 or 9 bits.

See also UART_GETDATABITS.

Referenced by AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETDATABITS   0x0104

UART _ioctl() command code to query the number of data bits.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current number of data bits.

See also UART_SETDATABITS.

Referenced by AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_SETPARITY   0x0105

UART _ioctl() command code to set the parity mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested parity mode, 0 (none), 1 (odd) or 2 (even).

On most platforms the initial parity mode is set to 0.

See also UART_GETPARITY.

Referenced by AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETPARITY   0x0106

UART _ioctl() command code to query the parity mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current parity mode, 0 (none), 1 (odd) or 2 (even).

See also UART_SETPARITY.

Referenced by AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_SETSTOPBITS   0x0107

UART _ioctl() command code to set the number of stop bits.

The configuration parameter must be a pointer to a uint32_t variable, which contains the number of stop bits.

Most platforms support 1 or 2 stop bits, initially set to 1.

See also UART_GETSTOPBITS.

Referenced by AhdlcAvrIOCtl(), NutRegisterOwiBus_Uart(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETSTOPBITS   0x0108

UART _ioctl() command code to query the number of stop bits.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current number of stop bits.

See also UART_SETSTOPBITS.

Referenced by AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_SETSTATUS   0x0109

UART _ioctl() command code to set the status.

The configuration parameter must be a pointer to a uint32_t variable, which contains the UART status to be set.

See also UART_GETSTATUS.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETSTATUS   0x010a

UART _ioctl() command code to query the status.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current UART status.

See also UART_SETSTATUS.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_SETREADTIMEOUT   0x010b

UART _ioctl() command code to set the read timeout.

The configuration parameter must be a pointer to a uint32_t variable, which contains the read timeout in milliseconds.

See also UART_GETREADTIMEOUT.

Examples:
pppc/pppc.c.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), NutChatSend(), NutRegisterOwiBus_Uart(), UartAvrIOCtl(), and UsartIOCtl().

#define UART_GETREADTIMEOUT   0x010c

UART _ioctl() command code to query the read timeout.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current read timeout in milliseconds.

See also UART_SETREADTIMEOUT.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), and UsartIOCtl().

#define UART_SETWRITETIMEOUT   0x010d

UART _ioctl() command code to set the write timeout.

The configuration parameter must be a pointer to a uint32_t variable, which contains the write timeout in milliseconds.

See also UART_GETWRITETIMEOUT.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), and UsartIOCtl().

#define UART_GETWRITETIMEOUT   0x010e

UART _ioctl() command code to query the write timeout.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current write timeout in milliseconds.

See also UART_SETWRITETIMEOUT.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), and UsartIOCtl().

#define UART_SETLOCALECHO   0x010f

UART _ioctl() command code to set the local echo mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested echo mode, either 0 (off) or 1 (on).

See also UART_GETLOCALECHO.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), and UsartIOCtl().

#define UART_GETLOCALECHO   0x0110

UART _ioctl() command code to query the local echo mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current echo mode, either 0 (off) or 1 (on).

See also UART_SETLOCALECHO.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), and UsartIOCtl().

#define UART_SETFLOWCONTROL   0x0111

UART _ioctl() command code to set the flow control mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested flow control mode.

See also UART_GETFLOWCONTROL.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETFLOWCONTROL   0x0112

UART _ioctl() command code to query the flow control mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current flow control mode.

See also UART_SETFLOWCONTROL.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_SETCOOKEDMODE   0x0113

UART _ioctl() command code to set the cooking mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested cooking mode, either 0 (raw) or 1 (EOL translation).

See also UART_GETCOOKEDMODE.

Referenced by UartAvrIOCtl(), UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETCOOKEDMODE   0x0114

UART _ioctl() command code to query the cooking mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current cooking mode, either 0 (raw) or 1 (EOL translation).

See also UART_SETCOOKEDMODE.

Referenced by UartAvrIOCtl(), and UsartIOCtl().

#define UART_SETBUFFERMODE   0x0115

UART _ioctl() command code to set the buffering mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested buffering mode.

See also UART_GETBUFFERMODE.

#define UART_GETBUFFERMODE   0x0116

UART _ioctl() command code to query the buffering mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current buffering mode.

See also UART_SETBUFFERMODE.

#define HDLC_SETIFNET   0x0117

UART _ioctl() command code to set the network interface mode.

The configuration parameter must be a pointer to the NUTDEVICE structure of the network device to enable HDLC mode, or a NULL pointer to disable it.

See also HDLC_GETIFNET.

Examples:
pppc/pppc.c.

Referenced by AhdlcAt91IOCtl(), AhdlcAvrIOCtl(), IpcpLowerDown(), and NutNetIfConfig2().

#define HDLC_GETIFNET   0x0118

UART _ioctl() command code to query the network interface mode.

The configuration parameter must be a pointer to a pointer variable, which receives a NUTDEVICE pointer to the current network device if HDLC is enabled, or NULL if disabled.

See also HDLC_SETIFNET.

Referenced by AhdlcAt91IOCtl(), and AhdlcAvrIOCtl().

#define UART_SETCLOCKMODE   0x0119

UART _ioctl() command code to set the clock mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested clock mode.

See also UART_GETCLOCKMODE.

Referenced by UsartIOCtl().

#define UART_GETCLOCKMODE   0x011a

UART _ioctl() command code to query the clock mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current clock mode.

See also UART_SETCLOCKMODE.

Referenced by UsartIOCtl().

#define UART_SETTXBUFSIZ   0x011b

UART _ioctl() command code to set the transmit buffer size.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested size of the transmit buffer in bytes.

See also UART_GETTXBUFSIZ.

Referenced by UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETTXBUFSIZ   0x011c

UART _ioctl() command code to query the transmit buffer size.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current size of the transmit buffer in bytes.

See also UART_SETTXBUFSIZ.

Referenced by UsartIOCtl().

#define UART_SETRXBUFSIZ   0x011d

UART _ioctl() command code to set the receive buffer size.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested size of the receive buffer in bytes.

See also UART_GETRXBUFSIZ.

Referenced by UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETRXBUFSIZ   0x011e

UART _ioctl() command code to query the receive buffer size.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current size of the receive buffer in bytes.

See also UART_SETRXBUFSIZ.

Referenced by UsartIOCtl().

#define UART_SETTXBUFLWMARK   0x0120

UART _ioctl() command code to set the transmit buffer low watermark.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested low watermark of the transmit buffer.

See also UART_GETTXBUFLWMARK.

Referenced by UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETTXBUFLWMARK   0x0121

UART _ioctl() command code to query the transmit buffer low watermark.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current low watermark of the transmit buffer.

See also UART_SETTXBUFLWMARK.

Referenced by UsartIOCtl().

#define UART_SETTXBUFHWMARK   0x0122

UART _ioctl() command code to set the transmit buffer high watermark.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested high watermark of the transmit buffer.

See also UART_GETTXBUFHWMARK.

Referenced by UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETTXBUFHWMARK   0x0123

UART _ioctl() command code to query the transmit buffer high watermark.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current high watermark of the transmit buffer.

See also UART_SETTXBUFHWMARK.

Referenced by UsartIOCtl().

#define UART_SETRXBUFLWMARK   0x0124

UART _ioctl() command code to set the receive buffer low watermark.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested low watermark of the receive buffer.

See also UART_GETRXBUFLWMARK.

Referenced by UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETRXBUFLWMARK   0x0125

UART _ioctl() command code to query the receive buffer low watermark.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current low watermark of the receive buffer.

See also UART_SETRXBUFLWMARK.

Referenced by UsartIOCtl().

#define UART_SETRXBUFHWMARK   0x0126

UART _ioctl() command code to set the receive buffer high watermark.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested high watermark of the receive buffer.

See also UART_GETRXBUFHWMARK.

Referenced by UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETRXBUFHWMARK   0x0127

UART _ioctl() command code to query the receive buffer high watermark.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current high watermark of the receive buffer.

See also UART_SETRXBUFHWMARK.

Referenced by UsartIOCtl().

#define UART_SETBLOCKREAD   0x0128

UART _ioctl() command code to set the block read mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested block read mode, either 0 (disabled) or 1 (enabled).

See also UART_GETBLOCKREAD.

Referenced by UnixDevIOCTL(), and UsartIOCtl().

#define UART_GETBLOCKREAD   0x0129

UART _ioctl() command code to query the the block read mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current read block mode, either 0 (disabled) or 1 (enabled).

See also UART_SETBLOCKREAD.

Referenced by UnixDevIOCTL(), and UsartIOCtl().

#define UART_SETBLOCKWRITE   0x012a

UART _ioctl() command code to set the block write mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested block write mode, either 0 (disabled) or 1 (enabled).

See also UART_GETBLOCKWRITE.

Referenced by UsartIOCtl().

#define UART_GETBLOCKWRITE   0x012b

UART _ioctl() command code to query the the block write mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current write block mode, either 0 (disabled) or 1 (enabled).

See also UART_SETBLOCKWRITE.

Referenced by UsartIOCtl().

#define UART_SETRAWMODE   0x012c

UART _ioctl() command code to set physical device to the raw mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested raw mode, either 0 (disabled) or 1 (enabled).

In raw mode data encapsulation is not allowed to be done. This allows other processing to be done on physical device after a network device has been attached.

See also UART_GETRAWMODE.

Referenced by AhdlcAt91IOCtl(), and AhdlcAvrIOCtl().

#define UART_GETRAWMODE   0x012d

UART _ioctl() command code to query the raw mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current raw mode, either 0 (disabled) or 1 (enabled).

See also UART_SETRAWMODE.

Referenced by AhdlcAt91IOCtl(), and AhdlcAvrIOCtl().

#define HDLC_SETTXACCM   0x012e

AHDLC _ioctl() command code to set the ACCM (Control Character Mask).

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested character mask.

During the LCP stage of PPP negotiation both peers inform each other which of the control characters (0-31) will not require escaping when being transmitted. This allows the PPP layer to tell the HDLC layer about this so that data may be transmitted quicker (no escapes).

See also HDLC_GETTXACCM.

Referenced by AhdlcAvrIOCtl().

#define HDLC_GETTXACCM   0x012f

AHDLC _ioctl() command code to get the ACCM (Control Character Mask).

The configuration parameter must be a pointer to a uint32_t variable, which receives the current character mask.

See also HDLC_SETTXACCM.

Referenced by AhdlcAvrIOCtl().

#define UART_SETHDPXMODE   0x0130

UART _ioctl() command code to set physical device to half duplex mode.

The configuration parameter must be a pointer to a uint32_t variable, which contains the requested half duplex mode, either 0 (disabled) or 1 (enabled).

See also UART_GETHDPXMODE.

Referenced by UsartIOCtl().

#define UART_GETHDPXMODE   0x0131

UART _ioctl() command code to query the halfduplex mode.

The configuration parameter must be a pointer to a uint32_t variable, which receives the current half duplex mode, either 0 (disabled) or 1 (enabled).

See also UART_SETHDPXMODE.

Referenced by UsartIOCtl().