Added a function to configure the size of the input and output buffers.

This commit is contained in:
Jef Driesen 2007-11-27 15:09:38 +00:00
parent 295c95ac03
commit 40835b8d80
3 changed files with 32 additions and 0 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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)