Skip to content

Commit

Permalink
[sw] Port kmac_mode_kmac_test to devicetables
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Jones <[email protected]>
  • Loading branch information
AlexJones0 committed Feb 11, 2025
1 parent f3d6ce8 commit 6ae214c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion sw/device/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2641,10 +2641,11 @@ opentitan_test(
EARLGREY_SILICON_OWNER_ROM_EXT_ENVS,
{
"//hw/top_earlgrey:silicon_creator": None,
"//hw/top_darjeeling:sim_dv": None,
},
),
deps = [
"//hw/top_earlgrey/sw/autogen:top_earlgrey",
"//hw/top:dt",
"//sw/device/lib/arch:device",
"//sw/device/lib/base:macros",
"//sw/device/lib/base:mmio",
Expand Down
9 changes: 5 additions & 4 deletions sw/device/tests/kmac_mode_kmac_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

#include "dt/dt_kmac.h" // Generated
#include "sw/device/lib/arch/device.h"
#include "sw/device/lib/base/macros.h"
#include "sw/device/lib/base/mmio.h"
Expand All @@ -10,8 +11,6 @@
#include "sw/device/lib/testing/test_framework/check.h"
#include "sw/device/lib/testing/test_framework/ottf_main.h"

#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"

OTTF_DEFINE_TEST_CONFIG();

#define DIGEST_LEN_KMAC_MAX 100
Expand Down Expand Up @@ -193,9 +192,11 @@ bool test_main(void) {

// Intialize KMAC hardware.
dif_kmac_t kmac;
dt_kmac_t kKmacDt = (dt_kmac_t)0;
static_assert(kDtKmacCount >= 1,
"This test requires at least one KMAC instance");
dif_kmac_operation_state_t kmac_operation_state;
CHECK_DIF_OK(
dif_kmac_init(mmio_region_from_addr(TOP_EARLGREY_KMAC_BASE_ADDR), &kmac));
CHECK_DIF_OK(dif_kmac_init_from_dt(kKmacDt, &kmac));

// Configure KMAC hardware using software entropy.
dif_kmac_config_t config = (dif_kmac_config_t){
Expand Down

0 comments on commit 6ae214c

Please sign in to comment.