tto()

This function is defined in tto.c. The prototype is:

int tto( TTYDEV *ttydev,
         int action,
         int arg1 )

This function takes data from io-char's output buffer and gives it to the hardware. It also deals with stty commands, by calling ser_stty(), and provides line control and line status information.

The arguments are:

ttydev
A pointer to the driver's TTYDEV structure.
action
One of:
  • TTO_STTY — an stty command was received. It's called by io-char when the stty command is performed on the device. This action calls ser_stty(); the argument is ignored.
  • TTO_CTRL — set the characteristics of the port i.e. control RS-232 modem lines.
    • arg1 _SERCTL_BRK_CHG — called by io-char when the application requests a break such as tcsendbreak() be sent
    • arg1 _SERCTL_DTR_CHG — changes the DTR line
    • arg1 _SERCTL_RTS_CHG — changes the RTS line; io-char calls this to assert hardware flow control when the input buffer is filling up (based on the high-water level)
  • TTO_LINESTATUS — a request for line status. Returns the status of the Modem Status and Modem Control registers when the user performs a devctl() with DCMD_CHR_LINESTATUS; the argument is ignored.
  • TTO_DATA — used if tto() is called directly from the interrupt handler to transmit data or when io-char's write handler calls down to initiate a transfer.
  • TTO_EVENT — used to call into the tto() at thread time to transmit data. The interrupt handler can return this event rather than calling tto() directly.
arg1
A data value which has different meanings for different actions. It's used to pass flags that modify the action.