osPfsInit.3p
2.52 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.TH osPfsInit 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
osPfsInit \- Initialized the file system for the new plugged-in CONTROLLER PAK
.SH SYNOPSIS
.nf
\f3
.Op c
#include <ultra64.h>
.sp .8v
s32 osPfsInit(OSMesgQueue \(**mq, OSPfs \(**pfs, int controller_no);
.Op
\f1
.fi
.SH DESCRIPTION
A PFS file system is reside on a CONTROLLER PAK.
The CONTROLLER PAK is divided into a certain number of 32-bytes blocks. The
current maximum size limit of a PFS file system is 64K bytes.
.sp
An
.I OSPfs
data structure acts as a handle by which an individual file system is referenced
by the file system routines. The
.I osPfsInit
function initializes this structure. The
.I controller_no
specifies the controller where the CONTROLLER PAK is plugged-in.
The message queue
.I mq
must be an initialized message queue associated with the
.I OS_EVENT_SI
event.
See
.IR osSetEventMesg (3P)
for details on how to create this association.
Since the
.I osPfsInit
routine will wait on the message queue
.I mq,
this queue must not be shared.
In addition, it is required that
.IR osContInit (3P)
must be called to initialize the low level synchronization before osPfsInit can be called.
.sp
A value of 0 is returned if the calls succeed, otherwise
one of the following error code is returned.
.PP
.nf
.ta 5 24
PFS_ERR_NOPACK No CONTROLLER PAK is plugged in the specified
controller.
.sp
PFS_ERR_ID_FATAL The CONTROLLER PAK which is plugged in the
specified controller is dead.
.sp
PFS_ERR_DEVICE The device which is plugged in the specified
controller is not a CONTROLLER PAK.
.sp
PFS_ERR_CONTRFAIL The controller sends data at higher data
transfer rate than the hardware handling
capability or the hardware CRC error occurs.
.fi
.SH EXAMPLE
.nf
.ta 5 18
main()
{
OSMesgQueue intMesgQueue;
OSMesg intMesgBuf[1];
OSContStatus sdata[MAXCONTROLLERS];
u8 cont_pattern, pak_pattern;
OSPfs pfs[MAXCONTROLLERS];
.sp
osCreateMesgQueue(&intMesgQueue, intMesgBuf, 1);
osSetEventMesg(OS_EVENT_SI, &intMesgQueue, dummyMessage);
osContInit(&intMesgQueue, &cont_pattern, &sdata[0]);
osPfsIsPlug(&intMesgQueue, &pak_pattern);
for (i = 0; i < MAXCONTROLLERS; i++) {
if (pak_pattern & (1<<i)){
ret = osPfsInit(&pifMesgQueue, &pfs[i], i);
}
if ((ret == PFS_ERR_ID_FATAL) ||(ret == PFS_ERR_DEVICE))
pak_pattern &= ~(1<<i);
}
}
.fi
.SH "SEE ALSO"
osContInit (3P),
osPfsAllocateFile (3P),
osPfsChecker (3P),
osPfsFileState (3P),
osPfsFreeBlocks (3P),
osPfsIsPlug (3P),
osPfsReSizeFile (3P),
osPfsReadWriteFile (3P),
osPfsSetLabel (3P)