# WM_SetMPDataToPort

## Syntax

      #include <nitro/wm.h>

      WMErrCode WM_SetMPDataToPort(
              WMCallbackFunc  callback ,
              const u16*      sendData,
              u16             sendDataSize ,
              u16             destBitmap ,
              u16             port ,
              u16             prio
      );

## Arguments

`callback` | Designates the callback function to call when the asynchronous process completes. This callback is called from within the interrupt handler.
`sendData` | Pointer to the data to be send-reserved. Notice that this data entity will be forcibly cached.
`sendDataSize` | The size of the send-reserved data.
`destBitmap` | Bitmap that indicates the AID of the send destination child. (enabled only for the parent).
`port` | The port number that sends data. Use a value from 0-15.
`prio` | Data send priority. Use a value from 0 (highest) through 3 (lowest).

## Return Values

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

## Description

Sets the data to be sent to the port that is specified by the MP. This function is only executable when the WM is in either the `MP PARENT` or `MP CHILD` state. If the return value is `WM_ERRCODE_OPERATING`, a callback is generated after the MP completes the data transmission process. Do not rewrite the buffer identified by `sendData` until the callback is called. Unlike the asynchronous functions of other wireless APIs, processing continues normally even if different function pointers are specified for callbacks when this API is called repeatedly without waiting for callbacks. However, the limit on consecutive calls without waiting for the callback is 32 times for all priority levels. If called more than 32 times, `WM_ERRCODE_SEND_QUEUE_FULL` is returned to the callback and execution fails.

Calling this function is the same as calling the `WM_SetMPDataToPortEx` function with `NULL` specified for `arg`.

## Notes

The `sendData` argument is forcibly stored in the internal cache. To avoid overwriting surrounding memory regions, be sure to pass data that is 32-byte aligned.
See the Wireless Communication Library Manual (AboutWirelessManager.pdf) for additional details.

## See Also

`WM_StartMP`
`WM_EndMP`
`WM_SetMPDataToPortEx`
`WM_SetPortCallback`
`WMPort`

## Revision History

2009/10/27 Explained the number of times the function can be called without waiting for the callback.
2008/12/17 Explained that data passed by argument is forcibly stored in a cache internally.
2005/07/08 Added the limit on consecutive asynchronous calls.
2005/06/08 Added the fact that the callback can be called from the interrupt handler.
2005/03/02 Added the range of values that can be specified for the port argument.
2004/10/22 Changed the type of the return value.
2004/09/25 Made additions and revisions to Description.
2004/09/09 Added a description of `WM_SetMPDataToPortEx`.
2004/08/11 Initial version.

CONFIDENTIAL