DRV_AT25_Open Function
C
DRV_HANDLE DRV_AT25_Open ( const SYS_MODULE_INDEX drvIndex, const DRV_IO_INTENT ioIntent )
Summary
Opens the specified AT25 driver instance and returns a handle to it.
Description
This routine opens the specified AT25 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. The ioIntent parameter defines how the client interacts with this driver instance.
This driver is a single client driver, so DRV_AT25_Open API should be called only once until driver is closed.
Precondition
Function DRV_AT25_Initialize must have been called before calling this function.
Parameters
Param | Description |
---|---|
drvIndex | Identifier for the object instance to be opened |
ioIntent | Zero or more of the values from the enumeration DRV_IO_INTENT "ORed" together to indicate the intended use of the driver. Note: This driver ignores the ioIntent argument. |
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. Error can occur
if the driver has been already opened once and in use.
if the driver instance being opened is not initialized or is invalid.
Example
DRV_HANDLE handle; handle = DRV_AT25_Open(DRV_AT25_INDEX, DRV_IO_INTENT_READWRITE); if (handle == DRV_HANDLE_INVALID) { // Unable to open the driver // May be the driver is not initialized }
Remarks
The handle returned is valid until the DRV_AT25_Close routine is called.