Jump to main content

##

# DRV_MX25L_Initialize Function

## C

    SYS_MODULE_OBJ DRV_MX25L_Initialize
    (
        const SYS_MODULE_INDEX drvIndex,
        const SYS_MODULE_INIT *const init
    );

## Summary

Initializes the MX25L Driver

## Description

This routine initializes the MX25L driver making it ready for client to use.

- Resets the Flash Device
- Puts it on QUAD IO Mode
- Unlocks the flash

## Precondition

None.

## Parameters

Param | Description
--- | ---
drvIndex | Identifier for the instance to be initialized
init | Pointer to a data structure containing any data necessary to initialize the driver.

## Returns

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

## Example

    // This code snippet shows an example of initializing the MX25L Driver
    // with MX25L QSPI flash device attached.

    SYS_MODULE_OBJ objectHandle;

    const DRV_MX25L_PLIB_INTERFACE drvMX25LPlibAPI = {
        .CommandWrite = QSPI_CommandWrite,
        .RegisterRead = QSPI_RegisterRead,
        .RegisterWrite = QSPI_RegisterWrite,
        .MemoryRead = QSPI_MemoryRead,
        .MemoryWrite = QSPI_MemoryWrite
    };

    const DRV_MX25L_INIT drvMX25LInitData =
    {
        .mx25lPlib = &drvMX25LPlibAPI,
    };

    objectHandle = DRV_MX25L_Initialize((SYS_MODULE_INDEX)DRV_MX25L_INDEX, (SYS_MODULE_INIT *)&drvMX25LInitData);

    if (SYS_MODULE_OBJ_INVALID == objectHandle)
    {
        // Handle error
    }

## Remarks

This routine must be called before any other MX25L driver routine is called.

This routine should only be called once during system initialization. This routine will block for hardware access.