NNS_McsRegisterRecvCallback

Syntax

#include <nnsys/mcs.h>
void NNS_McsRegisterRecvCallback(
         NNSMcsRecvCBInfo*   pInfo,
         u16                 channel,
         NNSMcsRecvCallback  cbFunc,
         u32                 userData);

Arguments

pInfo Pointer to the structure holding the callback function's information.
channel Value for identifying a stream. Specify in the range of 0 to 0x3FFF. The range of 0x4000 to 0x7FFF is reserved for TWL-System applications. The range of 0x8000 to 0xFFFF is reserved for the MCS system.
cbFunc Callback function to register.
userData Arbitrary user-specified value.

Return Values

None.

Description

Registers the function to be called back when data is received

Type NNSMcsRecvCallback of cbFunc is defined as the following. The definition of the function to register is shown below.

typedef void (*NNSMcsRecvCallback)(
                   const void* recv,
                   u32         recvSize,
                   u32         userData,
                   u32         offset,
u32         totalSize);
recv Pointer to the buffer that stores either a portion of the received data or all of it.
recvSize Size of the data that is stored in the buffer indicated by recv.
userData Value specified with the argument userData of the NNS_McsRegisterRecvCallback function.
offset If all of the received data is stored in the buffer that is indicated by recv, this argument is 0.
If only a portion of the received data is stored, this argument is its offset location, with 0 (corresponding to the entirety of the received data) taken as the baseline.
totalSize Total size of the received data.

If the received data is large, it is broken into portions, and the callback function is called multiple times. In this situation, the buffer indicated by recv stores a portion of the data, and offset holds the offset value of the stored portion from the entirety of the data. The total size of the entire received data is always held in totalSize.

Do not send or receive data from inside the callback function to register. In addition, do not perform a wait-for-interrupt loop because interrupts are sometimes prohibited.

See Also

NNS_McsRegisterStreamRecvBuffer
NNS_McsUnregisterRecvResource

Revision History

2006/08/20 Changed NITRO-System to TWL-System.
2004/11/29 Added the description of the callback function.
2004/10/08 Added a description of the channel argument. Added NNS_McsUnregisterRecvResource in See Also.
2004/08/26 Changed the type of the channel argument.
2004/06/01 Initial version.


CONFIDENTIAL