1.1.4.4.2 DRV_NAND_FLASH_Open Function

C

DRV_HANDLE DRV_NAND_FLASH_Open( const SYS_MODULE_INDEX drvIndex, const DRV_IO_INTENT ioIntent )

Summary

Opens the specified NAND FLASH driver instance and returns a handle to it

Description

This routine opens the specified NAND FLASH driver instance and provides a handle.

This handle must be provided to all other client-level operations to identify the caller and the instance of the driver.

  • Reset NAND Flash

  • Gets and stores NAND Flash Geometry to use in driver

  • Initializes PMECC descriptor if PMECC is enabled

Preconditions

Function DRV_NAND_FLASH_Initialize must have been called before calling this function. Driver should be in ready state to accept the request. Can be checked by calling DRV_NAND_FLASH_Status().

Parameters

ParamDescription
drvIndexIdentifier for the instance to be opened
ioIntentZero or more of the values from the enumeration DRV_IO_INTENT "ORed" together to indicate the intended use of the driver

Returns

If successful, the routine returns a valid open-instance handle (a number identifying both the caller and the module instance).

If an error occurs, DRV_HANDLE_INVALID is returned. Errors can occur under the following circumstances:

  • If the driver hardware instance being opened is not initialized.

  • Fail to reset NAND Flash OR fail to read NAND Flash Geometry

  • Invalid PMECC configurations for NAND Flash if PMECC is enabled

Example

DRV_HANDLE handle;

handle = DRV_NAND_FLASH_Open((SYS_MODULE_INDEX)DRV_NAND_FLASH_INDEX, DRV_IO_INTENT_READWRITE);
if (DRV_HANDLE_INVALID == handle)
{
    // Unable to open the driver
}

Remarks

The handle returned is valid until the DRV_NAND_FLASH_Close routine is called.

If the driver has already been opened, it should not be opened again. This routine will block wait for hardware access.