Skip to content

Commit

Permalink
tests: benchmarks: power_consumption: flash: fix exmif pm
Browse files Browse the repository at this point in the history
The exmif instance used for the external flash operation
needs pm device runtime to be enabled for it, without it
the bus can not suspend, and s2ram can not be entered.

Additionally, the test needs to omplement suspend_req to
ensure the flash device and bus are suspended before the
thread is suspended.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
  • Loading branch information
bjarki-andreasen committed Jan 14, 2025
1 parent 30e2df6 commit b65f69a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
status = "okay";
};

&exmif {
zephyr,pm-device-runtime-auto;
};

/ {
aliases {
led = &led0;
Expand Down
13 changes: 13 additions & 0 deletions tests/benchmarks/power_consumption/flash/src/driver_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,25 @@ uint8_t buf[EXPECTED_SIZE];

static const struct device *flash_dev = DEVICE_DT_GET(FLASH_NODE);

static bool suspend_req;

bool self_suspend_req(void)
{
suspend_req = true;
return true;
}

void thread_definition(void)
{
int rc;
uint8_t fill_value = 0x00;

while (1) {
if (suspend_req) {
suspend_req = false;
k_thread_suspend(k_current_get());
}

rc = flash_erase(flash_dev, TEST_AREA_OFFSET, FLASH_PAGE_SIZE);
__ASSERT(rc == 0, "flash_erase %d\n", rc);
rc = flash_fill(flash_dev, fill_value, TEST_AREA_OFFSET, EXPECTED_SIZE);
Expand Down

0 comments on commit b65f69a

Please sign in to comment.