tests: drivers: memc: add hifive_unmatched board
Add HiFive Unmatched board to memory controller tests. Signed-off-by: Franciszek Zdobylak <fzdobylak@antmicro.com>
This commit is contained in:
parent
71a6c22731
commit
fb80eb5a2e
3 changed files with 28 additions and 8 deletions
3
tests/drivers/memc/ram/boards/hifive_unmatched.overlay
Normal file
3
tests/drivers/memc/ram/boards/hifive_unmatched.overlay
Normal file
|
@ -0,0 +1,3 @@
|
|||
&dmc {
|
||||
status = "okay";
|
||||
};
|
|
@ -19,16 +19,16 @@
|
|||
*
|
||||
* @param mem RAM memory location to be tested.
|
||||
*/
|
||||
static void test_ram_rw(uint32_t *mem)
|
||||
static void test_ram_rw(uint32_t *mem, size_t size)
|
||||
{
|
||||
/* fill memory with number range (0, BUF_SIZE - 1) */
|
||||
for (size_t i = 0U; i < BUF_SIZE; i++) {
|
||||
for (size_t i = 0U; i < size / sizeof(uint32_t); i++) {
|
||||
mem[i] = i;
|
||||
}
|
||||
|
||||
/* check that memory contains written range */
|
||||
for (size_t i = 0U; i < BUF_SIZE; i++) {
|
||||
zassert_equal(mem[i], i, "Unexpected content");
|
||||
for (size_t i = 0U; i < size / sizeof(uint32_t); i++) {
|
||||
zassert_equal(mem[i], i, "Unexpected content on byte %ld", i);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -45,12 +45,26 @@ BUF_DEF(sram1);
|
|||
BUF_DEF(sram2);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(ram0), okay)
|
||||
#define RAM_SIZE DT_REG_SIZE(DT_NODELABEL(ram0))
|
||||
static uint32_t *buf_ram0 = (uint32_t *)DT_REG_ADDR(DT_NODELABEL(ram0));
|
||||
#endif
|
||||
|
||||
ZTEST_SUITE(test_ram, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
ZTEST(test_ram, test_sdram1)
|
||||
{
|
||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram1), okay)
|
||||
test_ram_rw(buf_sdram1);
|
||||
test_ram_rw(buf_sdram1, BUF_SIZE);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
}
|
||||
|
||||
ZTEST(test_ram, test_ram0)
|
||||
{
|
||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(ram0), okay)
|
||||
test_ram_rw(buf_ram0, RAM_SIZE);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
|
@ -59,7 +73,7 @@ ZTEST(test_ram, test_sdram1)
|
|||
ZTEST(test_ram, test_sdram2)
|
||||
{
|
||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sdram2), okay)
|
||||
test_ram_rw(buf_sdram2);
|
||||
test_ram_rw(buf_sdram2, BUF_SIZE);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
|
@ -68,7 +82,7 @@ ZTEST(test_ram, test_sdram2)
|
|||
ZTEST(test_ram, test_sram1)
|
||||
{
|
||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram1), okay)
|
||||
test_ram_rw(buf_sram1);
|
||||
test_ram_rw(buf_sram1, BUF_SIZE);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
|
@ -77,7 +91,7 @@ ZTEST(test_ram, test_sram1)
|
|||
ZTEST(test_ram, test_sram2)
|
||||
{
|
||||
#if DT_NODE_HAS_STATUS(DT_NODELABEL(sram2), okay)
|
||||
test_ram_rw(buf_sram2);
|
||||
test_ram_rw(buf_sram2, BUF_SIZE);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
#endif
|
||||
|
|
|
@ -10,3 +10,6 @@ tests:
|
|||
platform_allow: sam4s_xplained
|
||||
integration_platforms:
|
||||
- sam4s_xplained
|
||||
drivers.memc.sifive_ddr:
|
||||
tags: drivers memc
|
||||
platform_allow: hifive_unmatched
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue