Hi Stefan, On Fri, 5 Aug 2022 at 08:26, Stefan Roese <s...@denx.de> wrote: > > This patch enables the cyclic infrastructure on sandbox and also adds > one simple example/demo functions using this cyclic functionality. > > Signed-off-by: Stefan Roese <s...@denx.de> > --- > v3: > - No change > v2: > - Extend CONFIG_CYCLIC_MAX_CPU_TIME_US to 10000ms as running this > in CI might take a bit longer > > board/sandbox/sandbox.c | 15 +++++++++++++++ > configs/sandbox_defconfig | 3 +++ > 2 files changed, 18 insertions(+)
This should have a test in test/common - e.g. using timer_test_add_offset() > > diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c > index ca9a2ca5b17c..8dda4b5f4fc9 100644 > --- a/board/sandbox/sandbox.c > +++ b/board/sandbox/sandbox.c > @@ -7,6 +7,7 @@ > #include <addr_map.h> > #include <cpu_func.h> > #include <cros_ec.h> > +#include <cyclic.h> > #include <dm.h> > #include <efi.h> > #include <efi_loader.h> > @@ -17,6 +18,7 @@ > #include <asm/global_data.h> > #include <asm/test.h> > #include <asm/u-boot-sandbox.h> > +#include <linux/delay.h> > #include <linux/kernel.h> > #include <malloc.h> > > @@ -106,8 +108,21 @@ int dram_init(void) > return 0; > } > > +static void cyclic_demo(void *ctx) > +{ > + /* Just a small dummy delay here */ > + udelay(10); > +} > + > int board_init(void) > { > + struct cyclic_struct *cyclic; > + > + /* Register demo cyclic function */ > + cyclic = cyclic_register(cyclic_demo, 10 * 1000, "cyclic_demo", NULL); > + if (!cyclic) > + printf("Registering of cyclic_demo failed\n"); > + > return 0; > } > > diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig > index eba7bcbb483b..8b6c003760f2 100644 > --- a/configs/sandbox_defconfig > +++ b/configs/sandbox_defconfig > @@ -34,6 +34,8 @@ CONFIG_LOG=y > CONFIG_LOG_MAX_LEVEL=9 > CONFIG_LOG_DEFAULT_LEVEL=6 > CONFIG_DISPLAY_BOARDINFO_LATE=y > +CONFIG_CYCLIC=y > +CONFIG_CYCLIC_MAX_CPU_TIME_US=10000 > CONFIG_STACKPROTECTOR=y > CONFIG_ANDROID_AB=y > CONFIG_CMD_CPU=y > @@ -114,6 +116,7 @@ CONFIG_CMD_EROFS=y > CONFIG_CMD_EXT4_WRITE=y > CONFIG_CMD_SQUASHFS=y > CONFIG_CMD_MTDPARTS=y > +CONFIG_CMD_CYCLIC=y > CONFIG_CMD_STACKPROTECTOR_TEST=y > CONFIG_MAC_PARTITION=y > CONFIG_AMIGA_PARTITION=y > -- > 2.37.1 > Regards, SImon