qemu qemu-doc.texi
CVSROOT: /cvsroot/qemu
Module name: qemu
Branch:
Changes by: Fabrice Bellard <[email protected]> 05/03/13 09:43:06
Modified files:
. : qemu-doc.texi
Log message:
sparc update
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/qemu/qemu/qemu-doc.texi.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
Re: [Qemu-devel] [PATCH] parallel port support for qemu.
Quoted 10 lines · Mark Jonckheere
Quoted 2 lines
- redirecting printer output to a physical device.
This would be useful for running the Xilinx FPGA tools under qemu, which use a parallel port JTAG dongle. I'm trying to read out the FPGA bitstream as described in their datasheets using CFG_IN/CFG_OUT but it just doesn't seem to work as they describe -- this would be useful for figuring out how it all really works.
Quoted 5 lines
I'll have a go at this in a few days when I come back home.
cheers,
Lennert
I decided to take a shot at this. The patch below works ONLY on linux and requires the "Support for user-space parallel port device drivers" driver (aka parport). I'm sure it breaks non-linux builds. I'm also fairly certain that interrupts are not working correctly. However, it is good enough that I have managed to read and programming my remote control which has a parallel port interface! (This was the remaining reason that I had to re-boot into Windows) and should work with Lennerts FPGA tools (see above).
This patch was made against CVS this morning. If you want to try it, do something like:
qemu -hda my.img -parallel /dev/parport0
Of course, this might be dangerous code, so use at your own risk.
-Jason
hw/parallel.c 2005-03-12 19:00:37.000000000 -0700 renamed from hw/parallel.c 2005-01-23 13:42:59.000000000 -0700 +20 -26
@@ -22,6 +22,9 @@ * THE SOFTWARE. */ #include "vl.h" +#include <sys/ioctl.h> +#include <linux/parport.h> +#include <linux/ppdev.h> //#define DEBUG_PARALLEL
@@ -43,15 +46,6 @@ #define PARA_CTR_AUTOLF 0x02 /* Auto linefeed complement */ #define PARA_CTR_STROBE 0x01 /* Strobe complement */ -struct ParallelState { - uint8_t data; - uint8_t status; /* read only register */ - uint8_t control; - int irq; - int irq_pending; - CharDriverState *chr; -}; - static void parallel_update_irq(ParallelState *s) { if (s->irq_pending)
@@ -70,29 +64,29 @@ static void parallel_ioport_write(void * #endif switch(addr) { case 0: - s->data = val; + qemu_pp_write_data(s, (uint8_t)val); parallel_update_irq(s); break; case 2: + qemu_pp_write_control(s, (uint8_t)val); if ((val & PARA_CTR_INIT) == 0 ) { - s->status = PARA_STS_BUSY; - s->status |= PARA_STS_ACK; - s->status |= PARA_STS_ONLINE; - s->status |= PARA_STS_ERROR; + s->status = PARA_STS_BUSY; + s->status |= PARA_STS_ACK; + s->status |= PARA_STS_ONLINE; + s->status |= PARA_STS_ERROR; } else if (val & PARA_CTR_SELECT) { - if (val & PARA_CTR_STROBE) { - s->status &= ~PARA_STS_BUSY; - if ((s->control & PARA_CTR_STROBE) == 0) - qemu_chr_write(s->chr, &s->data, 1); - } else { - if (s->control & PARA_CTR_INTEN) { - s->irq_pending = 1; - } - } + if (val & PARA_CTR_STROBE) { + s->status &= ~PARA_STS_BUSY; + if ((s->control & PARA_CTR_STROBE) == 0) + qemu_chr_write(s->chr, &s->data, 1); + } else { + if (s->control & PARA_CTR_INTEN) { + s->irq_pending = 1; + } + } } parallel_update_irq(s); - s->control = val; break; } }
@@ -105,25 +99,25 @@ static uint32_t parallel_ioport_read(voi addr &= 7; switch(addr) { case 0: - ret = s->data; + ret = qemu_pp_read_data(s); break; case 1: - ret = s->status; + ret = qemu_pp_read_status(s); s->irq_pending = 0; if ((s->status & PARA_STS_BUSY) == 0 && (s->control &
PARA_CTR_STROBE)== 0) {
- /* XXX Fixme: wait 5 microseconds */
- if (s->status & PARA_STS_ACK)
- s->status &= ~PARA_STS_ACK;
- else {
- /* XXX Fixme: wait 5 microseconds */
- s->status |= PARA_STS_ACK; - s->status |= PARA_STS_BUSY;
- }
+ /* XXX Fixme: wait 5 microseconds */
+ if (s->status & PARA_STS_ACK)
+ s->status &= ~PARA_STS_ACK;
+ else {
+ /* XXX Fixme: wait 5 microseconds */
+ s->status |= PARA_STS_ACK;
+ s->status |= PARA_STS_BUSY;
+ }
}
parallel_update_irq(s);
break;
case 2:
- ret = s->control;
+ ret = qemu_pp_read_control(s);
break;
} #ifdef DEBUG_PARALLEL
Only in qemu-sandbox: kqemu
Only in qemu-sandbox: qemu-doc.html
Only in qemu-sandbox: qemu-img.1
Only in qemu-sandbox: qemu-tech.html
Only in qemu-sandbox: qemu.1
vl.c 2005-03-13 07:16:54.000000000 -0700 renamed from vl.c 2005-03-13 02:43:36.000000000 -0700 +99 -2
138 lines not on this page · raw message
vl.h 2005-03-13 07:16:54.000000000 -0700 renamed from vl.h 2005-03-13 02:43:36.000000000 -0700 +18 -2
@@ -199,6 +199,17 @@ typedef struct CharDriverState { void *opaque; } CharDriverState; + +typedef struct ParallelState { + uint8_t data; + uint8_t status; /* read only register */ + uint8_t control; + int irq; + int irq_pending; + CharDriverState *chr; +} ParallelState; + + void qemu_chr_printf(CharDriverState *s, const char *fmt, ...); int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len); void qemu_chr_send_event(CharDriverState *s, int event);
@@ -206,6 +217,13 @@ void qemu_chr_add_read_handler(CharDrive IOCanRWHandler *fd_can_read, IOReadHandler *fd_read, void *opaque); void qemu_chr_add_event_handler(CharDriverState *s, IOEventHandler *chr_event); + + +uint8_t qemu_pp_read_status(ParallelState *s); +uint8_t qemu_pp_read_control(ParallelState *s); +uint8_t qemu_pp_read_data(ParallelState *s); +void qemu_pp_write_data(ParallelState *s, uint8_t data); +void qemu_pp_write_control(ParallelState *s, uint8_t control); /* consoles */
@@ -643,8 +661,6 @@ typedef struct SerialState SerialState; SerialState *serial_init(int base, int irq, CharDriverState *chr); /* parallel.c */ - -typedef struct ParallelState ParallelState; ParallelState *parallel_init(int base, int irq, CharDriverState *chr); /* i8259.c */
Re: [Qemu-devel] [PATCH] parallel port support for qemu.
Quoted 5 lines · Jason Turner
fairly certain that interrupts are not working correctly. However, it is good enough that I have managed to read and programming my remote control which has a parallel port interface! (This was the remaining reason that I had to re-boot into Windows) and should work with Lennerts FPGA tools (see above).
Do you know if there is any possibility to support guardant parallel port dongles under linux (http://www.guardant.com/)? Do you have some experience with usb dongles? It's very important for me, could someone help me?
Re: [Qemu-devel] [PATCH] parallel port support for qemu.
Quoted 7 lines · Adrian Smarzewski
Quoted 5 lines · Jason Turner
fairly certain that interrupts are not working correctly. However, it is good enough that I have managed to read and programming my remote control which has a parallel port interface! (This was the remaining reason that I had to re-boot into Windows) and should work with Lennerts FPGA tools (see above).
Quoted 5 lines
Do you know if there is any possibility to support guardant parallel port dongles under linux (http://www.guardant.com/)? Do you have some experience with usb dongles? It's very important for me, could someone help me?
It's been very long since I have used one of the anti-piracy dongles, but I'm guessing it would work with my patch, or at least could be made to without much more work.
Does anyone out there have a parallel port printer they could test with this patch? Or scanner?
-Jason
Signature · 1 line
Everything I know about computers I learned from the Video Professor
Re: [Qemu-devel] [PATCH] parallel port support for qemu.
Quoted 3 lines · Jason Turner
It's been very long since I have used one of the anti-piracy dongles, but I'm guessing it would work with my patch, or at least could be made to without much more work.
the question is: does linux parallel port module support all of magic tricks used by dongle drivers to make parallel port work with several devices connected (dongles and printer)?
Quoted 2 lines
Does anyone out there have a parallel port printer they could test with this patch? Or scanner?
I've got a dongle and scanner (but I'm not sure if it still works).