Jump to main content

# 1.1.4.1 DRV_METROLOGY_Initialize Function

## C

    SYS_MODULE_OBJ DRV_METROLOGY_Initialize (
        SYS_MODULE_INIT * init,
        uint32_t resetCause
    );

## Summary

Initializes the metrology driver according to the init parameter and the cause of the reset of the main processor.

## Description

This routine initializes the metrology driver making it ready for clients to open and use. The initialization data is specified by the init parameter. It is a single instance driver.

Note: This function is called by System Initialization when program starts, this is, on power-up or after any reset. Depending on the reset cause, the behaviour is different. When reset is due to Watchdog on Main Processor, Coprocessor is not reset, allowing it to continue running independently from the watchdog reset. Upon any other reset cause, the Coprocessor and related peripherals are reset.

## Parameters

Parameters | Description
--- | ---
init | Pointer to the init data structure containing any data necessary to initialize the driver
resetCause | Reset cause of the main processor

## Returns

If successful, returns a valid handle to a driver instance object. Otherwise, it returns SYS_MODULE_OBJ_INVALID.

## Example

    SYS_MODULE_OBJ   sysObjDrvMet;

    extern uint8_t met_bin_start;
    extern uint8_t met_bin_end;

    /* Metrology Driver Initialization Data */
    DRV_METROLOGY_INIT drvMetrologyInitData = {

        /* MET bin destination address */
        .regBaseAddress = DRV_METROLOGY_REG_BASE_ADDRESS,

        /* MET Binary start address */
        .binStartAddress = (uint32_t)&met_bin_start,

        /* MET Binary end address */
        .binEndAddress = (uint32_t)&met_bin_end,

    };

    sysObjDrvMet = DRV_METROLOGY_Initialize((SYS_MODULE_INIT *)&drvMetrologyInitData, RSTC_ResetCauseGet());

## Remarks

This routine must be called before any other DRV_METROLOGY routine is called.

Rev: E