RTEMS: cpukit/include/rtems/termiostypes.h File Reference

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
termiostypes.h File Reference
`#include <rtems.h>`
`#include <rtems/libio.h>`
`#include <rtems/assoc.h>`
`#include <rtems/chain.h>`
`#include <rtems/thread.h>`
`#include <sys/ioccom.h>`
`#include <stdint.h>`
`#include <termios.h>`

Go to the source code of this file.

## Data Structures
struct | ttywakeup
struct | rtems_termios_rawbuf
struct | rtems_termios_device_context
| Termios device context. More...
struct | rtems_termios_device_handler
| Termios device handler. More...
struct | rtems_termios_device_flow
| Termios device flow control handler. More...
struct | rtems_termios_device_node
| Termios device node for installed devices. More...
struct | rtems_termios_tty
struct | rtems_termios_linesw

## Macros
#define | RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER(name)
| Initializer for static initialization of Termios device contexts.
#define | TTYDISC 0 /* termios tty line discipline */
#define | TABLDISC 3 /* tablet discipline */
#define | SLIPDISC 4 /* serial IP discipline */
#define | PPPDISC 5 /* PPP discipline */
#define | MAXLDISC 8
#define | RTEMS_IO_SNDWAKEUP _IOW('t', 11, struct ttywakeup ) /* send tty wakeup */
#define | RTEMS_IO_RCVWAKEUP _IOW('t', 12, struct ttywakeup ) /* recv tty wakeup */
#define | OLCUC 0x00000100 /* map lower case to upper case on output */
#define | IUCLC 0x00004000 /* map upper case to lower case on input */
#define | RTEMS_TERMIOS_NUMBER_BAUD_RATES 25

## Typedefs
typedef struct rtems_termios_device_context | rtems_termios_device_context
| Termios device context.
typedef struct rtems_termios_device_node | rtems_termios_device_node
| Termios device node for installed devices.
typedef struct rtems_termios_tty | rtems_termios_tty
typedef uint32_t | rtems_termios_baud_t

## Enumerations
enum | rtems_termios_device_mode { TERMIOS_POLLED , TERMIOS_IRQ_DRIVEN , TERMIOS_TASK_DRIVEN , TERMIOS_IRQ_SERVER_DRIVEN }

## Functions
void | rtems_termios_device_lock_acquire_default (rtems_termios_device_context *ctx, rtems_interrupt_lock_context *lock_context)
void | rtems_termios_device_lock_release_default (rtems_termios_device_context *ctx, rtems_interrupt_lock_context *lock_context)
RTEMS_INLINE_ROUTINE void | rtems_termios_device_context_initialize (rtems_termios_device_context *context, const char *name)
| Initializes a device context.
rtems_status_code | rtems_termios_device_install (const char *device_file, const rtems_termios_device_handler *handler, const rtems_termios_device_flow *flow, rtems_termios_device_context *context)
| Installs a Termios device.
RTEMS_INLINE_ROUTINE void * | rtems_termios_get_device_context (const rtems_termios_tty *tty)
| Returns the device context of an installed Termios device.
RTEMS_INLINE_ROUTINE void | rtems_termios_device_lock_acquire (rtems_termios_device_context *context, rtems_interrupt_lock_context *lock_context)
| Acquires the device lock.
RTEMS_INLINE_ROUTINE void | rtems_termios_device_lock_release (rtems_termios_device_context *context, rtems_interrupt_lock_context *lock_context)
| Releases the device lock.
void | rtems_termios_set_best_baud (struct termios *term, uint32_t baud)
| Sets the best baud value in the Termios control.
void | rtems_termios_rxirq_occured (struct rtems_termios_tty *tty)
void | rtems_termios_puts (const void *buf, size_t len, struct rtems_termios_tty *tty)
speed_t | rtems_termios_number_to_baud (rtems_termios_baud_t baud)
| Converts the Integral Baud value baud to the Termios Control Flag Representation.
rtems_termios_baud_t | rtems_termios_baud_to_number (speed_t baud)
| Converts the baud flags to an integral baud value.
int | rtems_termios_baud_to_index (rtems_termios_baud_t termios_baud)
| Convert Bxxx Constant to Index.
int | rtems_termios_set_initial_baud (struct rtems_termios_tty *tty, rtems_termios_baud_t baud)
| Sets the initial baud in the Termios context tty.
int | rtems_termios_kqfilter (rtems_libio_t *iop, struct knote *kn)
| Termios kqueue() filter filesystem node handler.
int | rtems_termios_mmap (rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)
| Termios mmap() filter filesystem node handler.
int | rtems_termios_poll (rtems_libio_t *iop, int events)
| Termios poll() filesystem node handler.

## Variables
struct rtems_termios_linesw | rtems_termios_linesw []
int | rtems_termios_nlinesw
const rtems_assoc_t | rtems_termios_baud_table []
| RTEMS Termios Baud Table.
rtems_mutex | rtems_termios_ttyMutex

## Detailed Description

RTEMS termios device support internal data structures

## Macro Definition Documentation

## ◆ RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER

#define RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER | ( |  | name | ) |

Value:
{ \
{ RTEMS_INTERRUPT_LOCK_INITIALIZER( name ) }, \
rtems_termios_device_lock_acquire_default, \
rtems_termios_device_lock_release_default \
}
RTEMS_INTERRUPT_LOCK_INITIALIZER
#define RTEMS_INTERRUPT_LOCK_INITIALIZER(_name)
Initializer for static initialization of interrupt locks.
Definition: intr.h:253

