1.1.7.4.3 DRV_SDSPI_Open Function

C

DRV_HANDLE DRV_SDSPI_Open
(
    const SYS_MODULE_INDEX drvIndex,
    const DRV_IO_INTENT ioIntent
)

Summary

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

Description

This routine opens the specified SD Card driver instance and provides a handle that must be provided to all other client-level operations to identify the caller and the instance of the driver.

Precondition

Function DRV_SDSPI_Initialize must have been called before calling this function.

Parameters

ParamDescription
drvIndexIdentifier for the object 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. Supports only DRV_IO_INTENT_EXCLUSIVE.

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, the return value is DRV_HANDLE_INVALID.

Example

DRV_HANDLE handle;

handle = DRV_SDSPI_Open (DRV_SDSPI_INDEX_0, DRV_IO_INTENT_EXCLUSIVE);

if (handle == DRV_HANDLE_INVALID)
{
    // Unable to open the driver
}

Remarks

The handle returned is valid until the DRV_SDSPI_Close routine is called. This routine may block for other client-level operations to complete.