[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 03/11] hw/avr: Add limited support for avr gpio registers
From: |
Richard Henderson |
Subject: |
Re: [PATCH 03/11] hw/avr: Add limited support for avr gpio registers |
Date: |
Sat, 13 Mar 2021 13:55:27 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
On 3/13/21 10:54 AM, Philippe Mathieu-Daudé wrote:
+#define AVR_GPIO_COUNT 8
+
+struct AVRGPIOState {
+ /*< private >*/
+ SysBusDevice parent_obj;
+
+ /*< public >*/
+ MemoryRegion mmio;
+
+ struct {
+ uint8_t pin;
+ uint8_t ddr;
+ uint8_t port;
+ } reg;
+
+ /* PORTx data changed IRQs */
+ qemu_irq out[8u];
AVR_GPIO_COUNT?
Can we drop all the useless 'u' suffixes from all over?
+ gpio->reg.pin = 0u;
+ gpio->reg.ddr = 0u;
+ gpio->reg.port = 0u;
...
+ uint8_t cur_port_pin_val = cur_port_val & 0x01u;
+ uint8_t cur_ddr_pin_val = cur_ddr_val & 0x01u;
+ uint8_t new_port_pin_val = value & 0x01u;
...
+ cur_port_val >>= 1u;
+ cur_ddr_val >>= 1u;
+ value >>= 1u;
etc.
Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
- [PATCH 00/11] AVR patch queue for QEMU 6.0, Philippe Mathieu-Daudé, 2021/03/13
- [PATCH 01/11] hw/misc/led: Add yellow LED, Philippe Mathieu-Daudé, 2021/03/13
- [PATCH 02/11] hw/avr/arduino: List board schematic links, Philippe Mathieu-Daudé, 2021/03/13
- [PATCH 03/11] hw/avr: Add limited support for avr gpio registers, Philippe Mathieu-Daudé, 2021/03/13
- [PATCH 04/11] hw/gpio/avr_gpio: Add migration VMstate, Philippe Mathieu-Daudé, 2021/03/13
- [PATCH 05/11] hw/gpio/avr_gpio: Add 'id' field in AVRGPIOState, Philippe Mathieu-Daudé, 2021/03/13
- [PATCH 06/11] hw/gpio/avr_gpio: Simplify avr_gpio_write_port using extract32(), Philippe Mathieu-Daudé, 2021/03/13
- [PATCH 07/11] hw/gpio/avr_gpio: Add tracing for reads and writes, Philippe Mathieu-Daudé, 2021/03/13