FM Header Definition Macro

DEFINE_FM_HEADER

The FM header contains information which is used at runtime and must be present in all functionality modules (FMs),

The use of the DEFINE_FM_HEADER macro simplifies the definition of the FM header structure and also ensures that the header is placed in the appropriate location in the FM binary image.

Synopsis

#include <mkfmhdr.h>

Usage

DEFINE_FM_HEADER(FM_NUMBER, FM_VERSION, FM_SERIAL_NO, MANUFACTURER_ID, PRODUCT_ID);

   
FM_NUMBER Must be a manifest constant. Refer to FM_NUMBER for more information.
FM_VERSION A 16 bit integer, of the form 0xMMmm, where mm is the minor number, and MM is the major number. (It is displayed as VMM.mm in ctfm)
SERIAL_NO An integer representing the serial number of the FM
MANUFACTURER_ID A string of at most 32 characters, which contains the manufacturer name. This does not need to be NULL terminated.
PRODUCT_ID A string consisting of a maximum of 16 characters, which contains the FM name. This does not need to be NULL terminated.

FM_NUMBER

This field is used to define the FM identifier number (FMID). Note the following regarding FMIDs:

>The FMID is used by MD_SendReceive() to identify which FM receives the request.

>Following a reboot, the HSM starts up FMs in ascending order of their FMID values.

>If more than one FM is loaded onto the HSM, each FM must have a different ID value.

>The FMID can be returned to the client in the following ways:

The client may call MD_GetFmIdFromName() to return the FMID with a matching PRODUCT_ID.

The client may call GetFMID(void) from the FM itself to get the FMID.

>The FM_NUMBER value can be any of the following:

A number from FM_ID_CUSTOM_MIN to FM_ID_CUSTOM_MAX.

One of the special values FMID_ALLOCATE_HIGH, FMID_ALLOCATE_NORM, or FMID_ALLOCATE_LOW.

Normally, select a number between FM_ID_CUSTOM_MIN and FM_ID_CUSTOM_MAX for each type of FM you may want to load onto the HSM. If you only have one FM to manage in your HSM, you should specify the standard static ID value of FM_NUMBER_CUSTOM_FM (=FM_ID_CUSTOM_MIN).

Because these ID values are fixed, the client application can have the FMID of its FM fixed in the source code. However, if there are a lot of FMs , then FMID values can clash. Use the special values FMID_ALLOCATE_HIGH, FMID_ALLOCATE_NORM, or FMID_ALLOCATE_LOW to request that the HSM dynamically assign an unused ID value to the FM when it is loaded onto the HSM. This process ensures FMID values do not clash. The three different ranges allow the FM designer some control over the initialization order of their FMs, where FMID_ALLOCATE_LOW FMs are started up first. If the startup order does not matter, then you should specify FMID_ALLOCATE_NORM.