Embedded Xinu Operating System
An ongoing research project and educational operating system.
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Groups Pages
Data Fields
dwc_regs::dwc_host_channel::dwc_host_channel_transfer Union Reference

#include <usb_dwc_regs.h>

Data Fields

uint32_t val
 
struct {
   uint32_t   size: 19
 
   uint32_t   packet_count: 10
 
   uint32_t   packet_id: 2
 
   uint32_t   do_ping: 1
 
}; 
 

Detailed Description

Channel Transfer Register:

Used to store additional information about the transfer. This must be programmed before beginning the transfer.

Field Documentation

uint32_t dwc_regs::dwc_host_channel::dwc_host_channel_transfer::do_ping

TODO

uint32_t dwc_regs::dwc_host_channel::dwc_host_channel_transfer::packet_count

Number of packets left to transmit or maximum number of packets left to receive. Software must program this before beginning the transfer. The packet count is calculated as the size divided by the maximum packet size, rounded up to the nearest whole packet. As a special case, if the transfer size is 0 bytes, the packet count must be set to 1.

The hardware will decrement this register when a packet is successfully sent or received. In the case of split transactions, this happens after the Complete Split rather than after the Start Split. If the final received packet of an IN transfer is short, it is still counted.

uint32_t dwc_regs::dwc_host_channel::dwc_host_channel_transfer::packet_id

High 2 bits of the Packet ID used in the USB protocol.

When performing the SETUP phase of a control transfer, specify 0x3 here to generate the needed SETUP token.

When performing the DATA phase of a control transfer, initially specify 0x2 here to begin the DATA packets with the needed DATA1 Packet ID.

When performing the STATUS phase of a control transfer, specify 0x2 here to generate the neeed DATA1 Packet ID.

When starting a bulk, isochronous, or interrupt transfer, specify 0x0 here to generate the needed DATA0 Packet ID.

In the case of a transfer consisting of multiple DATA packets, the hardware will update this field with the Packet ID to use for the next packet. This field therefore only needs to be re-programmed if the transfer is moved to a different channel or the channel is re-used before the transfer is complete. When doing so, software must save this field so that it can be re-programmed correctly.

uint32_t dwc_regs::dwc_host_channel::dwc_host_channel_transfer::size

Size of the data to send or receive, in bytes. Software must program this before beginning the transfer. This can be greater than the maximum packet length.

For IN transfers, the hardware decrements this field for each packet received by the number of bytes received. For split transactions, the decrement happens after the Complete Split rather than the Start Split. Software can subtract this field from the original transfer size in order to determine the number of bytes received at any given point, including when the transfer has encountered an error or has completed with either the full size or a short size.

For OUT transfers, the hardware does not update this field as expected. It will not be decremented when data is transmitted, at least not in every case; hence, software cannot rely on its value to indicate how many bytes of data have been transmitted so far. Instead, software must inspect the packet_count field and assume that all data was transmitted if packet_count is 0, or that the amount of data transmitted is equal to the endpoint's maximum packet size times [the original packet count minus packet_count] if packet_count is nonzero.


The documentation for this union was generated from the following file: