Re-indent and style up serial ftdi

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2015-08-21 00:19:43 +02:00 committed by Dirk Hohndel
parent f33843ed35
commit 3104508247

View file

@ -69,8 +69,7 @@ struct serial_t {
}; };
// Used internally for opening ftdi devices // Used internally for opening ftdi devices
int int open_ftdi_device (struct ftdi_context *ftdi_ctx)
open_ftdi_device (struct ftdi_context *ftdi_ctx)
{ {
int accepted_pids[] = { 0x6001, 0x6010, 0x6011, // Suunto (Smart Interface), Heinrichs Weikamp int accepted_pids[] = { 0x6001, 0x6010, 0x6011, // Suunto (Smart Interface), Heinrichs Weikamp
0xF460, // Oceanic 0xF460, // Oceanic
@ -91,8 +90,7 @@ open_ftdi_device (struct ftdi_context *ftdi_ctx)
return ret; return ret;
} }
int int serial_enumerate (serial_callback_t callback, void *userdata)
serial_enumerate (serial_callback_t callback, void *userdata)
{ {
// Unimplemented. // Unimplemented.
return -1; return -1;
@ -103,9 +101,7 @@ serial_enumerate (serial_callback_t callback, void *userdata)
// Open the serial port. // Open the serial port.
// Initialise ftdi_context and use it to open the device // Initialise ftdi_context and use it to open the device
// //
int serial_open (serial_t **out, dc_context_t *context, const char* name)
int
serial_open (serial_t **out, dc_context_t *context, const char* name)
{ {
if (out == NULL) if (out == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -168,9 +164,7 @@ serial_open (serial_t **out, dc_context_t *context, const char* name)
// //
// Close the serial port. // Close the serial port.
// //
int serial_close (serial_t *device)
int
serial_close (serial_t *device)
{ {
if (device == NULL) if (device == NULL)
return 0; return 0;
@ -196,9 +190,7 @@ serial_close (serial_t *device)
// //
// Configure the serial port (baudrate, databits, parity, stopbits and flowcontrol). // Configure the serial port (baudrate, databits, parity, stopbits and flowcontrol).
// //
int serial_configure (serial_t *device, int baudrate, int databits, int parity, int stopbits, int flowcontrol)
int
serial_configure (serial_t *device, int baudrate, int databits, int parity, int stopbits, int flowcontrol)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -294,9 +286,7 @@ serial_configure (serial_t *device, int baudrate, int databits, int parity, int
// //
// Configure the serial port (timeouts). // Configure the serial port (timeouts).
// //
int serial_set_timeout (serial_t *device, long timeout)
int
serial_set_timeout (serial_t *device, long timeout)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -312,9 +302,7 @@ serial_set_timeout (serial_t *device, long timeout)
// //
// Configure the serial port (recommended size of the input/output buffers). // Configure the serial port (recommended size of the input/output buffers).
// //
int serial_set_queue_size (serial_t *device, unsigned int input, unsigned int output)
int
serial_set_queue_size (serial_t *device, unsigned int input, unsigned int output)
{ {
if (device == NULL) if (device == NULL)
return -1; // ERROR_INVALID_PARAMETER (The parameter is incorrect) return -1; // ERROR_INVALID_PARAMETER (The parameter is incorrect)
@ -325,9 +313,7 @@ serial_set_queue_size (serial_t *device, unsigned int input, unsigned int output
return 0; return 0;
} }
int serial_set_halfduplex (serial_t *device, int value)
int
serial_set_halfduplex (serial_t *device, int value)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -340,8 +326,7 @@ serial_set_halfduplex (serial_t *device, int value)
return 0; return 0;
} }
int int serial_set_latency (serial_t *device, unsigned int milliseconds)
serial_set_latency (serial_t *device, unsigned int milliseconds)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -356,8 +341,7 @@ serial_set_latency (serial_t *device, unsigned int milliseconds)
return 0; return 0;
} }
int int serial_read (serial_t *device, void *data, unsigned int size)
serial_read (serial_t *device, void *data, unsigned int size)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -425,9 +409,7 @@ serial_read (serial_t *device, void *data, unsigned int size)
return nbytes; return nbytes;
} }
int serial_write (serial_t *device, const void *data, unsigned int size)
int
serial_write (serial_t *device, const void *data, unsigned int size)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -489,9 +471,7 @@ serial_write (serial_t *device, const void *data, unsigned int size)
return nbytes; return nbytes;
} }
int serial_flush (serial_t *device, int queue)
int
serial_flush (serial_t *device, int queue)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -524,9 +504,7 @@ serial_flush (serial_t *device, int queue)
return 0; return 0;
} }
int serial_send_break (serial_t *device)
int
serial_send_break (serial_t *device)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument)a return -1; // EINVAL (Invalid argument)a
@ -541,9 +519,7 @@ serial_send_break (serial_t *device)
return -1; return -1;
} }
int serial_set_break (serial_t *device, int level)
int
serial_set_break (serial_t *device, int level)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -555,9 +531,7 @@ serial_set_break (serial_t *device, int level)
return -1; return -1;
} }
int serial_set_dtr (serial_t *device, int level)
int
serial_set_dtr (serial_t *device, int level)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -572,9 +546,7 @@ serial_set_dtr (serial_t *device, int level)
return 0; return 0;
} }
int serial_set_rts (serial_t *device, int level)
int
serial_set_rts (serial_t *device, int level)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -589,9 +561,7 @@ serial_set_rts (serial_t *device, int level)
return 0; return 0;
} }
int serial_get_received (serial_t *device)
int
serial_get_received (serial_t *device)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -605,9 +575,7 @@ serial_get_received (serial_t *device)
return bytes; return bytes;
} }
int serial_get_transmitted (serial_t *device)
int
serial_get_transmitted (serial_t *device)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -616,9 +584,7 @@ serial_get_transmitted (serial_t *device)
return -1; return -1;
} }
int serial_get_line (serial_t *device, int line)
int
serial_get_line (serial_t *device, int line)
{ {
if (device == NULL) if (device == NULL)
return -1; // EINVAL (Invalid argument) return -1; // EINVAL (Invalid argument)
@ -646,9 +612,7 @@ serial_get_line (serial_t *device, int line)
return 0; return 0;
} }
int serial_sleep (serial_t *device, unsigned long timeout)
int
serial_sleep (serial_t *device, unsigned long timeout)
{ {
if (device == NULL) if (device == NULL)
return -1; return -1;