public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Cc: trini@konsulko.com, sjg@chromium.org, cchavva@marvell.com,
	awilliams@marvell.com
Subject: [PATCH v3 6/8] sandbox: Add cyclic demo function
Date: Fri,  5 Aug 2022 16:26:08 +0200	[thread overview]
Message-ID: <20220805142610.375427-7-sr@denx.de> (raw)
In-Reply-To: <20220805142610.375427-1-sr@denx.de>

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 <sr@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(+)

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


  parent reply	other threads:[~2022-08-05 14:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 14:26 [PATCH v3 0/8] Add support for cyclic function execution infrastruture Stefan Roese
2022-08-05 14:26 ` [PATCH v3 1/8] time: Import time_after64() and friends from Linux Stefan Roese
2022-08-05 16:48   ` Simon Glass
2022-08-05 14:26 ` [PATCH v3 2/8] cyclic: Add basic support for cyclic function execution infrastruture Stefan Roese
2022-08-05 16:48   ` Simon Glass
2022-08-15 13:49     ` Stefan Roese
2022-08-05 14:26 ` [PATCH v3 3/8] cyclic: Integrate cyclic infrastructure into WATCHDOG_RESET Stefan Roese
2022-08-05 16:48   ` Simon Glass
2022-08-15 16:16     ` Stefan Roese
2022-08-15 17:37       ` Simon Glass
2022-08-16 10:10         ` Stefan Roese
2022-08-05 14:26 ` [PATCH v3 4/8] cyclic: Integrate cyclic functionality at bootup in board_r/f Stefan Roese
2022-08-05 16:48   ` Simon Glass
2022-08-05 14:26 ` [PATCH v3 5/8] cyclic: Add 'cyclic list' command Stefan Roese
2022-08-05 16:48   ` Simon Glass
2022-08-15 16:24     ` Stefan Roese
2022-08-05 14:26 ` Stefan Roese [this message]
2022-08-05 16:48   ` [PATCH v3 6/8] sandbox: Add cyclic demo function Simon Glass
2022-08-16  8:38     ` Stefan Roese
2022-08-05 14:26 ` [PATCH v3 7/8] mips: octeon_nic23: Add PCIe FLR fixup via cyclic infrastructure Stefan Roese
2022-08-05 14:26 ` [PATCH v3 8/8] cyclic: Add documentation Stefan Roese
2022-08-05 16:48   ` Simon Glass
2022-08-15 16:18     ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220805142610.375427-7-sr@denx.de \
    --to=sr@denx.de \
    --cc=awilliams@marvell.com \
    --cc=cchavva@marvell.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox