FMSW_RegisterStreamDispatch

This function registers a Custom Command handler routine to the HSM. When a custom request is sent to the HSM with a FM ID equal to the fmNumber, the Dispatch function is called.

The type FMSW_StreamDispatchFn_t is a pointer to a function like this following example:

int StreamDispatchHandler(FmMsgHandle token);

The token is an opaque handle value identifying the request. The same token must be passed to CL_Xxx() functions. After the Dispatch function returns the HSM will take the return value and send the return value and response buffer back to the caller.

This function is used when an FM exports a custom API. It is usually called from the startup() function.

Synopsis
#include <fmsw.h>
FMSW_STATUS FMSW_RegisterStreamDispatch(
FMSW_FmNumber_t fmNumber,
FMSW_StreamDispatchFn_t dispatch);
Input Parameters
fmNumber The FM identification number
dispatch Pointer on custom request handler function
Output Requirements

Return Value:

FMSW_OK The function was registered successfully
FMSW_BAD_POINTER The function pointer is invalid
FMSW_INSUFFICIENT_RESOURCES Not enough memory to complete operation
FMSW_BAD_FM_NUMBER The FM number is incorrect
FMSW_ALREADY REGISTERED A dispatch function was already registered