Added a function to configure the size of the input and output buffers.
This commit is contained in:
parent
295c95ac03
commit
40835b8d80
2
serial.h
2
serial.h
@ -58,6 +58,8 @@ int serial_configure (serial *device, int baudrate, int databits, int parity, in
|
||||
|
||||
int serial_set_timeout (serial *device, long timeout /* milliseconds */);
|
||||
|
||||
int serial_set_queue_size (serial *device, unsigned int input, unsigned int output);
|
||||
|
||||
int serial_read (serial *device, void* data, unsigned int size);
|
||||
int serial_write (serial *device, const void* data, unsigned int size);
|
||||
|
||||
|
||||
@ -323,6 +323,19 @@ serial_set_timeout (serial *device, long timeout)
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Configure the serial port (recommended size of the input/output buffers).
|
||||
//
|
||||
|
||||
int
|
||||
serial_set_queue_size (serial *device, unsigned int input, unsigned int output)
|
||||
{
|
||||
if (device == NULL)
|
||||
return -1; // ERROR_INVALID_PARAMETER (The parameter is incorrect)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct timeouts_t {
|
||||
int interval;
|
||||
int total;
|
||||
|
||||
@ -311,6 +311,23 @@ serial_set_timeout (serial* device, long timeout)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Configure the serial port (recommended size of the input/output buffers).
|
||||
//
|
||||
|
||||
int
|
||||
serial_set_queue_size (serial *device, unsigned int input, unsigned int output)
|
||||
{
|
||||
if (device == NULL)
|
||||
return -1; // ERROR_INVALID_PARAMETER (The parameter is incorrect)
|
||||
|
||||
if (!SetupComm (device->hFile, input, output)) {
|
||||
TRACE ("SetupComm");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
serial_read (serial* device, void* data, unsigned int size)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user