# WM_StartMP

## C Specification

      #include <nitro/wm.h>

      WMErrCode WM_StartMP(
              WMCallbackFunc  callback ,
              WMMpRecvBuf*    recvBuf ,
              u16             recvBufSize ,
              u16*            sendBuf ,
              u16             sendBufSize ,
              u16             mpFreq );

## Description

Begins the MP mode

This function is only executable when the WM is in either the `PARENT` or `CHILD` state.

If the return value is `WM_ERRCODE_OPERATING`, a callback is generated after the MP mode change process is complete. The WM state changes to the appropriate `MP_PARENT` or `MP_CHILD` state.

A callback is also generated when data is received through MP communication or when MP communication is complete. After entering the MP communication mode, the V-Blank synchronization process is executed automatically between connected devices.

MP communication is attempted in each frame for the number of times that is specified by `mpFreq`. The number of attempts is not guaranteed and is dependent on the communication status. The maximum number of MP communication attempts that occur during a each frame varies with each communication parameter.

`WM_StartMPEx` is a function that has similar features to `WM_StartMP` function. However, the use of the `WM_StartMP` function should be sufficient under normal circumstances.

call `WM_StartMP` immediately after an MP communication child connects to a parent using the `WM_StartConnect` function. From the time the connection is established until `WM_StartMP` is called, the child returns NULL to the parent. When this status exceeds the MP communication lifetime set with `WM_SetLifeTime`, the child is disconnected from the parent. Note that when sending data from a parent to the child in this state with MP communication, the parent receives the send successful notice, but the child discards all the received data.

## Arguments

`callback` | Callback function that is called when asynchronous processing sends a notification and when asynchronous processing is complete.
`recvBuf` | Receive data storage buffer that the SDK uses internally. This value must be aligned to the 32-byte boundary. Because the ARM7 processor writes directly to the buffer, be careful of coherency with the cache.
`recvBufSize` | Size of the buffer that stores received data. This value must be larger than the return value of `WM_GetMPReceiveBufferSize`. This value must also be in multiples of 64 bytes.
`sendBuf` | Send data storage buffer that the SDK uses internally. It needs to be aligned to the 32-byte boundary. Because the ARM7 processor writes directly to the buffer, be careful of coherency with the cache.
`sendBufSize` | Send data storage buffer size that the SDK uses internally. This value must be larger than the return value of `WM_GetMPReceiveBufferSize`. This value must also be in multiples of 32 bytes.
`mpFreq` | Frequency of MP communication per frame. If "0" is specified, the device enters the continuous communication mode. The continuous communication mode is designed for high-volume data communication.

## Return Values

Returns the process result as a `WMErrCode` enumerated type.

## See Also

`WM_StartMPEx`, `WM_EndMP`, `WM_SetMPDataToPort`, `WM_SetPortCallback`

## Revision History

11/09/2004 Added text regarding a Null response.
10/22/2004 Changed return value type.
09/25/2004 Added and revised descriptions.
08/18/2004 Added the `sendBuf`, `sendBufSize`, and `mpFreq` arguments.
08/11/2004 Added description on the callback upon the completion of the MP communications.
08/02/2004 Standardized structure names.
07/29/2004 Added descriptions.
07/23/2004 Initial version.