USBDev_PipeRdAsync

Description

Read data from device over the specified pipe. This function returns immediately if data is not present. The data will be retrieved later.

Files

usbdev_api.c

Prototype

void  USBDev_PipeRdAsync (HANDLE                    pipe,
                          UCHAR                    *p_buf,
                          DWORD                     buf_len,
                          USBDEV_PIPE_RD_CALLBACK   callback,
                          void                     *p_callback_arg,
                          DWORD                    *p_err);


Arguments

pipe

Pipe handle.

p_buf

Pointer to receive buffer.

buf_len

Receive buffer length.

callback

Pointer to application callback called by Asynchronous thread upon completion.

p_callback_arg

Pointer to argument which can carry private information passed by application. This argument is used when the callback is called.

p_err

Pointer to variable that will receive the return error code from this function:

ERROR_SUCCESS
ERROR_INVALID_HANDLE
ERROR_INVALID_USER_BUFFER
ERROR_BAD_PIPE
ERROR_NOT_ENOUGH_MEMORY
ERROR_SEM_TIMEOUT

Returned Value

None.

Callers

Application.

Notes / Warnings

  1. When a IN pipe is open with one of the open functions USBDev_xxxxIn_Open(), a thread is automatically created. This thread is in charge of informing the application about a completed asynchronous IN transfer. Upon completion of an asynchronous transfer, the thread is waken up and calls the application callback provided to USBDev_API library using the callback argument.
  2. USBDev_API library allows to queue several asynchronous IN transfers for the same pipe.