1d930a884804d3cc190844b5f6b4ab4cf2e37ffc
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
;
53 strncasecmp(str1
, str2
, len
)
59 for (; len
!= 0; --len
)
64 if (toupper(c1
) != toupper(c2
))
65 return toupper(c1
) - toupper(c2
);
77 return (char *)((unsigned)async
- OFFSET
+ p
);
85 if (peek(0, which
*4) != OFFSET
)
88 a
= (ASYNC_STRUCT
*)(0xe0000000 + peek(0, which
*4+2)*16 + peek(0, which
*4));
90 if (a
->signature
!= SIGNATURE
)
93 if (a
->version
!= VERSION
)
108 async
= getivec (12);
111 async
= getivec (11);
119 error("GDB can not connect to asynctsr program, check that it is installed\n\
120 and that serial I/O is not being redirected (perhaps by NFS)\n\n\
121 example configuration:\n\
122 C> mode com2:9600,n,8,1,p\n\
129 outportb(com_ier
, 0x0f);
130 outportb(com_bfr
, 0x03);
131 outportb(com_mcr
, 0x0b);
132 async
->getp
= async
->putp
= async
->buffer_start
;
141 while (~inportb(com_lsr
) & 0x20);
149 return (async
->getp
!= async
->putp
);
157 while (!dos_async_ready())
164 rv
= *aptr(async
->getp
++);
165 if (async
->getp
>= async
->buffer_end
)
166 async
->getp
= async
->buffer_start
;
172 dosasync_read (fd
, buf
, len
, timeout
)
182 then
= now
+ timeout
;
188 while (!dos_async_ready())
195 *buf
++ = dos_async_rx();
202 dosasync_write(fd
, buf
, len
)
210 dos_async_tx (*buf
++);
216 go32_open (scb
, name
)
222 if (strncasecmp (name
, "com", 3) != 0)
228 port
= name
[3] - '0';
230 if ((port
!= 1) && (port
!= 2))
236 scb
->fd
= dos_async_init(port
);
247 /* Always in raw mode */
251 go32_readchar (scb
, timeout
)
257 if (dosasync_read(scb
->fd
, &buf
, 1, timeout
))
260 return SERIAL_TIMEOUT
;
264 go32_setbaudrate (scb
, rate
)
272 go32_write (scb
, str
, len
)
277 dosasync_write(scb
->fd
, str
, len
);
293 static struct serial_ops go32_ops
=
306 _initialize_ser_go32 ()
308 serial_add_interface (&go32_ops
);
This page took 0.03548 seconds and 4 git commands to generate.