+ fifo_flush_locked(&ser->rxfifo);
+ fifo_flush_locked(&ser->txfifo);
+}
+
+/*!
+ * Wait until all pending output is completely
+ * transmitted to the other end.
+ *
+ * \note The current implementation only checks the
+ * software transmission queue. Any hardware
+ * FIFOs are ignored.
+ */
+void ser_drain(struct Serial *ser)
+{
+ while(!fifo_isempty(&ser->txfifo))
+ {
+#if defined(CONFIG_KERN_SCHED) && CONFIG_KERN_SCHED
+ /* Give up timeslice to other processes. */
+ proc_switch();
+#endif
+ }