A.2. Transaction constants

Table A.2. Transaction behaviour flags

BitDefinitionValueDescription
0USB_TRANSACTION_EXACT_SIZE0
  • Reading: You can receive an arbitrary number of bytes up to the value of the URB used_size field.

  • Writing: Zero length transactions will not be issued.

1

The Term "exact buffer size" is used here with a different semantic to that of the USB specification.

  • Device to Host: An error is generated if the device attempts to transfer a different number of bytes to that required in the URB.

  • Host to Device: For setup transactions this will generate a zero length transfer at the end of the transaction if the length of the data URB is zero or a multiple of the packet size.

1USB_TRANSACTION_FRAME_START0Transaction will commence as soon as possible.
1Frame start number is given and the transaction will commence processing on or after the specified frame.
2USB_TRANSACTION_SETUP_EVAL (Currently Unsupported)0Setup buffer is not evaluated by the USB system. (currently only valid value).
1

Setup buffer is evaluated by the USB system. This is intended for future support so the USB system may track changes to the device configuration and setup. It is currently the drivers responsibility to ensure that any changes modify the relevant system state.

3USB_TRANSACTION_STATUS_STAGE0Normal transaction behaviour.
1This flag must be set for control transactions to enable the use of the second URB. This also enables the second "data" phase of control transactions. This also implicitly sets USB_TRANSACTION_EXACT_SIZE to ensure the correct sequence of transfers occur.
4USB_TRANSACTION_TIMEOUT0Normal transaction behaviour.
1When set this allows the driver to specify the maximum number of centiseconds it is prepared to wait for a transaction, this is not affected by waiting mode. The transaction will be terminated with a USB_TRANSACTION_RESULT_TIMEOUT.
5 - 29Reserved0Reserved must be zero.
30USB_TRANSACTION_REQUEST_FIRST (Internal use only - Must be zero)0Transaction is not the first in a request. This blocks any other transaction at this endpoint to be notified as pending until it is removed from the pending queue by using a special function.
1Transaction is the first one in a request.
31USB_TRANSACTION_CANCELLED (Internal use only - Must be zero)0All informations inside transaction are valid.
1

Transaction has been cancelled. Stop the processing of the transaction and its following transactions belonging to the same request immediately.

Note that some information inside the transaction may be invalid. However the validity of the most pointer references is granted by reference chains.

Table A.3. Request States

DefinitionValueDescription
USB_TRANSACTION_RESULT_OK0Request finished without errors.
USB_TRANSACTION_RESULT_HALTED-1Request finished with error. Pipe has been halted.
USB_TRANSACTION_RESULT_ABORTED-2Request finished with error. Pipe has been cleared.
USB_TRANSACTION_RESULT_TRANSMISSION_FAILED-3Request failed, an unrecoverable transmission error occurred. Pipe has been halted.
USB_TRANSACTION_RESULT_INVALID_SIZE-4Request failed, transfered data was not of the requested size. Pipe has been halted.
USB_TRANSACTION_RESULT_WORKING-5Request is still ongoing.
USB_TRANSACTION_RESULT_BUSPROTO_ERR-6The data was corrupted on the bus, for example CRC or data format errors
USB_TRANSACTION_RESULT_STALL-7Device stalled pipe. Pipe stall must be cleared with usb_clear_pipe_halt see Chapter 7, Transactions for more details.
USB_TRANSACTION_RESULT_NORESPONSE-8Request was not acknowledged by the device.
USB_TRANSACTION_RESULT_HC_BUFF_ERR-9The host controller either ran out of buffer space during the transaction, or could not buffer the data fast enough
USB_TRANSACTION_RESULT_BUS_DATASZ-10The host controller got more data than expected from the transaction.
USB_TRANSACTION_RESULT_INTERNAL-11the system had an internal failure and could not complete the transaction
USB_TRANSACTION_RESULT_TIMEOUT-12The transaction did not complete within the specified timeout, and has been aborted. The system does no more clearing up after aborting the transaction and it is up to the initiator of the request to sort out any problems that a partial transaction may have caused.

Table A.4. Setup transaction request type

BitDescription
0-4

Recipient

0 - Device
1 - Interface
2 - Endpoint
3 - Other
4-32 - Reserved

6-5

Type

0 - Standard
1 - Class
2 - Vendor
3 - Reserved

7

Data transfer direction

0 - Host to device
1 - Device to host

Table A.5. Constants used for type of USB transfer

DefinitionValueDescription
USB_PIPE_TYPE_CONTROL0Control Transfer
USB_PIPE_TYPE_ISOCHRONUS1Isochronous Transfer
USB_PIPE_TYPE_BULK2Bulk Transfer
USB_PIPE_TYPE_INTERRUPT3Interrupt Transfer
USB_PIPE_TYPE_MAX4Number of supported transfer types is 4 (USB 1.1)