Skip to contentSkip to conversation

Implement something

PATCH In review Evgeny Ermakov 1 participant 4 messages Nov 30, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Implement something

Hello!

Evgeny Ermakov (2):
hw/char: Add STM32F7 peripheral: USART
hw/input: Add FT5336 touch controller

 include/hw/char/stm32f7xx_usart.h |  30 +++
 include/hw/input/ft5336.h         |  14 ++
 hw/char/stm32f7xx_usart.c         | 361 ++++++++++++++++++++++++++++++
 hw/input/ft5336.c                 | 357 +++++++++++++++++++++++++++++
 hw/arm/Kconfig                    |   1 +
 hw/char/Kconfig                   |   3 +
 hw/char/meson.build               |   1 +
 hw/char/trace-events              |   4 +
 hw/input/Kconfig                  |   4 +
 hw/input/meson.build              |   2 +
 10 files changed, 777 insertions(+)
 create mode 100644 include/hw/char/stm32f7xx_usart.h
 create mode 100644 include/hw/input/ft5336.h
 create mode 100644 hw/char/stm32f7xx_usart.c
 create mode 100644 hw/input/ft5336.c
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/2 hw/char: Add STM32F7 peripheral: USART

---
 include/hw/char/stm32f7xx_usart.h |  30 +++
 hw/char/stm32f7xx_usart.c         | 361 ++++++++++++++++++++++++++++++
 hw/arm/Kconfig                    |   1 +
 hw/char/Kconfig                   |   3 +
 hw/char/meson.build               |   1 +
 hw/char/trace-events              |   4 +
 6 files changed, 400 insertions(+)
 create mode 100644 include/hw/char/stm32f7xx_usart.h
 create mode 100644 hw/char/stm32f7xx_usart.c
include/hw/char/stm32f7xx_usart.h new file +30 -0
new file mode 100644
index 0000000000..ec005be8d8
@@ -0,0 +1,30 @@
+/*
+ * STM32F7XX Universal synchronous/asynchronous receiver transmitter (USART)
+ *
+ * Copyright (c) 2022 Evgeny Ermakov <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_CHAR_STM32F7XX_USART_H
+#define HW_CHAR_STM32F7XX_USART_H
+
+#include "hw/arm/stm32f.h"
+#include "chardev/char-fe.h"
+
+#define TYPE_STM32F7XX_USART "stm32f7xx-usart"
+OBJECT_DECLARE_SIMPLE_TYPE(STM32F7XXUSARTState, STM32F7XX_USART)
+
+#define STM32F7XX_USART_R_MAX 11
+
+struct STM32F7XXUSARTState {
+    /*< private >*/
+    STM32FPeripheralState parent_obj;
+
+    uint32_t regs[STM32F7XX_USART_R_MAX];
+
+    CharBackend chr;
+    qemu_irq irq;
+};
+
+#endif /* HW_CHAR_STM32F7XX_USART_H */
hw/char/stm32f7xx_usart.c new file +361 -0

361 lines not on this page · raw message

hw/arm/Kconfig +1 -0
index c2f6e748b0..02dfbcb99a 100644
@@ -376,6 +376,7 @@ config STM32F405_SOC
 config STM32F7XX_SOC
     bool
     select STM32F
+    select STM32F7XX_USART
 
 config XLNX_ZYNQMP_ARM
     bool
hw/char/Kconfig +3 -0
index 6b6cf2fc1d..22b1cf8062 100644
@@ -41,6 +41,9 @@ config VIRTIO_SERIAL
 config STM32F2XX_USART
     bool
 
+config STM32F7XX_USART
+    bool
+
 config CMSDK_APB_UART
     bool
 
hw/char/meson.build +1 -0
index 7b594f51b8..6230750375 100644
@@ -31,6 +31,7 @@ softmmu_ss.add(when: 'CONFIG_RENESAS_SCI', if_true: files('renesas_sci.c'))
 softmmu_ss.add(when: 'CONFIG_SIFIVE_UART', if_true: files('sifive_uart.c'))
 softmmu_ss.add(when: 'CONFIG_SH_SCI', if_true: files('sh_serial.c'))
 softmmu_ss.add(when: 'CONFIG_STM32F2XX_USART', if_true: files('stm32f2xx_usart.c'))
