# mspDestroyEndpoint

Destroys a specified MSPP endpoint.

#### Prototype

DWORD mspDestroyEndpoint ( MSPHD ephd )

Argument | Description
ephd | MSPP endpoint handle.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | Function argument includes an invalid value or a required pointer argument is NULL.
CTAERR_INVALID_CTAHD | Handle is invalid.
CTAERR_INVALID_HANDLE | An invalid handle was passed as an argument to this function.
MSPERR_DRIVER_COMMAND_FAILED | SPI command has failed.
MSPERR_ENDPOINT_NOT_ALLOCATED | MSPP endpoint is defined, but not yet allocated on the board.
MSPERR_INVALID_HANDLE | Specified MSPP endpoint is not valid.

#### Events

Event | Description
MSPEVN_DESTROY_ENDPOINT_DONE | Generated when an MSPP endpoint is destroyed following a call to mspDestroyEndpoint. The event.value field can contain the following: CTA_REASON_FINISHED MSPRSN_FAILED_TO_DEALLOCATE MSPP service is unable to deallocate on-board resources. The event.objHd indicates the ephd of the destroyed endpoint.

#### Details

When called, mspDestroyEndpoint destroys a specified MSPP endpoint, and disables and disconnects the associated connection, if applicable. For more information, refer to Disabling and enabling MSPP endpoints.

#### See also

mspCreateEndpoint, mspDisableEndpoint

#### Example

ret = mspDestroyEndpoint(hEp);
if (ret != SUCCESS)
return FAILURE;
// Wait for event
ctaWaitEvent( hCtaQueHd, &Event, CTA_WAIT_FOREVER );
// Check the reason code
if ( Event.id != MSPEVN_DESTROY_ENDPOINT_DONE ||
Event.value != CTA_REASON_FINISHED )
return FAILURE;