qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] tests/microbit-test: Add tests for nRF51 NVMC


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] tests/microbit-test: Add tests for nRF51 NVMC
Date: Mon, 28 Jan 2019 19:01:43 +0000

On Thu, 24 Jan 2019 at 14:11, Stefan Hajnoczi <address@hidden> wrote:
>
> From: Steffen Görtz <address@hidden>
>
> Signed-off-by: Steffen Görtz <address@hidden>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> This resolves the conflict with Julia's UART test series due to
> global_qtest removal.
>
>  tests/microbit-test.c | 108 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 108 insertions(+)
>
> diff --git a/tests/microbit-test.c b/tests/microbit-test.c
> index 3bad947b6c..04e199ec33 100644
> --- a/tests/microbit-test.c
> +++ b/tests/microbit-test.c
> @@ -21,6 +21,7 @@
>  #include "hw/arm/nrf51.h"
>  #include "hw/char/nrf51_uart.h"
>  #include "hw/gpio/nrf51_gpio.h"
> +#include "hw/nvram/nrf51_nvm.h"
>  #include "hw/timer/nrf51_timer.h"
>  #include "hw/i2c/microbit_i2c.h"
>
> @@ -156,6 +157,112 @@ static void test_microbit_i2c(void)
>      qtest_quit(qts);
>  }
>
> +#define FLASH_SIZE          (256 * NRF51_PAGE_SIZE)
> +
> +static void fill_and_erase(QTestState *qts, hwaddr base, hwaddr size,
> +                           uint32_t address_reg)
> +{
> +    hwaddr i;
> +
> +    /* Erase Page */
> +    qtest_writel(qts, NRF51_NVMC_BASE + NRF51_NVMC_CONFIG, 0x02);
> +    qtest_writel(qts, NRF51_NVMC_BASE + address_reg, base);
> +    qtest_writel(qts, NRF51_NVMC_BASE + NRF51_NVMC_CONFIG, 0x00);
> +
> +    /* Check memory */
> +    for (i = 0; i < size / 4; i++) {
> +        g_assert_cmpuint(qtest_readl(qts, base + i * 4), ==, 0xFFFFFFFF);
> +    }
> +
> +    /* Fill memory */
> +    qtest_writel(qts, NRF51_NVMC_BASE + NRF51_NVMC_CONFIG, 0x01);
> +    for (i = 0; i < size / 4; i++) {
> +        qtest_writel(qts, base + i * 4, i);
> +        g_assert_cmpuint(qtest_readl(qts, base + i * 4), ==, i);

This assertion fails on PPC64 hosts:
ERROR:/home/pm215/qemu/tests/microbit-test.c:181:fill_and_erase:
assertion failed (qtest_readl(qts, base + i * 4) == i): (16777216 ==
1)

I suspect an endianness issue, given that 16777216 is 0x0100_0000.
The test looks OK, though -- a word write ought to come back
the same on a word read -- so maybe it's in the implementation?

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]