Initializer for static initialization of Termios device contexts.

Parameters

  name | The name for the interrupt lock. It must be a string. The name is only used if profiling is enabled.

## Typedef Documentation

## ◆ rtems_termios_device_context

typedef struct rtems_termios_device_context rtems_termios_device_context

Termios device context.

See also
  RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER(), rtems_termios_device_context_initialize() and rtems_termios_device_install().

## ◆ rtems_termios_device_node

typedef struct rtems_termios_device_node rtems_termios_device_node

Termios device node for installed devices.

See also
  rtems_termios_device_install().

## Function Documentation

## ◆ rtems_termios_baud_to_number()

rtems_termios_baud_t rtems_termios_baud_to_number | ( | speed_t | baud | ) |

Converts the baud flags to an integral baud value.

Return values

  0 | Invalid baud value or a baud value of `B0`.
  other | Integral baud value.

## ◆ rtems_termios_device_context_initialize()

RTEMS_INLINE_ROUTINE void rtems_termios_device_context_initialize | ( | rtems_termios_device_context * | context,
|  | const char * | name
| ) |  |

Initializes a device context.

Parameters

  [in] | context | The Termios device context.
  [in] | name | The name for the interrupt lock. This name must be a string persistent throughout the life time of this lock. The name is only used if profiling is enabled.

## ◆ rtems_termios_device_install()

rtems_status_code rtems_termios_device_install | ( | const char * | device_file,
|  | const rtems_termios_device_handler * | handler,
|  | const rtems_termios_device_flow * | flow,
|  | rtems_termios_device_context * | context
| ) |  |

Installs a Termios device.

The installed Termios device may be removed via unlink().

Parameters

  [in] | device_file | The device file path.
  [in] | handler | The device handler. It must be persistent throughout the installed time of the device.
  [in] | flow | The device flow control handler. The device flow control handler are optional and may be `NULL`. If present must be persistent throughout the installed time of the device.
  [in] | context | The device context. It must be persistent throughout the installed time of the device.

Return values

  RTEMS_SUCCESSFUL | Successful operation.
  RTEMS_NO_MEMORY | Not enough memory to create a device node.
  RTEMS_UNSATISFIED | Creation of the device file failed.
  RTEMS_INCORRECT_STATE | Termios is not initialized.

See also
  rtems_termios_get_device_context().

## ◆ rtems_termios_device_lock_acquire()

RTEMS_INLINE_ROUTINE void rtems_termios_device_lock_acquire | ( | rtems_termios_device_context * | context,
|  | rtems_interrupt_lock_context * | lock_context
| ) |  |

Acquires the device lock.

Parameters

  [in] | context | The device context.
  [in] | lock_context | The local interrupt lock context for an acquire and release pair.

## ◆ rtems_termios_device_lock_release()

RTEMS_INLINE_ROUTINE void rtems_termios_device_lock_release | ( | rtems_termios_device_context * | context,
|  | rtems_interrupt_lock_context * | lock_context
| ) |  |

Releases the device lock.

Parameters

  [in] | context | The device context.
  [in] | lock_context | The local interrupt lock context for an acquire and release pair.

## ◆ rtems_termios_get_device_context()

RTEMS_INLINE_ROUTINE void * rtems_termios_get_device_context | ( | const rtems_termios_tty * | tty | ) |

Returns the device context of an installed Termios device.

Parameters

  [in] | tty | The Termios control.

## ◆ rtems_termios_kqfilter()

int rtems_termios_kqfilter | ( | rtems_libio_t * | iop,
|  | struct knote * | kn
| ) |  |

Termios kqueue() filter filesystem node handler.

Real implementation is provided by libbsd.

## ◆ rtems_termios_mmap()

int rtems_termios_mmap | ( | rtems_libio_t * | iop,
|  | void ** | addr,
|  | size_t | len,
|  | int | prot,
|  | off_t | off
| ) |  |

Termios mmap() filter filesystem node handler.

Real implementation is provided by libbsd.

## ◆ rtems_termios_number_to_baud()

speed_t rtems_termios_number_to_baud | ( | rtems_termios_baud_t | baud | ) |

Converts the Integral Baud value baud to the Termios Control Flag Representation.

Return values

  B0 | Invalid baud value or a baud value of 0.
  other | Baud constant according to baud.

## ◆ rtems_termios_poll()

int rtems_termios_poll | ( | rtems_libio_t * | iop,
|  | int | events
| ) |  |

Termios poll() filesystem node handler.

Real implementation is provided by libbsd.

## ◆ rtems_termios_set_best_baud()

void rtems_termios_set_best_baud | ( | struct termios * | term,
|  | uint32_t | baud
| ) |  |

Sets the best baud value in the Termios control.

The valid Termios baud values are between 0 and 460800. The Termios baud value is chosen which minimizes the difference to the value specified.

Parameters

  [in] | term | The Termios attributes.
  [in] | baud | The current baud setting of the device.

## ◆ rtems_termios_set_initial_baud()

int rtems_termios_set_initial_baud | ( | struct rtems_termios_tty * | tty,
|  | rtems_termios_baud_t | baud
| ) |  |

Sets the initial baud in the Termios context tty.

Return values

  0 | Successful operation.
  -1 | Invalid baud value.