DRV_SST39_Initialize Function

C

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

Summary

Initializes the SST39 Driver

Description

This routine initializes the SST39 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 SST39 Driver
// with SST39 Parallel flash device attached.

SYS_MODULE_OBJ  objectHandle;

const DRV_SST39_PLIB_INTERFACE drvSST39PlibAPI = {
    .write              = (DRV_SST39_PLIB_WRITE)HEMC_Write8,
    .read               = (DRV_SST39_PLIB_READ)HEMC_Read8,
    .eccDisable         = (DRV_SST39_PLIB_ECC_DISABLE)HEMC_DisableECC,
    .eccEnable          = (DRV_SST39_PLIB_ECC_ENABLE)HEMC_EnableECC,
};

const DRV_SST39_INIT drvSST39InitData =
{
    .sst39Plib         = &drvSST39PlibAPI,
};

objectHandle = DRV_SST39_Initialize((SYS_MODULE_INDEX)DRV_SST39_INDEX, (SYS_MODULE_INIT *)&drvSST39InitData);

if (SYS_MODULE_OBJ_INVALID == objectHandle)
{
    printf("Initialization Error");
}

Remarks

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

This routine should only be called once during system initialization.