1.1.3.4.16 DRV_MEMORY_CommandStatusGet Function

C

DRV_MEMORY_COMMAND_STATUS DRV_MEMORY_CommandStatusGet
(
    const DRV_HANDLE handle,
    const DRV_MEMORY_COMMAND_HANDLE commandHandle
);

Summary

Gets the current status of the command.

Description

This routine gets the current status of the buffer. The application must use this routine where the status of a scheduled buffer needs to polled on.

The function may return DRV_MEMORY_COMMAND_HANDLE_INVALID in a case where the buffer handle has expired. A buffer handle expires when the internal buffer object is re-assigned to another erase or write request. It is recommended that this function be called regularly in order to track the buffer status correctly.

The application can alternatively register an event handler to receive write or erase operation completion events.

Preconditions

DRV_MEMORY_Open() must have been called to obtain a valid opened device handle.

Parameters

ParamDescription
handleA valid open-instance handle, returned from the driver's open function
commandHandlePointer to an argument that will contain the command handle

Returns

  • DRV_MEMORY_COMMAND_COMPLETED

    • If the transfer request is completed

  • DRV_MEMORY_COMMAND_QUEUED

    • If the command is Queued and waiting to be processed.

  • DRV_MEMORY_COMMAND_IN_PROGRESS

    • If the current transfer request is still being processed

  • DRV_MEMORY_COMMAND_ERROR_UNKNOWN

    • If the handle is invalid

    • If the status read request fails

Example

// memoryHandle is the handle returned by the DRV_MEMORY_Open function.
// commandHandle is the handle returned by any read/write/erase block operation.

if (DRV_MEMORY_COMMAND_COMPLETED == DRV_MEMORY_CommandStatusGet(memoryHandle, commandHandle))
{
    // Operation Done
}

Remarks

Used in Async mode of operation.