RTEMS
|
#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. | |
RTEMS termios device support internal data structures
Definition in file termiostypes.h.
#define RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER | ( | name | ) |
Initializer for static initialization of Termios device contexts.
name | The 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 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.
rtems_termios_baud_t rtems_termios_baud_to_number | ( | speed_t | baud | ) |
Converts the baud flags to an integral baud value.
0 | Invalid baud value or a baud value of B0 . |
other | Integral baud value. |
|
static |
Initializes a device context.
[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. |
Definition at line 113 of file termiostypes.h.
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().
[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. |
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. |
|
static |
Acquires the device lock.
[in] | context | The device context. |
[in] | lock_context | The local interrupt lock context for an acquire and release pair. |
Definition at line 442 of file termiostypes.h.
|
static |
Releases the device lock.
[in] | context | The device context. |
[in] | lock_context | The local interrupt lock context for an acquire and release pair. |
Definition at line 457 of file termiostypes.h.
|
static |
Returns the device context of an installed Termios device.
[in] | tty | The Termios control. |
Definition at line 428 of file termiostypes.h.
int rtems_termios_kqfilter | ( | rtems_libio_t * | iop, |
struct knote * | kn | ||
) |
Termios kqueue() filter filesystem node handler.
Real implementation is provided by libbsd.
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.
speed_t rtems_termios_number_to_baud | ( | rtems_termios_baud_t | baud | ) |
Converts the Integral Baud value baud to the Termios Control Flag Representation.
B0 | Invalid baud value or a baud value of 0. |
other | Baud constant according to baud. |
int rtems_termios_poll | ( | rtems_libio_t * | iop, |
int | events | ||
) |
Termios poll() filesystem node handler.
Real implementation is provided by libbsd.
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.
[in] | term | The Termios attributes. |
[in] | baud | The current baud setting of the device. |
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.
0 | Successful operation. |
-1 | Invalid baud value. |