[PATCH v6 0/8] Add support for cyclic function execution infrastruture
Stefan Roese
sr at denx.de
Fri Sep 2 13:57:46 CEST 2022
This patchset adds 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?
This patchset 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.
Ideas how to continue:
One idea is to rename WATCHDOG_RESET to something like SCHEDULE and
move the watchdog_reset call into this cyclic infrastructure as well.
Or to perhaps move the shell UART RX ready polling to a cyclic
function.
It's also possible to extend the "cyclic" command, to support the
creation of periodically executed shell commands (for testing etc).
Here the Azure build, without any issues:
https://dev.azure.com/sr0718/u-boot/_build/results?buildId=256&view=results
Aaron Williams (1):
mips: octeon_nic23: Add PCIe FLR fixup via cyclic infrastructure
Stefan Roese (7):
time: Import time_after64() and friends from Linux
cyclic: Add basic support for cyclic function execution infrastruture
cyclic: Integrate cyclic infrastructure into WATCHDOG_RESET
cyclic: Integrate cyclic functionality at bootup in board_r/f
cyclic: Add 'cyclic list' and 'cyclic demo' commands
cyclic: Add documentation
cyclic: Add a simple test
MAINTAINERS | 7 +
board/Marvell/octeon_nic23/board.c | 197 +++++++++++++++++++++++++++++
cmd/Kconfig | 16 +++
cmd/Makefile | 1 +
cmd/cyclic.c | 84 ++++++++++++
common/Kconfig | 20 +++
common/Makefile | 1 +
common/board_f.c | 2 +
common/board_r.c | 2 +
common/cyclic.c | 123 ++++++++++++++++++
configs/octeon_nic23_defconfig | 3 +
doc/develop/cyclic.rst | 50 ++++++++
doc/develop/index.rst | 1 +
doc/usage/cmd/cyclic.rst | 45 +++++++
doc/usage/index.rst | 1 +
fs/cramfs/uncompress.c | 2 +-
include/asm-generic/global_data.h | 7 +
include/cyclic.h | 138 ++++++++++++++++++++
include/time.h | 19 +++
include/watchdog.h | 23 +++-
test/common/Makefile | 1 +
test/common/cyclic.c | 35 +++++
test/test-main.c | 3 +
23 files changed, 777 insertions(+), 4 deletions(-)
create mode 100644 cmd/cyclic.c
create mode 100644 common/cyclic.c
create mode 100644 doc/develop/cyclic.rst
create mode 100644 doc/usage/cmd/cyclic.rst
create mode 100644 include/cyclic.h
create mode 100644 test/common/cyclic.c
--
2.37.3
More information about the U-Boot
mailing list