summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2013-12-22 18:53:38 -0500
committerSolomon Peachy <pizza@shaftnet.org>2013-12-22 18:53:38 -0500
commit46a3d1fa6a7cccc335a3ae5fe1a61d6560c0e36b (patch)
treeed5ead7a46df3e0a092e81f0c9437ffc30b88c5b
parent3e99235a043d5f94dd95e157ffd7c1d30eb63ee4 (diff)
downloadlinuxaldl-46a3d1fa6a7cccc335a3ae5fe1a61d6560c0e36b.tar.gz
linuxaldl-46a3d1fa6a7cccc335a3ae5fe1a61d6560c0e36b.tar.bz2
linuxaldl-46a3d1fa6a7cccc335a3ae5fe1a61d6560c0e36b.zip
Get rid of duplicate function definitions.
-rw-r--r--src/sts_serial.c93
1 files changed, 1 insertions, 92 deletions
diff --git a/src/sts_serial.c b/src/sts_serial.c
index 579ca34..caf65ca 100644
--- a/src/sts_serial.c
+++ b/src/sts_serial.c
@@ -39,95 +39,9 @@ LICENSING INFORMATION:
char sts_serial_read_seq_timeout = 0; // timeout flag for read_sequence()
-// serial helper function prototypes
-// ====================================================
-
-int serial_connect(const char* portpath, int flags, speed_t baudrate);
-// attempts to connect to a serial device at portpath (i.e. "/dev/ttyUSB0")
-// sets raw mode and sets the baud rate to baudrate. (see `man termios`)
-// returns the file descriptor for the connection, or -1 if an error occurs.
-// the flags field is the same as the flags for a call to read()
-
-
-int set_custom_baud_rate(int fport, unsigned int desired_baudrate);
-// Attempts to set the baud rate to the closest rate possible to
-// the desired_baudrate argument using divisors.
-// fport is the file descriptor for the port opened by a call to serial_connect() or open()
-// Divisor method:
-// it should be possible to do custom baud rates by using a divisor, like
-// you would do when you call "setserial /dev/ttyS0 baud_base 115200 divisor 14 spd_cust"
-// If the call to setserial wouldn't work for the device, the divisor method wont work here either.
-// This is usually due to an unimplemented ioctl function in the device driver.
-// Termios custom baud rate method:
-// I think tty_ioctl.c has to be compiled into the kernel with BOTHER defined for this to work.
-// set cbaud to BOTHER and c_ospeed to the desired setting.
-// This is done through a call to set_custom_baud_rate_no_ioctl()
-
-
-
-int set_custom_baud_rate_no_ioctl(int fport, unsigned int desired_baudrate);
-// XXX this is an untested function (my architecture doesn't have BOTHER defined)
-// Termios custom baud rate method:
-// tty_ioctl.c has to be compiled into the kernel with BOTHER defined for this to work.
-// This is called through set_custom_baud_rate() if a call to ioctl() fails
-// ... assuming BOTHER is defined.
-
-
-
-int readwithtimeout(int fd, void *buf, size_t count, int secs);
-// readwithtimeout - read from a file descriptor with timeout
-// description:
-// mimics read() but with a timeout that resets whenever a byte is received.
-// attempts to read up to count bytes from file descriptor fd into
-// the buffer starting at buf. continues to read bytes until count bytes
-// have been read or no data has been received for secs seconds.
-// return value:
-// on success, the number of bytes read is returned, and the file
-// position is advanced by this number. it is not an error if this
-// number is smaller than the number of bytes requested; this
-// may happen for example because fewer bytes are actually available
-// right now. on an error, -1 is returned and errno is set appropriately.
-
-
-
-void read_sequence_timeout(int signalno);
-//read_sequence_timeout()
-// handles the SIGALRM signal
-
-
-int read_sequence(int fd, void *buf, size_t count, char *seq, size_t seq_size, long secs, long usecs);
-// read_sequence is used to wait for a specific byte/character, ignoring other sequences
-// that arrive on the device. it stops when a timeout occurs or the buffer is filled.
-// detailed behavior:
-// waits for the first sequence starting with the characters in seq, or times
-// out if secs seconds + msecs microseconds pass before seq is matched.
-// returns 0 if timeout or sequence never matched, -1 on read failure,
-// and otherwise returns the total number of bytes written into buf.
-// all bytes up to the first byte of the start sequence are discarded/ignored
-// from the device. the start sequence is copied into buf along with the
-// following bytes up to count total bytes or the timeout occurs.
-// count must be >= seq_size so the sequence can fit in the buffer.
-
-unsigned int convert_baudrate(speed_t baudrate);
-// returns the speed_t baudrate defined in <termios.h> in unsigned integer format
-// e.g. convert_baudrate(B57600) returns 57600
-
-void fprinthex(FILE *stream, char *seq, unsigned int len);
-// print hex sequence of len bytes from char array seq.
-// converts the numerical value of each byte in seq to a
-// hex character string and prints it to stream.
-// hexadecimal bytes are each seperated by spaces.
-// there is no trailing space.
-
-
-void char_to_hexstr(char val, char* buf, unsigned int len);
-void int_to_hexstr(int val, char* buf, unsigned int len);
-
-
-// serial communication helper function definitions
+// serial communication helper functions
// ==========================================================================
-
// readwithtimeout - read from a file descriptor with timeout
// description:
// mimics read() but with a timeout that resets whenever a byte is received.
@@ -170,8 +84,6 @@ int readwithtimeout(int fd, void *buf, size_t count, int secs)
return bytesread;
}
-
-
//read_seq_timeout()
// handles the SIGALRM signal
void read_sequence_timeout(int signalno)
@@ -181,9 +93,6 @@ void read_sequence_timeout(int signalno)
typedef void (*sighandler_t)(int);
-
-
-
// read_sequence is used to wait for a specific byte/character, ignoring other sequences
// that arrive on the device. it stops when a timeout occurs or the buffer is filled.
// detailed behavior: