RTEMS
5.0.0
|
#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. 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) |
RTEMS_INLINE_ROUTINE 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... | |
RTEMS_INLINE_ROUTINE void * | rtems_termios_get_device_context (const rtems_termios_tty *tty) |
Returns the device context of an installed Termios device. More... | |
RTEMS_INLINE_ROUTINE void | rtems_termios_device_lock_acquire (rtems_termios_device_context *context, rtems_interrupt_lock_context *lock_context) |
Acquires the device lock. More... | |
RTEMS_INLINE_ROUTINE 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_mutex | rtems_termios_ttyMutex |
RTEMS termios device support internal data structures
#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. |
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. |
RTEMS_INLINE_ROUTINE void rtems_termios_device_context_initialize | ( | rtems_termios_device_context * | context, |
const char * | name | ||
) |
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. |
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. |
RTEMS_INLINE_ROUTINE void rtems_termios_device_lock_acquire | ( | rtems_termios_device_context * | context, |
rtems_interrupt_lock_context * | lock_context | ||
) |
Acquires the device lock.
[in] | context | The device context. |
[in] | lock_context | The local interrupt lock context for an acquire and release pair. |
RTEMS_INLINE_ROUTINE void rtems_termios_device_lock_release | ( | rtems_termios_device_context * | context, |
rtems_interrupt_lock_context * | lock_context | ||
) |
Releases the device lock.
[in] | context | The device context. |
[in] | lock_context | The local interrupt lock context for an acquire and release pair. |
RTEMS_INLINE_ROUTINE void* rtems_termios_get_device_context | ( | const rtems_termios_tty * | tty | ) |
Returns the device context of an installed Termios device.
[in] | tty | The Termios control. |
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. |