diff options
author | Tom Rini <trini@konsulko.com> | 2024-06-16 09:10:13 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-06-16 09:10:13 -0600 |
commit | e242cd95130b64cf91692da41363ac59b25fc08d (patch) | |
tree | b3b167faa221aff7adf419741acbc0c1e39833a6 /doc/develop | |
parent | d8c213c9c7f827a9de0096bb4e5247c9a07bb248 (diff) | |
parent | 85c476759a42dfedb2d66e9734f8c05b7cfb62d5 (diff) |
Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-watchdog into next
- misc cyclic infrastructure improvements (Rasmus)
- watchdog_reset cleanup (Rasmus)
CI: https://dev.azure.com/sr0718/u-boot/_build/results?buildId=369&view=results
Diffstat (limited to 'doc/develop')
-rw-r--r-- | doc/develop/cyclic.rst | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/doc/develop/cyclic.rst b/doc/develop/cyclic.rst index 67831496a70..893c269099a 100644 --- a/doc/develop/cyclic.rst +++ b/doc/develop/cyclic.rst @@ -19,20 +19,26 @@ Registering a cyclic function To register a cyclic function, use something like this:: - static void cyclic_demo(void *ctx) + struct donkey { + struct cyclic_info cyclic; + void (*say)(const char *s); + }; + + static void cyclic_demo(struct cyclic_info *c) { - /* Just a small dummy delay here */ - udelay(10); + struct donkey *donkey = container_of(c, struct donkey, cyclic); + + donkey->say("Are we there yet?"); } - - int board_init(void) + + int donkey_init(void) { - struct cyclic_info *cyclic; - + struct donkey *donkey; + + /* Initialize donkey ... */ + /* Register demo cyclic function */ - cyclic = cyclic_register(cyclic_demo, 10 * 1000, "cyclic_demo", NULL); - if (!cyclic) - printf("Registering of cyclic_demo failed\n"); + cyclic_register(&donkey->cyclic, cyclic_demo, 10 * 1000, "cyclic_demo"); return 0; } |