Functionality module dispatch switcher function

This section contains the firmware message dispatch management functions.

FMSW_RegisterDispatch

This function registers a FM API dispatch handler routine to the system. When a request is sent to the FM_NUMBER_CUSTOM_FM, the registered function is called.

The type FMSW_DispatchFn_t is a pointer to a function with the following declaration:

void DispatchHandler(uint32 token, void *reqBuffer, uint32 reqLength);
 

The token is an opaque handle value identifying the request. The same token must be passed to SVC_Xxx() functions.

The pair (reqBuffer, reqLength) defines the concatenated data that has been received on the request. See MD_SendReceive function for the details of request dispatching.

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_RegisterDispatch(
FMSW_FmNumber_t fmNumber,
FMSW_DispatchFn_t dispatch);  

Input Parameters

Parameter

Description

fmNumber

The FM identification number

dispatch

Pointer on API 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.