/*
Copyright (C) Magna Carta Software, Inc. 1990, 1991. All Rights Reserved.
C COMMUNICATIONSTOOLKIT
RS-232.C -- RS-232C CONTROL ROUTINES.
*/
#define CCT_DEVELOPMENT
#include <cctdef.h>
#include <ccttype.h>
short get_cts(COMM_PORT *p)
{
return((*p->get)(p, CTS));
}
short get_dcd(COMM_PORT *p)
{
return((*p->get)(p, DCD));
}
short get_dsr(COMM_PORT *p)
{
return((*p->get)(p, DSR));
}
short get_dtr(COMM_PORT *p)
{
return((*p->get)(p, DTR));
}
short get_ri(COMM_PORT *p)
{
return((*p->get)(p, RI));
}
short get_rts(COMM_PORT *p)
{
return((*p->get)(p, RTS));
}
void send_break(COMM_PORT *p, WORD duration)
{
(*p->set)(p, BREAK, duration);
}
/*
SET_DTR -- Set the Data Terminal Ready line of the RS-232 connection to the
designated value.
Return values:
Success: The value of the UART register that sets DTR;
-1 : Invalid UART type;
-2 : Invalid value for DTR specified (must be HIGH or LOW);
*/
void set_dtr(COMM_PORT *p, short value)
{
p->dtr = value;
(*p->set)(p, DTR, value);
}
/*
SET_RTS -- Set the Ready to Send line of the RS-232 connection to the
designated value. The type of UART is obtained from the COMM_PORT
structure.
Return values:
Success: The value of the UART register that sets RTS;
-1 : Invalid UART type;
-2 : Invalid value for RTS specified (must be HIGH or LOW);
*/
void set_rts(COMM_PORT *p, short value)
{
p->rts = value;
(*p->set)(p, RTS, value);
}