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





osPfsIsPlug

Syntax

#include <ultra64.h>
s32 osPfsIsPlug(OSMesqQueue *mq, u8 *bitpattern);

Explanation
It detects which Controller contains a Controller Pak, and it returns the results as a bit pattern to the location pointed to by the bitpattern argument. Bits 0, 1, 2, and 3 of the bit pattern correspond to Controllers 0, 1, 2, and 3, respectively.

The message queue specified by the mq argument must be the initialization completion message waiting line associated with the OS_EVENT_SI event. For information on how to make this association, please see osSetEventMesg.

Because mq is used by the function as an internal message queue, it is not necessary for the application to use mq for purposes such as queuing function-termination messages.

If the function is successfully called, a 0 is returned. Otherwise, 1 is returned.

Example

main()
{
OSMesgQueue intMesgQueue;
OSMesg intMesgBuf[1];
OSContStatus sdata[MAXCONTROLLERS];
u8 cont_pattern;
u8 pak_pattern;

osCreateMesgQueue(
osSetEventMesg(OS_EVENT_SI, 
osContInit(
osPfsIsPlug(
}
Notes
In addition to osPfsIsPlug, the following functions can be used to check the status of the Controller Pak: There are, however, differences. The osPfsIsPlug function issues a request command that checks the status of the Controller and Controller Pak. It checks all Controller sockets, converts the results to a bit pattern, and returns them.

In contrast, osPfsInitPak performs processing for only a single Controller. In addition to performing the Controller and Controller Pak status check that osPfsIsPlug performs, it also performs processing such as initializing the OSPfs structure, acquiring the Controller Pak ID and label areas, and calling the osPfsChecker function. As a result, it is very time consuming to call osPfsInitPak to determine whether the Controller Pak is inserted.

For simple status checking, the fastest approach is to use osContStartQuery and osContGetQuery. These functions perform the same processing as the osPfsIsPlug function does and they simplify the error checking process. osPfsIsPlug is a general-purpose function for all SI devices and can therefore also take parameters other than those used to detect whether a Pak-type SI device has been inserted. osPfsIsPlug should not be overused; osContStartQuery and osContGetQuery should be used instead whenever possible.

See Also
osPfsInitPak
osPfsAllocateFile
osPfsChecker
osPfsFileState
osPfsFreeBlocks
osPfsReadWriteFile
osPfsSetLabel
osPfsRepairId

Revision History
2/1/1999 Revised entirely





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 March 1998