00001
00016
00017
00018 #ifndef SERIAL_H
00019 #define SERIAL_H
00020
00021 #include <stdio.h>
00022 #include <string.h>
00023 #include <unistd.h>
00024 #include <fcntl.h>
00025 #include <errno.h>
00026 #include <termios.h>
00027 #include <asm/ioctls.h>
00028
00029 #include "moxadevice.h"
00030
00031 #define PORT1 0
00032 #define PORT2 1
00033 #define PORT3 2
00034 #define PORT4 3
00035 #define PORT5 4
00036 #define PORT6 5
00037 #define PORT7 6
00038 #define PORT8 7
00039
00040 #define MAX_PORT_NUM 8
00041
00042 #define HW_FLOW_CONTROL 1
00043 #define SW_FLOW_CONTROL 2
00044
00045 #define SerialRead SerialBlockRead
00046
00047 #define SERIAL_OK 0
00048 #define SERIAL_ERROR_FD -1
00049 #define SERIAL_ERROR_OPEN -2
00050
00051 int SerialOpen( int port, int open_flag, struct termios *tio);
00052 int SerialWrite( int port, char* str, int len);
00053 int SerialNonBlockRead( int port, char* buf, int len);
00054 int SerialBlockRead( int port, char* buf, int len);
00055 int SerialClose( int port);
00056 int SerialDataInInputQueue( int port);
00057 int SerialFlowControl( int port, int control);
00058 int SerialSetSpeed( int port, unsigned int speed);
00059 int SerialSetMode( int port, unsigned int mode);
00060 int SerialSetParam( int port, int parity, int databits, int stopbit);
00061
00062 int FindFD( int port);
00063
00064 #endif