DRV_AT25DF_Initialize Function

C

SYS_MODULE_OBJ DRV_AT25DF_Initialize(
const SYS_MODULE_INDEX drvIndex,
const SYS_MODULE_INIT * const init
)

Summary

Initializes the AT25DF FLASH device

Description

This routine initializes the AT25DF FLASH device 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, so this API should be called only once.

Precondition

None.

Parameters

ParamDescription
drvIndexIdentifier for the instance to be initialized.
initPointer to the init data structure containing any data necessary to initialize the driver.

Returns

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

Example

SYS_MODULE_OBJ sysObjDrvAT25DF;

DRV_AT25DF_PLIB_INTERFACE drvAT25DFPlibAPI = {
    .writeRead = (DRV_AT25DF_PLIB_WRITE_READ)SPI0_WriteRead,
    .write = (DRV_AT25DF_PLIB_WRITE)SPI0_Write,
    .read = (DRV_AT25DF_PLIB_READ)SPI0_Read,
    .isBusy = (DRV_AT25DF_PLIB_IS_BUSY)SPI0_IsBusy,
    .callbackRegister = (DRV_AT25DF_PLIB_CALLBACK_REGISTER)SPI0_CallbackRegister,
};

DRV_AT25DF_INIT drvAT25DFInitData = {
    .spiPlib = &drvAT25DFPlibAPI,
    .numClients = DRV_AT25DF_CLIENTS_NUMBER_IDX,
    .pageSize = DRV_AT25DF_PAGE_SIZE,
    .flashSize = DRV_AT25DF_FLASH_SIZE,
    .blockStartAddress = 0x0,
    .chipSelectPin = DRV_AT25DF_CHIP_SELECT_PIN_IDX
};

sysObjDrvAT25DF = DRV_AT25DF_Initialize(DRV_AT25DF_INDEX, (SYS_MODULE_INIT *)&drvAT25DFInitData);

Remarks

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

This routine should only be called once during system initialization.