Skip to contentSkip to conversation

hw/adc/stm32f2xx_adc: Correct memory region size and access size

PATCH Superseded Philippe Mathieu-Daudé 1 participant 2 messages May 25, 2020 Arm STM32

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/adc/stm32f2xx_adc: Correct memory region size and access size

The ADC region size is 256B, split as:
- [0x00 - 0x4f] defined
- [0x50 - 0xff] reserved

All registers are 32-bit (thus when the datasheet mentions the last defined register is 0x4c, it means its address range is 0x4c .. 0x4f.

This model implementation is also 32-bit. Set MemoryRegionOps 'impl' fields.

See:
'RM0033 Reference manual Rev 8', Table 10.13.18 "ADC register map".

---
 hw/adc/stm32f2xx_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/adc/stm32f2xx_adc.c +1 -1
index 4f9d485ecf..5d834a98f6 100644
@@ -278,7 +278,7 @@ static void stm32f2xx_adc_init(Object *obj)
     sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
 
     memory_region_init_io(&s->mmio, obj, &stm32f2xx_adc_ops, s,
-                          TYPE_STM32F2XX_ADC, 0xFF);
+                          TYPE_STM32F2XX_ADC, 0x100);
     sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
 }
 
Signature · 1 line
2.21.3
#1 lore raw
Quoted 24 lines · Philippe Mathieu-Daudé

The ADC region size is 256B, split as:
- [0x00 - 0x4f] defined
- [0x50 - 0xff] reserved

All registers are 32-bit (thus when the datasheet mentions the last defined register is 0x4c, it means its address range is 0x4c .. 0x4f.

This model implementation is also 32-bit. Set MemoryRegionOps 'impl' fields.

See:
'RM0033 Reference manual Rev 8', Table 10.13.18 "ADC register map".

---
 hw/adc/stm32f2xx_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/adc/stm32f2xx_adc.c +0 -0
index 4f9d485ecf..5d834a98f6 100644

hw/adc/stm32f2xx_adc.c static void stm32f2xx_adc_init(Object *obj) · line 284

Quoted 8 lines
hw/adc/stm32f2xx_adc.c +1 -1
@@ -278,7 +278,7 @@ static void stm32f2xx_adc_init(Object *obj)
     sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
 
     memory_region_init_io(&s->mmio, obj, &stm32f2xx_adc_ops, s,
-                          TYPE_STM32F2XX_ADC, 0xFF);
+                          TYPE_STM32F2XX_ADC, 0x100);
     sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
 }
 

Please ignore this patch, it is incomplete.