2 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
4 * This software may be freely used, copied, modified, and distributed
5 * provided that the above copyright notice is preserved in all copies of the
10 ***********************************************************************
11 * Angel C Libary support channel protocol definitions
21 * Format of the "data" section of C Lib Support Channel Messages.
22 * You will notice that the format is much the same as the format
23 * of ADP messages - this is so that multi-threaded C Libraries can
26 * unsigned32 reason - Main C Library reason code.
27 * unsigned32 debugID - Info. describing host debug world;
28 * private to host and used in any target
30 * unsigned32 OSinfo1 \ Target OS information to identify process/thread
31 * unsigned32 OSinfo2 / world, etc. These two fields are target defined.
32 * byte args[n] - Data for message "reason" code.
34 * The "debugID" is defined by the host-end of the protocol, and is used
35 * by the host to ensure that messages are routed to the correct handler
36 * program/veneer (eg. imagine several threads having opened stdout and
37 * each writing to a different window in a windowed debugger).
39 * NOTE: The reason that there is no "size" information, is that the
40 * message IDs themselves encode the format of any arguments.
42 * For further discussion of the format see adp.h
44 * N.B. All streams are little endian.
48 * The message reason codes contain some information that ties them to
49 * the channel and direction that the message will be used with. This
50 * will ensure that even if the message "#define name" is not
51 * completely descriptive, the message reason code is.
53 * b31 = direction. 0=Host-to-Target; 1=Target-to-Host;
54 * b30-16 = reserved. should be zero
55 * b15-0 = message reason code.
57 * Note that typically a request will be initiated by the target side, and
58 * that the host will then respond with either an acknowledgement or some
59 * data. In either case the same reason code will be used, but the direction
60 * bit will be reveresed.
67 #define HtoT ((unsigned)0 << 31) /* Host-to-Target message */
68 #define TtoH ((unsigned)1 << 31) /* Target-to-Host message */
72 * The following are error codes used in the status field returned on
73 * sending a message. 0 represents no error having occurred, non-zero
74 * represents a general error. More codes should be added as required.
81 /*************************************************************************/
82 /* The following are direct conversions of the DeMon SWI's */
83 /* NB: nbytes is the number of bytes INCLUDING THE NULL character where */
86 /* This message is used as a response to a packet whose message
87 * was not understood. The return parameter, code is the reason
88 * code which was not understood. Although intended for use as a
89 * default case on a received message switch it can also be used
90 * as a proper message*/
91 #define CL_Unrecognised 0x00
96 /* Write a character to the terminal.
98 #define CL_WriteC 0x01
100 * return(word status)
103 /* Write a NULL terminated string of characters to the terminal. The length
104 * of the string excluding the NULL terminating character is passed in
107 #define CL_Write0 0x02
108 /* Write0(word nbytes, bytes data)
109 * return(word status)
112 /* Read a character from the terminal - probably the keyboard.
114 #define CL_ReadC 0x04
116 * return(word status, byte data)
119 /* Perform system call, pass NULL terminated string to host's command
120 * line interpreter(NOT AVAILABLE IN PC/DOS RELEASE). The data byte
121 * returned holds the return code from the system call.
123 #define CL_System 0x05
124 /* CLI(word nbytes, bytes data)
125 * return(word status, word data)
128 /* It returns the address of the null terminated command line string used to
129 * invoke the program. status will be set to NoError if the command line
130 * can be returned. Other status values will be treated as error conditions.
132 #define CL_GetCmdLine 0x10
134 * return(word status, word nbytes, bytes argline)
137 /* Return the number of centi-seconds since the support code began
138 * execution. Only the difference between successive calls can be
141 #define CL_Clock 0x61
143 * return(word status, word clks)
146 /* Return the number of seconds since the beginning of 1970.
150 * return(word status, word time)
153 /* Delete(remove, un-link, wipe, destroy) the file named by the
154 * NULL-terminated string 'name'.
156 #define CL_Remove 0x64
157 /* Remove(word nbytes, bytes name)
158 * return(word status)
161 /* Rename the file specified by the NULL-terminated string 'oname'
164 #define CL_Rename 0x65
165 /* Rename(word nbytes, bytes oname, word nbytes, bytes nname)
166 * return(word status)
169 /* 'name' specifies a NULL-terminated string containing a file name or a
170 * device name. Opens the file/device and returns a non-zero handle on
171 * success that can be quoted to CL_Close, CL_Read, CL_Write, CL_Seek,
172 * CL_Flen or CL_IsTTY. The mode is an integer in the range 0-11:-
174 * Mode: 0 1 2 3 4 5 6 7 8 9 10 11
175 * ANSI C fopen mode: r rb r+ r+b w wb w+ w+b a ab a+ a+b
177 * Values 12-15 are illegal. If 'name' is ":tt" the stdin/stdout is
178 * opened depending on whether 'mode' is read or write.
181 /* Open(word nbytes, bytes name, word mode)
182 * return(word handle)
185 /* 'handle' is a file handle previously returned by CL_Open. CL_Close
188 #define CL_Close 0x68
189 /* Close(word handle)
190 * return(word status)
193 /* Writes data of length nbytes to the file/device specified by
194 * handle. nbtotal represents the total number of bytes to be
195 * written, whereas nbytes is the number of bytes in this packet
197 * If nbtotal is <= DATASIZE - CL_Write message header size in the
198 * packet then nbytes = nbtotal and the number of bytes not written
199 * is returned. If nbtotal is > the packet size then the CL_Write
200 * must be followed by a number of CL_WriteX's to complete the write,
201 * the nbytes returned by CL_Write can be ignored
202 * If the status word returned is non zero, an error has occurred and
203 * the write request has been aborted.
206 #define CL_Write 0x69
207 /* Write(word handle, word nbtotal, word nbytes, bytes data)
208 * return(word status, word nbytes)
211 /* Write Extension is a reads a continuation of data from a CL_Write
212 * which was too big to fit in a single packet.
213 * nbytes is the number of bytes of data in this packet, the
214 * returned value of nbytes can be ignored except if it is the
215 * last packet, in which case it is the number of bytes that were NOT
218 #define CL_WriteX 0x6A
219 /* WriteX(word nbytes, bytes data)
220 * return(word status, word nbytes)
223 /* Reads 'nbytes' from the file/device specified by 'handle'.
225 * If nbytes <= DATASIZE then the read will occur in a single packet
226 * and the returned value of nbytes will be the number of bytes actually
227 * read and nbmore will be 0. If nbytes> DATASIZE then multiple packets
228 * will have to be used ie CL_Read followed by 1 or more CL_ReadX
229 * packets. In this case CL_Read will return nbytes read in the current
230 * packet and nbmore representing how many more bytes are expected to be
232 * If the status word is non zero then the request has completed with an
233 * error. If the status word is 0xFFFFFFFF (-1) then an EOF condition
237 /* Read(word handle, word nbytes)
238 * return(word status, word nbytes, word nbmore, bytes data)
241 /* Read eXtension returns a continuation of the data that was opened for
242 * read in the earlier CL_Read. The return value nbytes is the number of
243 * data bytes in the packet, nbmore is the number of bytes more that are
244 * expected to be read in subsequent packets.
246 #define CL_ReadX 0x6C
248 * return(word status, word nbytes, word nbmore, bytes data)
251 /* Seeks to byte position 'posn' in the file/device specified by 'handle'.
254 /* Seek(word handle, word posn)
255 * return(word status)
258 /* Returns the current length of the file specified by 'handle' in 'len'.
259 * If an error occurs 'len' is set to -1.
266 /* Returns NoError if 'handle' specifies an interactive device, otherwise
269 #define CL_IsTTY 0x6F
270 /* IsTTY(word handle)
271 * return(word status)
274 /* Returns a temporary host file name. The maximum length of a file name
275 * is passed to the host. The TargetID is some identifier from the target
276 * for this particular temporary filename. This value is could be used
277 * directly in the generation of the filename.
279 * If the host cannot create a suitable name or the generated name is too
280 * long then status is non zero. status will be NoError if the host can create
283 #define CL_TmpNam 0x70
284 /* TmpNam(word maxlength, word TargetID)
285 * return(word status, word nbytes, bytes fname)
288 /* Note there is no message for Exit, EnterOS, InstallHandler or
289 * GenerateError as these will be supported entirely at the host end,
290 * or by the underlying Operating system.
293 #define CL_UnknownReason (-1)
295 extern unsigned int GetRaiseHandler( void );
296 extern unsigned int SysLibraryHandler(unsigned int sysCode
, unsigned int *args
);
297 extern void angel_SysLibraryInit(void);
300 * Function: Angel_IsSysHandlerRunning
301 * Purpose: return whether or not SysLibraryHandler is running
305 * Returns 1 if SysLibraryHandler is running
308 extern int Angel_IsSysHandlerRunning(void);
311 /* This function exists in an ICEman2 system only, and can be called by
312 * debug support code when the debugger tells it how much memory the
313 * target has. This will then be used to deal with the HEAPINFO SWI
315 extern void angel_SetTopMem(unsigned addr
);
This page took 0.034844 seconds and 4 git commands to generate.