Fix drain at ser_close()
authoraleph <aleph@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 21 Jan 2005 20:13:15 +0000 (20:13 +0000)
committeraleph <aleph@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 21 Jan 2005 20:13:15 +0000 (20:13 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@343 38d2e660-2303-0410-9eaa-f027e97ec537

drv/ser.c

index 268e739b73a1ab90067e34eacf05ddc5e7e0f9a1..dbde1aa0f63eafbe7d48d0a8329ef5d73734845d 100755 (executable)
--- a/drv/ser.c
+++ b/drv/ser.c
@@ -28,6 +28,9 @@
 
 /*#*
  *#* $Log$
+ *#* Revision 1.24  2005/01/21 20:13:15  aleph
+ *#* Fix drain at ser_close()
+ *#*
  *#* Revision 1.23  2005/01/14 00:47:07  aleph
  *#* ser_drain(): Wait for hw transmission complete.
  *#*
@@ -507,8 +510,13 @@ void ser_close(struct Serial *port)
 
        // Wait until we finish sending everything
        ser_drain(port);
-       ser_purge(port);
 
        port->hw->table->cleanup(port->hw);
        DB(port->hw = NULL;)
+
+       /*
+        * We purge the FIFO buffer only after the low-level cleanup, so that
+        * we are sure that there are no more interrupts.
+        */
+       ser_purge(port);
 }