qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Qemu GPIO support


From: bifferos
Subject: [Qemu-devel] Qemu GPIO support
Date: Tue, 1 Sep 2009 05:46:56 -0700 (PDT)

Greetings,

I thought I should probably announce here my work on GPIO support for Qemu. 
I've favoured correctness of operation and flexibility over speed, since I'm 
generally emulating embedded devices anyhow.

Here are the requirements:

1) Multiple peripherals can be connected to the same pins
2) Multiple machines (Qemu instances) can be connected to the same pins
3) The system must arbitrate to determine pin state, and take into account 
pull-up resistors, and signal when pins are in contention
4) Peripherals can be unplugged at any time
5) Machines can be unplugged at any time
6) The system should be as efficient as possible given the above requirements.
7) The system should be portable (Windows, Linux)
8) The system should allow writing peripherals in any programming language

The approach I've adopted was to write a tcp socket server to which Qemu and 
other peripherals can connect to.  The closest analogy is that it behaves as a 
terminal block.  Clients connect, inform the server which pins they are 
connecting to, and whether they are passively pulled high, actively driven 
high, or actively driven low.  The server then arbitrates and tells the clients 
what the pins values are when asked.  They can be either logic '1', '0' or in 
contention.  Clients can subscribe to pin changes (useful for peripherals), or 
they can simply poll (the Qemu client(s) will generally do this)

For the moment, I have implemented the server, a Qemu patch to access 
some gpio pins via PCI northbridge (this is how RDC chips do it, other
x86 systems will just use basic IO ports), and also a trivial LED emulation 
client.

All this stuff can be seen in action over here:
http://sites.google.com/site/bifferboard/Home/howto/qemu

It is currently heavily biased towards the Bifferboard, which is a 
1W x86-compatible controller, but can easily be adapted to other x86 machines, 
probably other architectures can use the same approach.

I will be adding MMC/HD47780/i2c/button emulation and so on as time permits.

cheers,
Biff.











reply via email to

[Prev in Thread] Current Thread [Next in Thread]