Remove some unnecessary helper functions.
This commit is contained in:
parent
2a72da59ad
commit
83f742080b
@ -108,8 +108,6 @@ int serial_get_line (serial_t *device, int line);
|
|||||||
|
|
||||||
int serial_sleep (unsigned long timeout /* milliseconds */);
|
int serial_sleep (unsigned long timeout /* milliseconds */);
|
||||||
|
|
||||||
int serial_timer (void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@ -675,12 +675,16 @@ serial_set_break (serial_t *device, int level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
int
|
||||||
serial_set_status (int fd, int value, int level)
|
serial_set_dtr (serial_t *device, int level)
|
||||||
{
|
{
|
||||||
|
if (device == NULL)
|
||||||
|
return -1; // EINVAL (Invalid argument)
|
||||||
|
|
||||||
unsigned long action = (level ? TIOCMBIS : TIOCMBIC);
|
unsigned long action = (level ? TIOCMBIS : TIOCMBIC);
|
||||||
|
|
||||||
if (ioctl (fd, action, &value) != 0) {
|
int value = TIOCM_DTR;
|
||||||
|
if (ioctl (device->fd, action, &value) != 0) {
|
||||||
TRACE ("ioctl");
|
TRACE ("ioctl");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -689,23 +693,21 @@ serial_set_status (int fd, int value, int level)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
serial_set_dtr (serial_t *device, int level)
|
|
||||||
{
|
|
||||||
if (device == NULL)
|
|
||||||
return -1; // EINVAL (Invalid argument)
|
|
||||||
|
|
||||||
return serial_set_status (device->fd, TIOCM_DTR, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
serial_set_rts (serial_t *device, int level)
|
serial_set_rts (serial_t *device, int level)
|
||||||
{
|
{
|
||||||
if (device == NULL)
|
if (device == NULL)
|
||||||
return -1; // EINVAL (Invalid argument)
|
return -1; // EINVAL (Invalid argument)
|
||||||
|
|
||||||
return serial_set_status (device->fd, TIOCM_RTS, level);
|
unsigned long action = (level ? TIOCMBIS : TIOCMBIC);
|
||||||
|
|
||||||
|
int value = TIOCM_RTS;
|
||||||
|
if (ioctl (device->fd, action, &value) != 0) {
|
||||||
|
TRACE ("ioctl");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -786,16 +788,3 @@ serial_sleep (unsigned long timeout)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
serial_timer (void)
|
|
||||||
{
|
|
||||||
struct timeval tv;
|
|
||||||
if (gettimeofday (&tv, NULL) != 0) {
|
|
||||||
TRACE ("gettimeofday");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -607,10 +607,3 @@ serial_sleep (unsigned long timeout)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
serial_timer (void)
|
|
||||||
{
|
|
||||||
return GetTickCount ();
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user