osViSetEvent osViSetEvent (function)

Registers a vertical synchronization event message in the VI manager

Syntax

#include <ultra64.h>        /* os.h */
void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount);

Arguments

mq
Message queue address
msg
Message announced when vertical retrace occurs
retraceCount
Retrace count

Return Value

None.

Description

This function registers the specified message queue and message in the VI manager. The program can thus receive the message (msg) announced by the message queue (mq)) from the VI manager when a vertical retrace occurs. The send cycle for the message is changed according to the value set in the retrace count (retraceCount). For instance, while the cycle is 60Hz when this is set to 1, it becomes a low speed 30Hz when it is set to 2, decreasing the frequency at which the application receives the vertical retrace announcement (message send cycle = 60Hz/retrace count).

Precautions

Execute this function after setting the display mode (see osViSetMode).

Example

//      Define message queue
OSMesgQueue     MessageQueue;
OSMesg          MessageBuffer[1];

//      Initialize message queue
osCreateMesgQueue(&MessageQueue,&MessageBuffer[0],1);
osViSetEvent(&MessageQueue,(OSMesg)NULL,1);

--------------------------------------------------------------------------------------

//      Synchronize vertical retrace interrupt
if (MessageQueue.validCount) osRecvMesg(&MessageQueue,(OSMesg *)NULL,OS_MESG_BLOCK);
osRecvMesg(&MessageQueue,NULL,OS_MESG_BLOCK);

See Also

osCreateViManager, osSetEventMesg

Revision History

02/01/99 Completely revised.