arcs.c
1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "arcs.h"
#include "romloader.h"
static char *arcsErrors[] = {
"no error", /* ESUCCESS */
"argument list too long", /* E2BIG */
"permission denied", /* EACCESS */
"resource temporarily unavailable", /* EAGAIN */
"bad file descriptor", /* EBADF */
"resource busy", /* EBUSY */
"bad addresss", /* EFAULT */
"invalid argument", /* EINVAL */
"IO error", /* EIO */
"is a directory", /* EISDIR */
"too many open files", /* EMFILE */
"too many links", /* EMLINK */
"filename too long", /* ENAMETOOLONG */
"no such device", /* ENODEV */
"no such file or directory", /* ENOENT */
"execute format error", /* ENOEXEC */
"not enough space", /* ENOMEM */
"no space left on device", /* ENOSPC */
"not a directory", /* ENOTDIR */
"no a tty", /* ENOTTY */
"media not loaded", /* ENXIO */
"read only filesystem", /* EROFS */
0, /* 22 */
0, /* 23 */
0, /* 24 */
0, /* 25 */
0, /* 26 */
0, /* 27 */
0, /* 28 */
0, /* 29 */
0, /* 30 */
"address not available", /* EADDRNOTAVAIL */
"timed out", /* ETIMEDOUT */
"connection closed", /* ECONNABORTED */
"could not connect to server", /* ENOCONNECT */
0
};
/*
* ARCS stubs for calling through the SPB firmware switch.
*/
long
_ArcsOpen(char *filename, _OpenMode mode, unsigned long *fd)
{
return(__TV->Open(filename, mode, fd));
}
long
_ArcsClose(unsigned long fd)
{
return(__TV->Close(fd));
}
long
_ArcsRead(unsigned long fd, void *buf, unsigned long n, unsigned long *cnt)
{
return(__TV->Read(fd, buf, n, cnt));
}
long
_ArcsWrite(unsigned long fd, void *buf, unsigned long n, unsigned long *cnt)
{
return(__TV->Write(fd, buf, n, cnt));
}
long
_ArcsLoad(char *path, unsigned long topaddr, unsigned long *execaddr,
unsigned long *lowaddr)
{
return(__TV->Load(path,topaddr,execaddr,lowaddr));
}
void
_ArcsPerror(long error, char *string)
{
printf("%s: %s\n", string, arcsErrors[error]);
}