VxWorks API Reference : USB libraries

usbTcdPdiusbd12EvalLib [USB]

NAME

usbTcdPdiusbd12EvalLib [USB] - USB target controller driver for Philips PDIUSBD12

ROUTINES

usbTcdPdiusbd12EvalExec( ) - USB_TCD_EXEC_FUNC entry point for PDIUSBD12 TCD

DESCRIPTION

This module implements the USB TCD (Target Controller Driver) for the Philips PDIUSBD12 used in conjuction with the PDIUSBD12 ISA evaluation kit from Philips.

This module exports a single entry point, usbTcdPdiusbd12EvalExec( ). This is the USB_TCD_EXEC_FUNC for this TCD. The caller passes requests to the TCD by constructing TRBs, or Target Request Blocks, and passing them to this entry point.

The USB TCD works in conjuction with the usbTargLib module. In order to simplify the creation of a TCD for a given USB target controller, the usbTargLib handles most parameter and logical validation of requests. The TCD, therefore, is largely free to execute requests without extensive validation, knowing that usbTargLib will have validated the requests beforehand.

TCDs are initialized by invoking the TCD_FNC_ATTACH function. In response to this function, the TCD returns information about the target controller, including its USB speed, the number of endpoints it supports, and information about each endpoint.

Endpoint information is maintained in an array of USB_TARG_ENDPOINT_INFO structures. These structures are allocated and owned by the TCD. The usbTargLib and the callers of the usbTargLib are allowed to examine this array, but are not allowed to modify it. All modification of the array is performed generally by invoking the TCDs TCD_FNC_ENDPOINT_ASSIGN and TCD_FNC_ENDPOINT_RELEASE functions. These functions are invoked upon the creation and deletion of USB pipes, respectively.

By convention, each endpoint exposed in the array of USB_TARG_ENDPOINT_INFO structures is unidirectional, ie., either and OUT or IN endpoint. The TCD is required to present the endpoints in this way, even if the underlying hardware presents the endpoints as bi-directional. In this way, the calling application can choose to assign endpoints to pipes as it sees fit. Also, by convention, the first two endpoints in the array MUST be the OUT and IN endpoints which are most appropriate for use as the default control pipe (endpoint #0).

Once pipes have been created, the TCD is instructed to wait for data transfers initiated by the host USB controller. The TCD callers pass ERPs (Endpoint Request Blocks) to the TCD to request and manage data transfers. It is important to remember that all USB data transfers are actually initiated by the host, so no data transfers will actually be performed by the TCD and target controller hardware unless the USB host controller is polling the target.

It is also important to note a convention regarding the direction of data transfers. The transfer of data is always viewed from the host's perspective. Therefore, an OUT transfer is a transfer from the host to the device (target) and an IN transfer is a transfer from the device to the host. Therefore, USB_DIR_OUT, USB_PID_SETUP, and USB_PID_OUT refer to host->device transfers while USB_DIR_IN and USB_PID_IN refer to device->host transfers.

During TCD_FNC_ATTACH processing, the TCD creates a task to handle target controller interrupts. Interrupts are first received by a normal interrupt handler, and this interrupt handler immediately reflects the interrupt to the interrupt task. All TCD callbacks to the usbTargLib are made either from the caller's task or from the interrupt task. No callbacks are made from the interrupt context itself.

Conditional code:

The use of DMA (PC XT/AT style 8237 slave-mode DMA) is enabled by defining the constant D12_USE_DMA. Leaving this undefined causes the driver to run exclusively in "programmed-I/O" mode.

In testing the Philips PDIUSBD12 has appeared to set the "data success" bit incorrectly, causing software to declare a failure. The use of this bit can be enabled or disabled by definining the constant D12_CHECK_DATA_SUCCESS_BIT. Leaving this constant undefined disables error checking.


USB libraries : Routines

usbTcdPdiusbd12EvalExec( )

NAME

usbTcdPdiusbd12EvalExec( ) - USB_TCD_EXEC_FUNC entry point for PDIUSBD12 TCD

SYNOPSIS

STATUS usbTcdPdiusbd12EvalExec
    (
    pVOID pTrb                /* TRB to be executed */
    )

DESCRIPTION

This is the primary entry point for the Philips PDIUSBD12 (ISA eval version) USB TCD (Target Controller Driver). The function qualifies the TRB passed by the caller and fans out to the appropriate TCD function handler.

RETURNS

OK or ERROR if failed to execute TRB passed by caller

ERRNO

  S_usbTcdLib_BAD_PARAM
  S_usbTcdLib_BAD_HANDLE
  S_usbTcdLib_SHUTDOWN

SEE ALSO

usbTcdPdiusbd12EvalLib