DRV_W25_Initialize Function

C

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

Summary

Initializes the W25 Driver

Description

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

Precondition

None.

Parameters

ParamDescription
drvIndexIdentifier for the instance to be initialized
initPointer 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 W25 Driver
// with W25256JV flash device attached.

SYS_MODULE_OBJ  objectHandle;

const DRV_W25_PLIB_INTERFACE drvW25PlibAPI =
{
    .Write               = QMSPI0_Write,
    .Read                = QMSPI0_Read,
    .DMATransferRead     = QMSPI0_DMATransferRead,
    .DMATransferWrite    = QMSPI0_DMATransferWrite
};

const DRV_W25_INIT drvW25InitData =
{
    .w25Plib         = &drvW25PlibAPI,
};

objectHandle = DRV_W25_Initialize((SYS_MODULE_INDEX)DRV_W25_INDEX, (SYS_MODULE_INIT *)&drvW25InitData);

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

Remarks

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

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