X-Git-Url: https://rtime.felk.cvut.cz/gitweb/l4.git/blobdiff_plain/35719fdd2ff27177690edb32843d32e092a006e3..5658d2ec9c1081516a8868259fa867926e25ab3f:/l4/pkg/drivers-frst/uart/src/uart_pxa.cc diff --git a/l4/pkg/drivers-frst/uart/src/uart_pxa.cc b/l4/pkg/drivers-frst/uart/src/uart_pxa.cc index f147f1fe6..8dae9e384 100644 --- a/l4/pkg/drivers-frst/uart/src/uart_pxa.cc +++ b/l4/pkg/drivers-frst/uart/src/uart_pxa.cc @@ -16,8 +16,7 @@ * Please see the COPYING-GPL-2 file for details. */ #include "uart_pxa.h" - -#include +#include "poll_timeout_counter.h" namespace L4 { @@ -76,7 +75,8 @@ namespace L4 _regs->read(TRB); /* IRQID 2*/ _regs->read(LSR); /* IRQID 3*/ - while (_regs->read(LSR) & 1/*DATA READY*/) + Poll_timeout_counter i(5000000); + while (i.test(_regs->read(LSR) & 1/*DATA READY*/)) _regs->read(TRB); return true; @@ -141,14 +141,17 @@ namespace L4 _regs->write(IER, old_ier & ~0x0f); /* transmission */ + Poll_timeout_counter cnt(5000000); for (i = 0; i < count; i++) { - while (!(_regs->read(LSR) & 0x20 /* THRE */)) + cnt.set(5000000); + while (cnt.test(!(_regs->read(LSR) & 0x20 /* THRE */))) ; _regs->write(TRB, s[i]); } /* wait till everything is transmitted */ - while (!(_regs->read(LSR) & 0x40 /* TSRE */)) + cnt.set(5000000); + while (cnt.test(!(_regs->read(LSR) & 0x40 /* TSRE */))) ; _regs->write(IER, old_ier);