X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=doc%2Fhtml%2Fref%2Fio-tty-driver.html;fp=doc%2Fhtml%2Fref%2Fio-tty-driver.html;h=721d6a36d1891705b2244be42b1666db6e11d976;hb=2b5bec7716c03d42cfb16d8c98c9cea573bf6722;hp=0000000000000000000000000000000000000000;hpb=47412fc4bd1aefc0d5498bcb3860a9d727196f16;p=karo-tx-redboot.git diff --git a/doc/html/ref/io-tty-driver.html b/doc/html/ref/io-tty-driver.html new file mode 100644 index 00000000..721d6a36 --- /dev/null +++ b/doc/html/ref/io-tty-driver.html @@ -0,0 +1,487 @@ + + + + + + + + + TTY driver +
eCos Reference Manual
PrevChapter 16. Serial driver detailsNext

TTY driver

Use the include file <cyg/io/ttyio.h> for +this driver.

This driver is built on top of the simple +serial driver and is typically used for a device that interfaces with +humans such as a terminal. It provides some minimal formatting of data +on output and allows for line-oriented editing on input.

Runtime configuration

Runtime configuration is achieved by exchanging data structures with +the driver via the cyg_io_set_config() and +cyg_io_get_config() functions.

typedef struct {
+ cyg_uint32 tty_out_flags;
+ cyg_uint32 tty_in_flags;
+} cyg_tty_info_t;

The field tty_out_flags +is used to control what happens to data as it is send to the serial +port. It contains a bitmap comprised of the bits as defined by the +CYG_TTY_OUT_FLAGS_xxx values below.

#define CYG_TTY_OUT_FLAGS_CRLF 0x0001 // Map '\n' => '\n\r' on output

If this bit is set in tty_out_flags, +any occurrence of the character "\n" will +be replaced by the sequence "\n\r" before +being sent to the device.

The field tty_in_flags +is used to control how data is handled as it comes from the serial +port. It contains a bitmap comprised of the bits as defined by the +CYG_TTY_IN_FLAGS_xxx values below.

#define CYG_TTY_IN_FLAGS_CR 0x0001 // Map '\r' => '\n' on input

If this bit is set in tty_in_flags, the +character "\r" (“return” or “enter” on +most keyboards) will be mapped to "\n".

#define CYG_TTY_IN_FLAGS_CRLF 0x0002 // Map '\n\r' => '\n' on input

If this bit is set in tty_in_flags, the +character sequence "\n\r" (often sent by DOS/Windows +based terminals) will be mapped to "\n".

#define CYG_TTY_IN_FLAGS_BINARY 0x0004 // No input processing

If this bit is set in tty_in_flags, the +input will not be manipulated in any way before being placed in +the user’s buffer.

#define CYG_TTY_IN_FLAGS_ECHO 0x0008 // Echo characters as processed

If this bit is set in tty_in_flags, characters +will be echoed back to the serial port as they are processed.

API details

cyg_io_read(handle, buf, len)

This function is used to read data from the device. In the +default case, data is read until an end-of-line character ("\n" +or "\r") is read. Additionally, the characters are echoed +back to the [terminal] device. Minimal editing +of the input is also supported.

Note: When connecting to a remote target via GDB it is not possible +to provide console input while GDB is connected. The GDB remote +protocol does not support input. Users must disconnect from GDB +if this functionality is required.

	
+cyg_io_write(handle, buf, len)

This function is used to send data to the device. In the default +case, the end-of-line character "\n" is replaced by the +sequence "\n\r".

cyg_io_get_config(handle, key, buf, len)

This function is used to get information about the channel’s +configuration at runtime.

CYG_IO_GET_CONFIG_TTY_INFO

Serial driver keys (see above) may also be specified +in which case the call is passed directly to the serial +driver.

cyg_io_set_config(handle, key, buf, len)

This function is used to modify the channel’s configuration +at runtime.

CYG_IO_SET_CONFIG_TTY_INFO

Serial driver +keys (see above) may also be specified in which case the +call is passed directly to the serial driver.


PrevHomeNext
Serial driver detailsUpHow to Write a Driver
\ No newline at end of file