MPConfig

Definitions


#include <revolution/mp.h>

typedef struct MPConfig
{
    void*       (*alloc)(u32 size);
    void        (*free) (void* ptr);

    OSPriority  threadPriority;

    u32         mode;

    u32         ggid;
    u32         tgid;
    u32         channel;

    s32         lifeTime;

    // for parent mode
    u32         beaconPeriod;
    u32         maxNodes;
    u32         parentMaxSize;
    u32         childMaxSize;
    s32         entryFlag;
    s32         multiBootFlag;

    s32         frequency;

    u32         userGameInfoLength;
    u8          userGameInfo[ MP_GAMEINFO_USER_SIZE_MAX ];

    // callback
    MPIndicationCallback indicationCallbackFunction;

    // portConfig
    MPPortConfig portConfig[MP_PORT_MAX];

} MPConfig;

Description

The MPConfig structure is used to store the MP communications configuration information.

Member Description
alloc Function to allocate memory for use inside the library. This memory region must be created in MEM2 so that the start position is aligned with a 32-byte boundary. Currently, memory is allocated by processing performed in MPStartup, using a fixed value of 65KB or less.
free Function to allocate memory for use inside the library.
threadPriority The priority level of the MPs working thread.
The MP library creates working threads with four levels of priority: threadPriority to threadPriority+3. To conduct MP communications in real time, you must specify a priority for the working thread that is higher than the priority of the main thread.
mode MP operation mode
Usually specified as MP_MODE_PARENT
ggid Game Group ID (GGID) provided by Nintendo for each title with MP communications capability.
tgid 16-bit ID that must be generated each time a parent is started.
An appropriate value is automatically assigned to MP_TGID_AUTO.
channel The wireless channel that will be used.
Normally you specify MP_CHANNEL_AUTO, and the appropriate channel is selected automatically.
lifeTime Time limit for disconnecting if no communication is received. Specified in milliseconds.
If 0 is specified, the lifetime feature is disabled.
Normally, MP_LIFETIME_DEFAULT (4000) is specified.
beaconPeriod The beacon period (in milliseconds).
Normally you specify MP_BEACON_PERIOD_AUTO to create and set an appropriate value.
maxNodes Maximum number of child devices that can connect (up to 15)
parentMaxSize Maximum send size for the parent device. (See the NITRO-SDK documentation for more on limitations here.)
childMaxSize Maximum send size for the child device. (See the NITRO-SDK documentation for more on limitations here.)
entryFlag 1, if child connections are allowed; otherwise, 0
This can be changed after communication has started using the MPSetEntryFlag() function.
multiBootFlag Must normally be set to 0 for the parent device.
frequency Represents the number of MP communications performed during a 16.7ms time interval (0 indicates continuous communication)
1 is recommended for ordinary communication applications.
userGameInfoLength Length of the user region within GameInfo to be included on the beacon
MP_GAMEINFO_USER_SIZE (112 bytes) or less
userGameInfo Data for the user region within GameInfo to be included on the beacon
indicationCallbackFunction Callback for notification of indication
This callback can be set using MPSetIndicationConfig().
portConfig Receive callback for port.
This callback can be set using MPSetPortConfig().

See Also

MPStartup(), MPSetIndicationConfig(), MPSetPortConfig(), MPPortConfig

Revision History

2007/10/26 Added text to clarify the priority of internally generated threads.
2007/10/04 Changed the required memory size from 32k to 64k.
2007/10/04 Added a description of MP_BEACON_PERIOD_AUTO to beaconPeriod.
2007/05/02 Added a description of MP_CHANNEL_AUTO to channel.
2006/11/23 Added a description of the memory size allocated by alloc.
2006/11/21 Added information regarding the 32-byte boundary restriction.
2006/11/13 Added description of MEM2 limitation on alloc.
2006/06/29 Initial version.


CONFIDENTIAL