GPIO rotary encoder implementation
PATCH 1/14 GPIO rotary encoder implementation
This patch introduces an emulation of the rotary encoder that could be connected to GPIO controller.
An internal state is maintained with the values of the output pins. When a key is pressed the state is modified accordingly and the information is signaled on the output pins.
Key mappings are specified by the "key-left" and "key-left-alt" properties for a counter-clockwise direction and "key-right" and "key-right-alt" for a clockwise direction.
--- Makefile.target | 1 + hw/gpio_rotary.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+), 0 deletions(-) create mode 100644 hw/gpio_rotary.c
Makefile.target +1 -0
@@ -666,6 +666,7 @@ obj-y += framebuffer.o obj-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o obj-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o obj-y += syborg_virtio.o +obj-y += gpio_rotary.o CPPFLAGS += -DHAS_AUDIO endif ifeq ($(TARGET_BASE_ARCH), sh4)
hw/gpio_rotary.c new file +136 -0
136 lines not on this page · raw message
Signature · 1 line
1.6.3.msysgit.0
Quoted 2 lines · Filip Navara
This patch introduces an emulation of the rotary encoder that could be connected
to GPIO controller.
How about reset handling (qemu_register_reset)?
Quoted 7 lines · Blue Swirl
Quoted 2 lines · Filip Navara
This patch introduces an emulation of the rotary encoder that could be connected to GPIO controller.
How about reset handling (
qemu_register_reset)?
Good point, it was on my TODO list, but I never implemented it. All the devices currently lack it. I'll include it in next version.
Thanks,
Filip Navara
Quoted 11 lines · Filip Navara
Quoted 7 lines · Blue Swirl
Quoted 2 lines · Filip Navara
This patch introduces an emulation of the rotary encoder that could be connected to GPIO controller.
How about reset handling (
qemu_register_reset)?Good point, it was on my TODO list, but I never implemented it. All the devices currently lack it. I'll include it in next version.
On second thought the GPIO devices don't need reset handling. In real hardware the rotary encoder is not affected by reset, so why would it be affected in QEMU? Unfortunately to get that working correctly the late_init callbacks, proposed in the devtree patches, are needed.
Best regards,
Filip Navara
Quoted 10 lines · Filip Navara
Quoted 9 lines · Filip Navara
Quoted 7 lines · Blue Swirl
Quoted 2 lines · Filip Navara
This patch introduces an emulation of the rotary encoder that could be connected to GPIO controller.
How about reset handling (
qemu_register_reset)?
Quoted 7 lines
Quoted 2 lines
Good point, it was on my TODO list, but I never implemented it. All the devices currently lack it. I'll include it in next version.
On second thought the GPIO devices don't need reset handling. In real hardware the rotary encoder is not affected by reset, so why would it be affected in QEMU? Unfortunately to get that working correctly the
late_initcallbacks, proposed in the devtree patches, are needed.
There is still internal state (for example s->extension) that may need reset.
Quoted 14 lines · Blue Swirl
Quoted 13 lines · Filip Navara
Quoted 11 lines · Filip Navara
Quoted 7 lines · Blue Swirl
Quoted 2 lines · Filip Navara
This patch introduces an emulation of the rotary encoder that could be connected to GPIO controller.
How about reset handling (
qemu_register_reset)?Good point, it was on my TODO list, but I never implemented it. All the devices currently lack it. I'll include it in next version.
Quoted 7 lines
Quoted 4 lines
On second thought the GPIO devices don't need reset handling. In real hardware the rotary encoder is not affected by reset, so why would it be affected in QEMU? Unfortunately to get that working correctly the
late_initcallbacks, proposed in the devtree patches, are needed.There is still internal state (for example
s->extension) that may need reset.
s->extension is part of host state actually and I don't think it should be reset. The only emulated device that resets it is ESCC. ADB, Musicpal, Syborg, Stellaris and xenfb never reset it (possibly because reset callbacks are not implemented).
Best regards,
Filip Navara