2 #include "alpha-patch.h"
8 /* This file provides stubs and equivalent interfaces for all functions that
9 the debugger stub needs, but aren't yet implemented. */
12 AIOReadData (int portHandle
, char *buffer
, LONG length
, LONG
*numberBytesRead
)
19 if ((c
& ~0377) == COM1
)
30 AIOWriteData (int portHandle
, char *buffer
, LONG length
,
31 LONG
*numberBytesWritten
)
34 *numberBytesWritten
= length
;
37 uart_putchar (COM1
, *buffer
++);
43 AIOAcquirePort (int *hardwareType
, int *boardNumber
, int *portNumber
,
50 AIOConfigurePort (int portHandle
, BYTE bitRate
, BYTE dataBits
, BYTE stopBits
,
51 BYTE parityMode
, BYTE flowCtrlMode
)
53 uart_init_line (1, 9600);
59 AIOGetPortConfiguration (int portHandle
, AIOPORTCONFIG
*pPortConfig
,
60 AIODVRCONFIG
*pDvrConfig
)
62 fprintf (stderr
, "AIOGetPortConfiguration stubbed out\n");
67 AIOReleasePort (int portHandle
)
73 AIOSetExternalControl (int portHandle
, int requestType
, int requestValue
)
79 AIOGetExternalStatus (int portHandle
, LONG
*extStatus
, LONG
*chgdExtStatus
)
81 fprintf (stderr
, "AIOGetExternalStatus stubbed out\n");
91 Breakpoint (int __arg
)
93 fprintf (stderr
, "Breakpoint() stubbed out\n");
98 * strtol : convert a string to long.
100 * Andy Wilson, 2-Oct-89.
103 /* FIXME: It'd be nice to configure around these, but the include files are too
104 painful. These macros should at least be more portable than hardwired hex
107 #define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */
108 #define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF */
109 #define LONG_MIN ((long)(~LONG_MAX)) /* 0x80000000 */
115 CONST
char *s
; char **ptr
; int base
;
117 extern unsigned long strtoul();
120 CONST
char *start
=s
, *eptr
;
126 *ptr
= (char *)start
;
139 * let strtoul do the hard work.
141 tmp
= strtoul(s
, &eptr
, base
);
143 *ptr
= (char *)((eptr
==s
) ? (char *)start
: eptr
);
144 if (tmp
> (minus
? - (unsigned long) LONG_MIN
: (unsigned long) LONG_MAX
))
147 return (minus
? LONG_MIN
: LONG_MAX
);
149 return (minus
? (long) -tmp
: (long) tmp
);
153 * strtol : convert a string to long.
155 * Andy Wilson, 2-Oct-89.
159 #define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF */
165 strtoul(s
, ptr
, base
)
166 CONST
char *s
; char **ptr
; int base
;
168 unsigned long total
= 0;
171 int did_conversion
=0;
174 unsigned long maxdiv
, maxrem
;
180 *ptr
= (char *)start
;
190 if (base
==0 || base
==16) /* the 'base==16' is for handling 0x */
195 * try to infer base from the string
198 tmp
= 10; /* doesn't start with 0 - assume decimal */
199 else if (s
[1] == 'X' || s
[1] == 'x')
200 tmp
= 16, s
+= 2; /* starts with 0x or 0X - hence hex */
202 tmp
= 8; /* starts with 0 - hence octal */
207 maxdiv
= ULONG_MAX
/ base
;
208 maxrem
= ULONG_MAX
% base
;
210 while ((digit
= *s
) != '\0')
212 if (digit
>= '0' && digit
< ('0'+base
))
217 if (digit
>= 'a' && digit
< ('a'+(base
-10)))
218 digit
= digit
- 'a' + 10;
219 else if (digit
>= 'A' && digit
< ('A'+(base
-10)))
220 digit
= digit
- 'A' + 10;
228 || (total
== maxdiv
&& digit
> maxrem
))
230 total
= (total
* base
) + digit
;
241 *ptr
= (char *) ((did_conversion
) ? (char *)s
: (char *)start
);
242 return negate
? -total
: total
;