RTEMS
Classes | 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.

Classes

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. More...
 
#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. More...
 
typedef struct rtems_termios_device_node rtems_termios_device_node
 Termios device node for installed devices. More...
 
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)
 
static __inline__ void rtems_termios_device_context_initialize (rtems_termios_device_context *context, const char *name)
 Initializes a device context. More...
 
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. More...
 
static __inline__ void * rtems_termios_get_device_context (const rtems_termios_tty *tty)
 Returns the device context of an installed Termios device. More...
 
static __inline__ void rtems_termios_device_lock_acquire (rtems_termios_device_context *context, rtems_interrupt_lock_context *lock_context)
 Acquires the device lock. More...
 
static __inline__ void rtems_termios_device_lock_release (rtems_termios_device_context *context, rtems_interrupt_lock_context *lock_context)
 Releases the device lock. More...
 
void rtems_termios_set_best_baud (struct termios *term, uint32_t baud)
 Sets the best baud value in the Termios control. More...
 
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. More...
 
rtems_termios_baud_t rtems_termios_baud_to_number (speed_t baud)
 Converts the baud flags to an integral baud value. More...
 
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. More...
 
int rtems_termios_kqfilter (rtems_libio_t *iop, struct knote *kn)
 Termios kqueue() filter filesystem node handler. More...
 
int rtems_termios_mmap (rtems_libio_t *iop, void **addr, size_t len, int prot, off_t off)
 Termios mmap() filter filesystem node handler. More...
 
int rtems_termios_poll (rtems_libio_t *iop, int events)
 Termios poll() filesystem node handler. More...
 

Variables

struct rtems_termios_linesw rtems_termios_linesw []
 
int rtems_termios_nlinesw
 
const rtems_assoc_t rtems_termios_baud_table []
 RTEMS Termios Baud Table.
 

Detailed Description

RTEMS termios device support internal data structures

Definition in file termiostypes.h.

Macro Definition Documentation

◆ RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER

#define RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER (   name)
Value:
{ \
rtems_termios_device_lock_acquire_default, \
rtems_termios_device_lock_release_default \
}
#define RTEMS_INTERRUPT_LOCK_INITIALIZER(_name)
%
Definition: intr.h:355

Initializer for static initialization of Termios device contexts.

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

Definition at line 129 of file termiostypes.h.

Typedef Documentation

◆ rtems_termios_device_context

◆ 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
0Invalid baud value or a baud value of B0.
otherIntegral baud value.

◆ rtems_termios_device_context_initialize()

static __inline__ void rtems_termios_device_context_initialize ( rtems_termios_device_context context,
const char *  name 
)
static

Initializes a device context.

Parameters
[in]contextThe Termios device context.
[in]nameThe 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.

Definition at line 113 of file termiostypes.h.

◆ 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_fileThe device file path.
[in]handlerThe device handler. It must be persistent throughout the installed time of the device.
[in]flowThe 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]contextThe device context. It must be persistent throughout the installed time of the device.
Return values
RTEMS_SUCCESSFULSuccessful operation.
RTEMS_NO_MEMORYNot enough memory to create a device node.
RTEMS_UNSATISFIEDCreation of the device file failed.
RTEMS_INCORRECT_STATETermios is not initialized.
See also
rtems_termios_get_device_context().

◆ rtems_termios_device_lock_acquire()

static __inline__ void rtems_termios_device_lock_acquire ( rtems_termios_device_context context,
rtems_interrupt_lock_context lock_context 
)
static

Acquires the device lock.

Parameters
[in]contextThe device context.
[in]lock_contextThe local interrupt lock context for an acquire and release pair.

Definition at line 442 of file termiostypes.h.

◆ rtems_termios_device_lock_release()

static __inline__ void rtems_termios_device_lock_release ( rtems_termios_device_context context,
rtems_interrupt_lock_context lock_context 
)
static

Releases the device lock.

Parameters
[in]contextThe device context.
[in]lock_contextThe local interrupt lock context for an acquire and release pair.

Definition at line 457 of file termiostypes.h.

◆ rtems_termios_get_device_context()

static __inline__ void* rtems_termios_get_device_context ( const rtems_termios_tty tty)
static

Returns the device context of an installed Termios device.

Parameters
[in]ttyThe Termios control.

Definition at line 428 of file termiostypes.h.

◆ 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
B0Invalid baud value or a baud value of 0.
otherBaud 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]termThe Termios attributes.
[in]baudThe 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
0Successful operation.
-1Invalid baud value.