Permalink
Browse files

Update Commit

- minor bugfix...
- clean-up code...
  • Loading branch information...
1 parent 3c6349a commit 17b77a3d4aa07aac89c30500573a65380d721b19 @azman committed Feb 29, 2012
Showing with 14 additions and 9 deletions.
  1. +1 −1 makefile
  2. +11 −3 src/my1comlib.c
  3. +1 −0 src/my1comlib.h
  4. +1 −5 src/my1termu.c
View
@@ -20,7 +20,7 @@ ifeq ($(DO_MINGW),YES)
ifeq ($(DO_WIN32),yes)
DELETE = del
else
- XTOOL_DIR ?= /home/ftp/software/mingw-tool
+ XTOOL_DIR ?= /home/share/tool/mingw
XTOOL_TARGET = $(XTOOL_DIR)
CROSS_COMPILE = $(XTOOL_TARGET)/bin/i686-pc-mingw32-
TARGET_ARCH =
View
@@ -13,7 +13,8 @@
#define COM_PORT_NAME "/dev/ttyS"
#define USLEEP_FOR_FLUSH 200000
#define MASK_LFLAG (ICANON|ECHO|ECHOE|ISIG)
-#define OPEN_DFLAG (O_RDWR|O_NOCTTY|O_NDELAY|O_NONBLOCK)
+//#define OPEN_DFLAG (O_RDWR|O_NOCTTY|O_NDELAY|O_NONBLOCK)
+#define OPEN_DFLAG (O_RDWR|O_NOCTTY)
#define INVALID_HANDLE_VALUE -1
#endif
//------------------------------------------------------------------------------
@@ -459,7 +460,8 @@ void purge_serial(ASerialPort_t* aPort)
PurgeComm(aPort->mHandle,PURGE_RXCLEAR); // clear the input buffer
#else
usleep(USLEEP_FOR_FLUSH);
- tcflush(aPort->mHandle,TCOFLUSH);
+ tcflush(aPort->mHandle,TCIFLUSH);
+ //ioctl(aPort->mHandle,TCFLSH,TCIFLUSH);
#endif
}
//------------------------------------------------------------------------------
@@ -471,10 +473,16 @@ void flush_serial(ASerialPort_t* aPort)
FlushFileBuffers(aPort->mHandle); // flush the transmit buffer
#else
usleep(USLEEP_FOR_FLUSH);
- tcflush(aPort->mHandle,TCIFLUSH);
+ tcflush(aPort->mHandle,TCOFLUSH);
+ //ioctl(aPort->mHandle,TCFLSH,TCOFLUSH);
#endif
}
//------------------------------------------------------------------------------
+void wait_outgoing(ASerialPort_t* aPort)
+{
+ tcdrain(aPort->mHandle);
+}
+//------------------------------------------------------------------------------
int check_incoming(ASerialPort_t* aPort)
{
#ifdef DO_MINGW
View
@@ -51,6 +51,7 @@ void put_byte_serial(ASerialPort_t* aPort, byte_t aData);
byte_t get_byte_serial(ASerialPort_t* aPort);
void purge_serial(ASerialPort_t* aPort);
void flush_serial(ASerialPort_t* aPort);
+void wait_outgoing(ASerialPort_t* aPort);
int check_incoming(ASerialPort_t* aPort);
//------------------------------------------------------------------------------
#endif
View
@@ -45,11 +45,7 @@ void scanlist(ASerialPort_t* aPort)
{
if(check_serial(aPort,test))
{
-#ifndef DO_MINGW
- printf("%s%d: ",aPort->mPortName,test-1);
-#else
printf("%s%d: ",aPort->mPortName,test);
-#endif
cCount++;
printf("Ready.\n");
}
@@ -92,7 +88,7 @@ int main(int argc, char* argv[])
ASerialPort_t cPort;
my1key_t key;
termopts_t options = 0x0;
- int terminal = 0, test, loop, mask, drag;
+ int terminal = 1, test, loop, mask, drag;
char filename[FILENAME_LEN], *ptty;
FILE* pfile;

0 comments on commit 17b77a3

Please sign in to comment.