提交 81174dae 编写于 作者: A aliguori

Upgrade emulated UART to 16550A (Stefano Stabellini)

This patch upgrades the emulated UART to 16550A, the code comes from
xen-unstable. The main improvement was introduced with the following patch and
subsequent email thread:

http://lists.xensource.com/archives/html/xen-devel/2007-12/msg00129.html

The changes compared to previous version are:

- change clock_gettime to qemu_get_clock

- no token bucket anymore;

- fixed a small bug handling IRQs; this was the problem that prevented
kgdb to work over the serial (thanks to Jason Wessel for the help
spotting and reproducing this bug).

- many many style fixes;

- savevm version number increased;

- not including termios.h and sys/ioctl.h anymore, declaring static
constants in qemu-char.h instead;
Signed-off-by: NStefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4993 c046a42c-6fe2-441c-8c8c-71466251a162
上级 06057e6f
此差异已折叠。
......@@ -28,6 +28,16 @@ typedef struct {
#define CHR_IOCTL_PP_EPP_WRITE_ADDR 10
#define CHR_IOCTL_PP_EPP_WRITE 11
#define CHR_IOCTL_SERIAL_SET_TIOCM 12
#define CHR_IOCTL_SERIAL_GET_TIOCM 13
#define CHR_TIOCM_CTS 0x020
#define CHR_TIOCM_CAR 0x040
#define CHR_TIOCM_DSR 0x100
#define CHR_TIOCM_RI 0x080
#define CHR_TIOCM_DTR 0x002
#define CHR_TIOCM_RTS 0x004
typedef void IOEventHandler(void *opaque, int event);
struct CharDriverState {
......
......@@ -2721,6 +2721,37 @@ static int tty_serial_ioctl(CharDriverState *chr, int cmd, void *arg)
tcsendbreak(s->fd_in, 1);
}
break;
case CHR_IOCTL_SERIAL_GET_TIOCM:
{
int sarg = 0;
int *targ = (int *)arg;
ioctl(s->fd_in, TIOCMGET, &sarg);
*targ = 0;
if (sarg | TIOCM_CTS)
*targ |= CHR_TIOCM_CTS;
if (sarg | TIOCM_CAR)
*targ |= CHR_TIOCM_CAR;
if (sarg | TIOCM_DSR)
*targ |= CHR_TIOCM_DSR;
if (sarg | TIOCM_RI)
*targ |= CHR_TIOCM_RI;
if (sarg | TIOCM_DTR)
*targ |= CHR_TIOCM_DTR;
if (sarg | TIOCM_RTS)
*targ |= CHR_TIOCM_RTS;
}
break;
case CHR_IOCTL_SERIAL_SET_TIOCM:
{
int sarg = *(int *)arg;
int targ = 0;
if (sarg | CHR_TIOCM_DTR)
targ |= TIOCM_DTR;
if (sarg | CHR_TIOCM_RTS)
targ |= TIOCM_RTS;
ioctl(s->fd_in, TIOCMSET, &targ);
}
break;
default:
return -ENOTSUP;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册