1.1.2.4.2 DRV_G3_MACRT_Open Function

C

SYS_MODULE_OBJ DRV_G3_MACRT_Open (
    const SYS_MODULE_INDEX index,
    const DRV_PLC_BOOT_DATA_CALLBACK callback
);

Summary

Opens the specified G3 MAC RT driver instance and returns a handle to it.

Description

This routine opens the specified G3 MAC RT driver instance and provides a handle that must be provided to all other client-level operations to identify the caller and the instance of the driver.

This driver is a single client driver, so DRV_G3_MACRT_Open API should be called only once until driver is closed.

Parameters

ParamDescription
indexIndex for the instance to be opened. As driver is single instance, index '0' must always be used.
callbackBoot Data Callback Function Pointer. In case of use NULL, .binStartAddress and .binEndAddress fields must be configured in initialization data DRV_G3_MACRT_INIT.

Returns

If successful, the routine returns a valid open-instance handle (a number identifying both the caller and the module instance). As driver is single instance, handle '0' is always returned.

If an error occurs, the return value is DRV_HANDLE_INVALID. Error can occur:

  • if the driver has been already opened once and in use.

  • if the driver peripheral instance being opened is not initialized or is invalid.

Example

DRV_HANDLE handle;

handle = DRV_G3_MACRT_Open(DRV_G3_MACRT_INDEX_0, NULL);
if (handle == DRV_HANDLE_INVALID)
{
    // Unable to open the driver
    // May be the driver is not initialized
}

Remarks

The handle returned is valid until the DRV_G3_MACRT_Close routine is called.This routine will NEVER block waiting for hardware.