1.1.8.4.2 DRV_SFDP_Open Function

1.1.8.4.2 C

DRV_HANDLE DRV_SFDP_Open( const SYS_MODULE_INDEX drvIndex, const DRV_IO_INTENT ioIntent );

1.1.8.4.2 Summary

Opens the specified SFDP driver instance and returns a handle to it.

1.1.8.4.2 Description

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

It performs the following blocking operations:

  • Resets the Flash Device
  • Discovers Flash parameters using SFDP (JESD216)
  • Puts it on QUAD IO mode if supported
  • Unlocks the Flash if DRV_SFDP_Open was called with write intent

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

1.1.8.4.2 Preconditions

Function DRV_SFDP_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_SFDP_Status().

1.1.8.4.2 Parameters

ParametersDescription
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

1.1.8.4.2 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
  • if SFDP discovery fails

1.1.8.4.2 Example

DRV_HANDLE handle;

handle = DRV_SFDP_Open(DRV_SFDP_INDEX, DRV_IO_INTENT_READWRITE);
if (DRV_HANDLE_INVALID == handle)
{
    // Unable to open the driver
}

1.1.8.4.2 Remarks

The handle returned is valid until the DRV_SFDP_Close routine is called. If the driver has already been opened, it should not be opened again.