# WM_StartMP

## C Specification

      #include <nitro/wm.h>

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

## Arguments

`callback` | Specifies the callback function to be called when the notification of the status for the asynchronous process is sent or when the asynchronous process completes. This callback is called from within the interrupt handler.
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. 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.
sendBufSize | Send data storage buffer size that the SDK uses internally. This value must be larger than the return value of `WM_GetMPSendBufferSize`. This value must also be in multiples of 32 bytes.
mpFreq | Specifies how many times to perform MP communications in one frame. If "0" is specified, the device enters the continuous communication mode.

## Return Values

Returns the results of the `WMErrCode` enumerated type process.

## Description

Begins the MP mode This function can be executed only if the WM is in either the PARENT state or the 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.

When a child performs MP communication, call `WM_StartMP` soon after the child connects to a parent using `WM_StartConnect`. From the time the connection is established until `WM_StartMP` is called, the child does not respond to messages sent by the parent. When this status exceeds the CAM communication lifetime set by `WM_SetLifeTime`, the child is disconnected from the parent.

Also, do not continually call the WM_EndMP function and the WM_StartMP function while connected with the goal of changing the MP communications parameters. MP communications internal information, such as Sequential communications information, will be initialized, so the consistency of communications before and afterwards will be lost.
In order to change specific MP communications parameters such as MP communication frequency during MP communications, it is possible to use functions such as WM_SetMPFrequency and WM_SetMPParameter.

## See Also

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

## Revision History

07/29/2005 Revised code in line with changes to conditions which cause a NULL response.
06/08/2005 Added statement about callbacks being called from the interrupt handler.
11/09/2004 Added text regarding a Null response.
10/22/2004 Changed return value type.
09/25/2004 Added and revised Description.
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 to Description
07/23/2004 Initial version.

CONFIDENTIAL