mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] poller_call: move from getc to is_timeout
@ 2011-12-13 15:21 Jean-Christophe PLAGNIOL-VILLARD
  2011-12-14 11:25 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-12-13 15:21 UTC (permalink / raw)
  To: barebox

this will allow to always call poller_call even durring timeout
and still the case in getc

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 common/clock.c   |    4 ++++
 common/console.c |    2 --
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/clock.c b/common/clock.c
index 79c06c8..6e92348 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -27,6 +27,7 @@
 #include <common.h>
 #include <asm-generic/div64.h>
 #include <clock.h>
+#include <poller.h>
 
 static struct clocksource *current_clock;
 static uint64_t time_ns;
@@ -139,6 +140,9 @@ uint32_t clocksource_hz2mult(uint32_t hz, uint32_t shift_constant)
 
 int is_timeout(uint64_t start_ns, uint64_t time_offset_ns)
 {
+	if (time_offset_ns > MSECOND)
+		poller_call();
+
 	if ((int64_t)(start_ns + time_offset_ns - get_time_ns()) < 0)
 		return 1;
 	else
diff --git a/common/console.c b/common/console.c
index cab8689..88c4010 100644
--- a/common/console.c
+++ b/common/console.c
@@ -225,8 +225,6 @@ int getc(void)
 	 */
 	start = get_time_ns();
 	while (1) {
-		poller_call();
-
 		if (tstc_raw()) {
 			kfifo_putc(console_input_buffer, getc_raw());
 
-- 
1.7.7


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] poller_call: move from getc to is_timeout
  2011-12-13 15:21 [PATCH 1/1] poller_call: move from getc to is_timeout Jean-Christophe PLAGNIOL-VILLARD
@ 2011-12-14 11:25 ` Sascha Hauer
  2011-12-14 15:07   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2011-12-14 11:25 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Tue, Dec 13, 2011 at 04:21:58PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> this will allow to always call poller_call even durring timeout
> and still the case in getc
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  common/clock.c   |    4 ++++
>  common/console.c |    2 --
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/common/clock.c b/common/clock.c
> index 79c06c8..6e92348 100644
> --- a/common/clock.c
> +++ b/common/clock.c
> @@ -27,6 +27,7 @@
>  #include <common.h>
>  #include <asm-generic/div64.h>
>  #include <clock.h>
> +#include <poller.h>
>  
>  static struct clocksource *current_clock;
>  static uint64_t time_ns;
> @@ -139,6 +140,9 @@ uint32_t clocksource_hz2mult(uint32_t hz, uint32_t shift_constant)
>  
>  int is_timeout(uint64_t start_ns, uint64_t time_offset_ns)
>  {
> +	if (time_offset_ns > MSECOND)
> +		poller_call();

Why this additional test? It effectively disables poller_call() being
called from getc() since getc calls is_timeout with 100us.

> +
>  	if ((int64_t)(start_ns + time_offset_ns - get_time_ns()) < 0)
>  		return 1;
>  	else
> diff --git a/common/console.c b/common/console.c
> index cab8689..88c4010 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -225,8 +225,6 @@ int getc(void)
>  	 */
>  	start = get_time_ns();
>  	while (1) {
> -		poller_call();
> -
>  		if (tstc_raw()) {
>  			kfifo_putc(console_input_buffer, getc_raw());
>  
> -- 
> 1.7.7
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] poller_call: move from getc to is_timeout
  2011-12-14 11:25 ` Sascha Hauer
@ 2011-12-14 15:07   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-12-14 15:07 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 12:25 Wed 14 Dec     , Sascha Hauer wrote:
> On Tue, Dec 13, 2011 at 04:21:58PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > this will allow to always call poller_call even durring timeout
> > and still the case in getc
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  common/clock.c   |    4 ++++
> >  common/console.c |    2 --
> >  2 files changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/common/clock.c b/common/clock.c
> > index 79c06c8..6e92348 100644
> > --- a/common/clock.c
> > +++ b/common/clock.c
> > @@ -27,6 +27,7 @@
> >  #include <common.h>
> >  #include <asm-generic/div64.h>
> >  #include <clock.h>
> > +#include <poller.h>
> >  
> >  static struct clocksource *current_clock;
> >  static uint64_t time_ns;
> > @@ -139,6 +140,9 @@ uint32_t clocksource_hz2mult(uint32_t hz, uint32_t shift_constant)
> >  
> >  int is_timeout(uint64_t start_ns, uint64_t time_offset_ns)
> >  {
> > +	if (time_offset_ns > MSECOND)
> > +		poller_call();
> 
> Why this additional test? It effectively disables poller_call() being
> called from getc() since getc calls is_timeout with 100us.
yeah I was wanting to put 100us as if the delay is really small let it

the idea is to not perturb a i2c bitbanging

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-14 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-13 15:21 [PATCH 1/1] poller_call: move from getc to is_timeout Jean-Christophe PLAGNIOL-VILLARD
2011-12-14 11:25 ` Sascha Hauer
2011-12-14 15:07   ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox