Commit | Line | Data |
---|---|---|
3a9c3d12 NC |
1 | /* |
2 | * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved. | |
3 | * | |
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 | |
6 | * software. | |
7 | */ | |
8 | ||
9 | /* | |
10 | * Host C library support header file. | |
11 | * | |
12 | * $Revision$ | |
13 | * $Date$ | |
14 | * | |
15 | */ | |
16 | ||
17 | #ifndef angsd_hsys_h | |
18 | #define angsd_hsys_h | |
19 | ||
20 | #define HSYS_FOPEN_MAX 256 | |
21 | #define NONHANDLE -1 | |
22 | #define UNIQUETEMPS 256 | |
23 | ||
24 | #include "dbg_hif.h" | |
25 | #include "hostchan.h" | |
26 | ||
27 | typedef struct { | |
28 | FILE *FileTable[HSYS_FOPEN_MAX] ; | |
29 | char FileFlags[HSYS_FOPEN_MAX] ; | |
30 | char *TempNames[UNIQUETEMPS]; | |
31 | } OSblock; | |
32 | ||
33 | #define NOOP 0 | |
34 | #define BINARY 1 | |
35 | #define READOP 2 | |
36 | #define WRITEOP 4 | |
37 | ||
38 | typedef struct { | |
39 | const struct Dbg_HostosInterface *hostif; /* Interface to debug toolkit. */ | |
40 | int last_errno; /* Number of the last error. */ | |
41 | OSblock *OSptr; | |
42 | char **CommandLine ; /* Ptr to cmd line d`string held by ardi.c */ | |
43 | } hsys_state; | |
44 | ||
45 | /* | |
46 | * Function: HostSysInit | |
47 | * Purpose: Set up the state block, filetable and register the and C lib | |
48 | * callback fn | |
49 | * | |
50 | * Params: | |
51 | * Input: hostif, the host interface from the debug toolbox | |
52 | * cmdline, the command line used to call the image | |
53 | * state, the status block for the C lib | |
54 | * | |
55 | * Returns: | |
56 | * OK: an RDIError_* valuee | |
57 | */ | |
58 | extern int HostSysInit( | |
59 | const struct Dbg_HostosInterface *hostif, char **cmdline, hsys_state **state | |
60 | ); | |
61 | ||
62 | /* | |
63 | * Function: HostSysExit | |
64 | * Purpose: Close down the host side C library support | |
65 | * | |
66 | * Params: | |
67 | * Input: hstate, the status block for the C lib | |
68 | * | |
69 | * Returns: an RDIError_* valuee | |
70 | */ | |
71 | extern int HostSysExit(hsys_state *hstate); | |
72 | ||
73 | /* | |
74 | * Function: HandleSysMessage | |
75 | * Purpose: Handle an incoming C library message as a callback | |
76 | * | |
77 | * Params: | |
78 | * Input: packet is the incoming data packet as described in devsw.h | |
79 | * hstate, the status block for the C lib | |
80 | * | |
81 | * Returns: an RDIError_* valuee | |
82 | */ | |
83 | extern int HandleSysMessage(Packet *packet, hsys_state* stateptr); | |
84 | ||
85 | /* | |
86 | * Function: panic | |
87 | * Purpose: Print a fatal error message | |
88 | * | |
89 | * Params: | |
90 | * Input: format printf() style message describing the problem | |
91 | * ... extra arguments for printf(). | |
92 | * | |
93 | * Returns: This routine does not return | |
94 | * | |
95 | * Post-conditions: Will have called exit(1); | |
96 | */ | |
97 | extern void panic(const char *format, ...); | |
98 | ||
99 | #endif /* ndef angsd_hsys_h */ | |
100 | ||
101 | /* EOF hsys.h */ |