Skip to content

Commit

Permalink
tests: benchmarks: peripheral_load: fix test
Browse files Browse the repository at this point in the history
Extend stack for flash thread.
Wait for DVFS init in clock thread, more verbose log

Signed-off-by: Piotr Krzyzanowski <[email protected]>
(cherry picked from commit af40990)
  • Loading branch information
nordic-pikr authored and github-actions[bot] committed Nov 13, 2024
1 parent 9c6f59b commit c791aec
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
37 changes: 28 additions & 9 deletions tests/benchmarks/peripheral_load/src/clock_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(clock, LOG_LEVEL_INF);

#include <nrfs_backend_ipc_service.h>
#include <zephyr/devicetree.h>
#include <zephyr/devicetree/clocks.h>
#include <zephyr/drivers/clock_control/nrf_clock_control.h>
Expand Down Expand Up @@ -110,21 +109,41 @@ static void test_request_release_clock_spec(const struct device *clk_dev,
LOG_INF("Clock under test: %s", clk_dev->name);
sys_notify_init_spinwait(&cli.notify);
ret = nrf_clock_control_request(clk_dev, clk_spec, &cli);
__ASSERT_NO_MSG(ret >= 0 && ret <= 2);
LOG_INF("Clock control request return value: %d", ret);
if (ret != 0) {
LOG_ERR("Clock control request failed");
atomic_inc(&completed_threads);
return;
}
do {
ret = sys_notify_fetch_result(&cli.notify, &res);
k_yield();
} while (ret == -EAGAIN);
LOG_INF("Clock control request return value: %d", ret);
LOG_INF("Clock control request response code: %d", res);
__ASSERT_NO_MSG(ret);
__ASSERT_NO_MSG(res);
if (res != 0) {
LOG_ERR("Wrong clock control request response code");
atomic_inc(&completed_threads);
return;
}
ret = clock_control_get_rate(clk_dev, NULL, &rate);
__ASSERT_NO_MSG(ret);
__ASSERT_NO_MSG(rate == clk_spec->frequency);
LOG_INF("Clock control get rate response code: %d", ret);
if (ret != 0) {
LOG_ERR("Clock control get rate failed");
atomic_inc(&completed_threads);
return;
}
if (rate != clk_spec->frequency) {
LOG_ERR("Invalid rate: %d", rate);
atomic_inc(&completed_threads);
return;
}
k_msleep(1000);
ret = nrf_clock_control_release(clk_dev, clk_spec);
__ASSERT_NO_MSG(ret == ONOFF_STATE_ON);
if (ret != ONOFF_STATE_ON) {
LOG_ERR("Clock control release failed");
atomic_inc(&completed_threads);
return;
}
}

static void test_clock_control_request(const struct test_clk_context *clk_contexts,
Expand Down Expand Up @@ -161,7 +180,7 @@ static void clock_thread(void *arg1, void *arg2, void *arg3)

atomic_inc(&started_threads);

nrfs_backend_wait_for_connection(K_FOREVER);
k_msleep(100);
test_clock_control_request(cpuapp_hsfll_test_clk_contexts,
ARRAY_SIZE(cpuapp_hsfll_test_clk_contexts));

Expand Down
2 changes: 1 addition & 1 deletion tests/benchmarks/peripheral_load/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern atomic_t completed_threads;

/* FLASH thread: */
#define FLASH_THREAD_COUNT_MAX (40)
#define FLASH_THREAD_STACKSIZE (1024)
#define FLASH_THREAD_STACKSIZE (2048)
#define FLASH_THREAD_PRIORITY (5)
#define FLASH_THREAD_SLEEP (200)

Expand Down

0 comments on commit c791aec

Please sign in to comment.