+softmmu_ss.add(when: 'CONFIG_STM32F7XX_USART', if_true: files('stm32f7xx_usart.c'))
 softmmu_ss.add(when: 'CONFIG_MCHP_PFSOC_MMUART', if_true: files('mchp_pfsoc_mmuart.c'))
 
 specific_ss.add(when: 'CONFIG_HTIF', if_true: files('riscv_htif.c'))
hw/char/trace-events +4 -0
index 2ecb36232e..41fa3c0b46 100644
@@ -105,3 +105,7 @@ cadence_uart_baudrate(unsigned baudrate) "baudrate %u"
 # sh_serial.c
 sh_serial_read(char *id, unsigned size, uint64_t offs, uint64_t val) " %s size %d offs 0x%02" PRIx64 " -> 0x%02" PRIx64
 sh_serial_write(char *id, unsigned size, uint64_t offs, uint64_t val) "%s size %d offs 0x%02" PRIx64 " <- 0x%02" PRIx64
+
+# stm32f7xx_usart.c
+stm32f7xx_usart_read(uint64_t addr) " addr: 0x%02" PRIx64
+stm32f7xx_usart_write(uint64_t addr, uint64_t data) "addr: 0x%02" PRIx64 " val: 0x%" PRIx64
Signature · 1 line
2.38.1
#2 lore raw

PATCH 2/2 hw/input: Add FT5336 touch controller

In reply to Evgeny Ermakov
---
 include/hw/input/ft5336.h |  14 ++
 hw/input/ft5336.c         | 357 ++++++++++++++++++++++++++++++++++++++
 hw/input/Kconfig          |   4 +
 hw/input/meson.build      |   2 +
 4 files changed, 377 insertions(+)
 create mode 100644 include/hw/input/ft5336.h
 create mode 100644 hw/input/ft5336.c
include/hw/input/ft5336.h new file +14 -0
new file mode 100644
index 0000000000..7bef3f9efb
@@ -0,0 +1,14 @@
+/*
+ * FT5336 touch controller
+ *
+ * Copyright (c) 2022 Evgeny Ermakov <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_INPUT_FT5336_H
+#define HW_INPUT_FT5336_H
+
+#define TYPE_FT5336 "ft5336"
+
+#endif
hw/input/ft5336.c new file +357 -0

357 lines not on this page · raw message

hw/input/Kconfig +4 -0
index 55865bb386..73a6f67216 100644
@@ -46,3 +46,7 @@ config TSC210X
 
 config LASIPS2
     select PS2
+
+config FT5336
+    bool
+    depends on I2C
hw/input/meson.build +2 -0
index 8deb011d4a..c892ecbeb7 100644
@@ -16,3 +16,5 @@ softmmu_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input
 softmmu_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx_keypad.c'))
 softmmu_ss.add(when: 'CONFIG_TSC210X', if_true: files('tsc210x.c'))
 softmmu_ss.add(when: 'CONFIG_LASIPS2', if_true: files('lasips2.c'))
+
+softmmu_ss.add(when: 'CONFIG_FT5336', if_true: files('ft5336.c'))
Signature · 1 line
2.38.1
#3 lore raw
In reply to Evgeny Ermakov

Evgeny Ermakov <[email protected]> writes:

Oops, sorry. Ignore this, I sent it by mistake.

Quoted 24 lines

Hello!

Evgeny Ermakov (2):
hw/char: Add STM32F7 peripheral: USART
hw/input: Add FT5336 touch controller

 include/hw/char/stm32f7xx_usart.h |  30 +++
 include/hw/input/ft5336.h         |  14 ++
 hw/char/stm32f7xx_usart.c         | 361 ++++++++++++++++++++++++++++++
 hw/input/ft5336.c                 | 357 +++++++++++++++++++++++++++++
 hw/arm/Kconfig                    |   1 +
 hw/char/Kconfig                   |   3 +
 hw/char/meson.build               |   1 +
 hw/char/trace-events              |   4 +
 hw/input/Kconfig                  |   4 +
 hw/input/meson.build              |   2 +
 10 files changed, 777 insertions(+)
 create mode 100644 include/hw/char/stm32f7xx_usart.h
 create mode 100644 include/hw/input/ft5336.h
 create mode 100644 hw/char/stm32f7xx_usart.c
 create mode 100644 hw/input/ft5336.c
Signature · 1 line
2.38.1