mspReleaseBuffer

Returns an event buffer to the MSPP service library.

Prototype

DWORD mspReleaseBuffer ( MSPHD msphd, void *buffer )

Argument

Description

msphd

MSPP handle associated with the channel or endpoint that sent the data buffer.

buffer

Address of the buffer to be released.


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

A function argument includes an invalid value or a required pointer argument is NULL.

CTAERR_INVALID_CTAHD

The handle is invalid.

CTAERR_INVALID_HANDLE

An invalid handle was passed as an argument to this function.

MSPERR_DRIVER_COMMAND_FAILED

An SPI command has failed.

MSPERR_ENDPOINT_NOT_ALLOCATED

The MSPP endpoint is defined, but not yet allocated on the board.

MSPERR_INVALID_HANDLE

The specified MSPP endpoint/channel is not valid.


Events

None.

Details

This function returns retrieved event buffers so the application can reuse them.

If an application uses an endpoint or a channel with an attached buffer, but does not return the buffer (through mspReleaseBuffer), the number of events received is limited to ten. Subsequent events are dropped.

Note: If the application tries to call mspReleaseBuffer twice for the same buffer, this creates an access violation.

See also

mspSendQuery, mspSendCommand

Example

if(Event.size != 0 && Event.buffer != NULL  )
{
    ret = mspReleaseBuffer( Event.objHd, Event.buffer);
    Event.buffer = NULL;
    Event.size = 0;

    if ( ret != SUCCESS)
        return FAILURE;

}