9
0
Fork 0
Commit Graph

2 Commits

Author SHA1 Message Date
Sascha Hauer 3c46c02c54 poller: Allow to call functions asynchronously
Sometimes execution of a function has to be delayed, for example
when a backlight can only be turned on when the picture has stabilized.
To help in such situations add a convenience function around the poller
stuff to call a function after a delay.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-12-18 16:47:48 +01:00
Marc Kleine-Budde 0277a663bc Add generic poll infrastructure
Barebox does not have interrupt functionality. Nevertheless it's
sometimes useful to periodically call functions, like for example
a heartbeat LED or watchdog reset. Instead of cluttering the code
with calls to these functions this patch adds a generic polling
infrastructure. Code which might run for longer now can call
poller_call() periodically which in turn will call all registered
pollers.
This patch adds a call to poller_call in two generic pathes. First
of them is getc() which covers waiting for uart input. Second is
ctrlc() which should be called anyway from code which might run
for longer. So instead adding poller_call directly to your code,
consider checking ctrlc instead which also gives additional
convenience to the user.
The poller code is safe against reentrancy which means that it's
safe to call poller_call inside a poller.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-20 09:28:21 +01:00