osPfsInit
Initializes the Controller Pak file handle
#include <ultra64.h> s32 osPfsInit(OSMesgQueue *mq, OSPfs *pfs, int controller_no);
Warning: Please use osPfsInitPak, instead of this (as of Feb 15, 1997).
A file system called PFS is used in the Controller Pak. This system is partitioned into 32-byte units and managed in units of this size. The maximum size of the PFS file system is currently 32K bytes.
When the PFS function is used to control the file system, the OSPfs structure pointed to by the pfs argument is used like a file handle to access files. This function (osPfsInit) initializes that OSpfs structure. The controller_no argument specifies the number of the controller (0-3) into which the Controller Pak is inserted. The message queue (mq) argument is the queue used while waiting for the message indicating that initialization is finished. It is associated with OS_EVENT_SI. For information on how to make this association, please see osSetEventMesg. Because the function (osPfsInit) waits internally for the message queue (mq), this queue must not be shared. In addition, because of synchronous initialization at a low level of the OS, you must call osContInit before calling this function (osPfsInit).
If this function is called successfully, 0 is returned. If an error occurs, one of the following error codes is returned:
main() { OSMesgQueue intMesgQueue; OSMesg intMesgBuf[1]; OSContStatus sdata[MAXCONTROLLERS]; u8 cont_pattern, pak_pattern; OSPfs pfs[MAXCONTROLLERS]; 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); } }
osContInit, osContStartQuery, osContGetQuery, and osPfsInitPak