RTEMS CPU Kit with SuperCore  4.11.3
Macros | Functions | Variables
termios.c File Reference

TERMIOS serial line support. More...

#include <rtems.h>
#include <rtems/libio.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include <sys/ttycom.h>
#include <rtems/termiostypes.h>
Include dependency graph for termios.c:

Macros

#define CBUFSIZE   (rtems_termios_cbufsize)
 
#define RAW_INPUT_BUFFER_SIZE   (rtems_termios_raw_input_size)
 
#define RAW_OUTPUT_BUFFER_SIZE   (rtems_termios_raw_output_size)
 
#define FL_IREQXOF   1U /* input queue requests stop of incoming data */
 
#define FL_ISNTXOF   2U /* XOFF has been sent to other side of line */
 
#define FL_IRTSOFF   4U /* RTS has been turned off for other side.. */
 
#define FL_ORCVXOF   0x10U /* XOFF has been received */
 
#define FL_OSTOP   0x20U /* output has been stopped due to XOFF */
 
#define FL_MDRTS   0x100U /* input controlled with RTS/CTS handshake */
 
#define FL_MDXON   0x200U /* input controlled with XON/XOFF protocol */
 
#define FL_MDXOF   0x400U /* output controlled with XON/XOFF protocol */
 
#define NODISC(n)
 
#define TERMIOS_TXTASK_PRIO   10
 
#define TERMIOS_RXTASK_PRIO   9
 
#define TERMIOS_TXTASK_STACKSIZE   1024
 
#define TERMIOS_RXTASK_STACKSIZE   1024
 
#define TERMIOS_TX_START_EVENT   RTEMS_EVENT_1
 
#define TERMIOS_TX_TERMINATE_EVENT   RTEMS_EVENT_0
 
#define TERMIOS_RX_PROC_EVENT   RTEMS_EVENT_1
 
#define TERMIOS_RX_TERMINATE_EVENT   RTEMS_EVENT_0
 

Functions

rtems_status_code rtems_termios_device_install (const char *device_file, rtems_device_major_number major, rtems_device_minor_number minor, const rtems_termios_device_handler *handler, const rtems_termios_device_flow *flow, rtems_termios_device_context *context)
 Installs a Termios device. More...
 
rtems_status_code rtems_termios_device_remove (const char *device_file, rtems_device_major_number major, rtems_device_minor_number minor)
 Removes a Termios device. More...
 
rtems_status_code rtems_termios_device_open (rtems_device_major_number major, rtems_device_minor_number minor, void *arg)
 Opens an installed Termios device. More...
 
rtems_status_code rtems_termios_open (rtems_device_major_number major, rtems_device_minor_number minor, void *arg, const rtems_termios_callbacks *callbacks)
 
rtems_status_code rtems_termios_close (void *arg)
 
rtems_status_code rtems_termios_device_close (void *arg)
 Closes an installed Termios device. More...
 
rtems_status_code rtems_termios_bufsize (size_t cbufsize, size_t raw_input, size_t raw_output)
 
rtems_status_code rtems_termios_ioctl (void *arg)
 
void rtems_termios_puts (const void *_buf, size_t len, struct rtems_termios_tty *tty)
 
rtems_status_code rtems_termios_write (void *arg)
 
rtems_status_code rtems_termios_read (void *arg)
 
void rtems_termios_rxirq_occured (struct rtems_termios_tty *tty)
 
int rtems_termios_enqueue_raw_characters (void *ttyp, const char *buf, int len)
 
int rtems_termios_dequeue_characters (void *ttyp, int len)
 

Variables

struct rtems_termios_linesw rtems_termios_linesw [MAXLDISC]
 
int rtems_termios_nlinesw
 
rtems_id rtems_termios_ttyMutex
 

Detailed Description

TERMIOS serial line support.

Macro Definition Documentation

◆ NODISC

#define NODISC (   n)
Value:
{ NULL, NULL, NULL, NULL, \
NULL, NULL, NULL, NULL }

Function Documentation

◆ rtems_termios_device_close()

rtems_status_code rtems_termios_device_close ( void *  arg)

Closes an installed Termios device.

Return values
RTEMS_SUCCESSFULSuccessful operation.
See also
rtems_termios_device_install().

References rtems_fatal_error_occurred(), RTEMS_NO_TIMEOUT, rtems_semaphore_obtain(), RTEMS_SUCCESSFUL, and RTEMS_WAIT.

◆ rtems_termios_device_install()

rtems_status_code rtems_termios_device_install ( const char *  device_file,
rtems_device_major_number  major,
rtems_device_minor_number  minor,
const rtems_termios_device_handler handler,
const rtems_termios_device_flow flow,
rtems_termios_device_context context 
)

Installs a Termios device.

Parameters
[in]device_fileIf not NULL, then a device file for the specified major and minor number will be created.
[in]majorThe device major number of the corresponding device driver.
[in]minorThe device minor number of the corresponding device driver.
[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_RESOURCE_IN_USEThere exists a device node for this major and minor number pair.
RTEMS_INCORRECT_STATETermios is not initialized.
See also
rtems_termios_device_remove(), rtems_termios_device_open(), rtems_termios_device_close() and rtems_termios_get_device_context().

◆ rtems_termios_device_open()

rtems_status_code rtems_termios_device_open ( rtems_device_major_number  major,
rtems_device_minor_number  minor,
void *  arg 
)

◆ rtems_termios_device_remove()

rtems_status_code rtems_termios_device_remove ( const char *  device_file,
rtems_device_major_number  major,
rtems_device_minor_number  minor 
)

Removes a Termios device.

Parameters
[in]device_fileIf not NULL, then the device file to remove.
[in]majorThe device major number of the corresponding device driver.
[in]minorThe device minor number of the corresponding device driver.
Return values
RTEMS_SUCCESSFULSuccessful operation.
RTEMS_INVALID_IDThere is no device installed with this major and minor number pair.
RTEMS_RESOURCE_IN_USEThis device is currently in use.
RTEMS_UNSATISFIEDRemoval of the device file failed.
RTEMS_INCORRECT_STATETermios is not initialized.
See also
rtems_termios_device_install().

References rtems_termios_tty::device_node, RTEMS_INCORRECT_STATE, RTEMS_NO_TIMEOUT, rtems_semaphore_obtain(), RTEMS_SUCCESSFUL, and RTEMS_WAIT.

Variable Documentation

◆ rtems_termios_linesw

Initial value:
=
{
NODISC(0),
NODISC(1),
NODISC(2),
NODISC(3),
NODISC(4),
NODISC(5),
NODISC(6),
NODISC(7),
}

◆ rtems_termios_nlinesw

int rtems_termios_nlinesw
Initial value:
=
Definition: termiostypes.h:476