summaryrefslogtreecommitdiff
path: root/include/asm-generic
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2022-09-02 13:57:48 +0200
committerTom Rini <trini@konsulko.com>2022-09-13 16:01:43 -0400
commitc2c6971888784cac01e625ef7f436d20e5fb23ba (patch)
treecf8309c0c5e5f246acc64c49278490d2575facca /include/asm-generic
parente29178eda1ed5fe3b3796af12ce0b8d0a0337992 (diff)
downloadu-boot-c2c6971888784cac01e625ef7f436d20e5fb23ba.tar.gz
u-boot-c2c6971888784cac01e625ef7f436d20e5fb23ba.tar.bz2
u-boot-c2c6971888784cac01e625ef7f436d20e5fb23ba.zip
cyclic: Add basic support for cyclic function execution infrastruture
Add the basic infrastructure to periodically execute code, e.g. all 100ms. Examples for such functions might be LED blinking etc. The functions that are hooked into this cyclic list should be small timewise as otherwise the execution of the other code that relies on a high frequent polling (e.g. UART rx char ready check) might be delayed too much. This patch also adds the Kconfig option CONFIG_CYCLIC_MAX_CPU_TIME_US, which configures the max allowed time for such a cyclic function. If it's execution time exceeds this time, this cyclic function will get removed from the cyclic list. How is this cyclic functionality executed? The following patch integrates the main function responsible for calling all registered cyclic functions cyclic_run() into the common WATCHDOG_RESET macro. This guarantees that cyclic_run() is executed very often, which is necessary for the cyclic functions to get scheduled and executed at their configured periods. This cyclic infrastructure will be used by a board specific function on the NIC23 MIPS Octeon board, which needs to check periodically, if a PCIe FLR has occurred. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/global_data.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 805a6fd679..9006c76927 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -20,6 +20,7 @@
*/
#ifndef __ASSEMBLY__
+#include <cyclic.h>
#include <event_internal.h>
#include <fdtdec.h>
#include <membuff.h>
@@ -474,6 +475,12 @@ struct global_data {
*/
struct event_state event_state;
#endif
+#ifdef CONFIG_CYCLIC
+ /**
+ * @cyclic: cyclic driver data
+ */
+ struct cyclic_drv *cyclic;
+#endif
/**
* @dmtag_list: List of DM tags
*/