[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 05/13] hw/nvram/nrf51_nvm: Add nRF51 non-vola
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v3 05/13] hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories |
Date: |
Thu, 1 Nov 2018 11:17:43 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Tue, Oct 30, 2018 at 08:25:19PM -0400, Steffen Görtz wrote:
> +static void io_write(void *opaque, hwaddr offset, uint64_t value,
> + unsigned int size)
> +{
> + NRF51NVMState *s = NRF51_NVM(opaque);
> +
> + switch (offset) {
> + case NRF51_NVMC_CONFIG:
> + s->config = value & NRF51_NVMC_CONFIG_MASK;
> + break;
> + case NRF51_NVMC_ERASEPCR0:
> + case NRF51_NVMC_ERASEPCR1:
> + value &= ~(NRF51_PAGE_SIZE - 1);
> + if (value < (s->code_size * NRF51_PAGE_SIZE)) {
> + address_space_write(&s->as, value, MEMTXATTRS_UNSPECIFIED,
> + s->empty_page, NRF51_PAGE_SIZE);
> + }
> + break;
> + case NRF51_NVMC_ERASEALL:
> + if (value == NRF51_NVMC_ERASE) {
> + for (uint32_t i = 0; i < s->code_size; i++) {
> + address_space_write(&s->as, i * NRF51_PAGE_SIZE,
> + MEMTXATTRS_UNSPECIFIED, s->empty_page, NRF51_PAGE_SIZE);
Indentation is off here. One way of formatting it:
address_space_write(&s->as, i * NRF51_PAGE_SIZE,
MEMTXATTRS_UNSPECIFIED, s->empty_page,
NRF51_PAGE_SIZE);
> +static void nrf51_nvm_reset(DeviceState *dev)
> +{
> + NRF51NVMState *s = NRF51_NVM(dev);
> +
> + memset(s->uicr_content, '\0', sizeof(s->uicr_content));
> +}
We will zero UICR. Does UICR come zero-initialized on a real micro:bit?
I remember there was an issue with .hex files that set UICR values.
Will nrf51_nvm_reset() overwrite values from .hex files when the generic
loader devices is used (-device loader,file=test.hex)?
signature.asc
Description: PGP signature
- Re: [Qemu-devel] [PATCH v3 05/13] hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories,
Stefan Hajnoczi <=