edfe4b44ee31972c68d1ed6b213dd2bd45a6de33
1 /* Remote serial interface for local (hardwired) serial ports for GO32.
2 Copyright 1992, 1993 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
24 #define SIGNATURE 0x4154
28 #define peek(a,b) (*(unsigned short *)(0xe0000000 + (a)*16 + (b)))
41 static ASYNC_STRUCT
*async
;
58 return (char *)((unsigned)async
- OFFSET
+ p
);
66 if (peek(0, which
*4) != OFFSET
)
68 a
= (ASYNC_STRUCT
*)(0xe0000000 + peek(0, which
*4+2)*16 + peek(0, which
*4));
70 if (a
->signature
!= SIGNATURE
)
72 if (a
->version
!= VERSION
)
102 error("GDB can not connect to asynctsr program, check that it is installed\n\
103 and that serial I/O is not being redirected (perhaps by NFS)\n\n\
104 example configuration:\n\
105 C> mode com2:9600,n,8,1,p\n\
112 outportb(com_ier
, 0x0f);
113 outportb(com_bfr
, 0x03);
114 outportb(com_mcr
, 0x0b);
115 async
->getp
= async
->putp
= async
->buffer_start
;
127 while (~inportb(com_lsr
) & 0x20);
135 return (async
->getp
!= async
->putp
);
143 while (!dos_async_ready())
150 rv
= *aptr(async
->getp
++);
151 if (async
->getp
>= async
->buffer_end
)
152 async
->getp
= async
->buffer_start
;
158 dosasync_read (fd
, buf
, len
, timeout
)
168 then
= now
+ timeout
;
174 while (!dos_async_ready())
181 *buf
++ = dos_async_rx();
188 dosasync_write(fd
, buf
, len
)
196 dos_async_tx (*buf
++);
202 go32_open (scb
, name
)
206 scb
->fd
= dos_async_init();
217 /* Always in raw mode */
221 go32_readchar (scb
, timeout
)
227 if (dosasync_read(scb
->fd
, &buf
, 1, timeout
))
230 return -2; /* Timeout, I guess */
234 go32_setbaudrate (scb
, rate
)
242 go32_write (scb
, str
, len
)
247 dosasync_write(scb
->fd
, str
, len
);
261 static struct serial_ops go32_ops
=
274 _initialize_ser_go32 ()
276 serial_add_interface (&go32_ops
);