N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

   

osPfsInit

Format
#include <ultra64.h>
s32 osPfsInit(OSMesgQueue *mq, OSPfs *pfs, int controller_no);


What This Function Does
It initializes the Controller Pak file handle.

Warning: Please use osPfsInitPak instead of this function.

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 line 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 the function is successfully called, 0 is returned as the return value. If an error occurs, the following error code is returned:
  • PFS_ERR_NOPACK - A Controller Pak was not inserted into the specified Controller, or the Controller Pak was not inserted, or some other such Plf error occurred. To determine the type of error, use a function such as ocContStartQuery.
Example
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);
   }
}
See Also
osContInit
osContStartQuery
osContGetQuery
osPfsInitPak



Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.


Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998