USB device endpoint
USB peripherals should contain a certain number of independent register ports and can be driven by USB devices.ProgramDirectly. These registers are the endpoints of the USB device. One device can have multiple endpoints, but all USB devices must have one zero endpoint for setting and control transfer.
Each device has a unique address allocated by the host, and each device has an endpoint ID and a communication direction determined by the device. Each endpoint only supports one-way communication, either the input endpoint, the data stream direction is from the device to the host, or the output endpoint, and the data stream direction is from the host to the device. The device address, endpoint number, and communication direction are combined to uniquely identify each endpoint.
When configuring a device, you must inform the host of the characteristics of each endpoint, including the endpoint number, communication direction, maximum packet size supported by the endpoint, bandwidth requirements, and supported communication methods. The maximum package size supported by the endpoint is called data payload, which is an important concept. The preceding mentioned endpoint 0 is special. It actually consists of two endpoints: input and output. Each device must have an endpoint 0, a host, and its default pipe (default pipe), which is used to configure the device and implement some basic control functions on the device. Except for endpoint 0, other endpoints cannot communicate with the host before the device is configured. Only when the device reports the host in the configuration descriptor, it has the endpoints and the features of these endpoints. After the host is confirmed, these endpoints are activated. In addition to the endpoint 0, a low-speed USB device can have up to two endpoints, and a full-speed device can have up to 15.
USBCommunication Flow
MPs queue
PIPE is the data transmission channel between the endpoint of the USB device and the host software. A pipeline describes information transmission in terms of logic. The USB Protocol specifies stream pipe and message pipe. The message pipeline has a defined structure. The default control pipeline belongs to the Message pipeline.
Before a transmission occurs, a pipeline must be established between the host and the device. Therefore, each pipe has a direct relationship with the characteristics of the endpoint. It supports only one communication method. For example, a USB device should have an endpoint to support the pipeline for receiving data, and another endpoint to support the pipeline for sending data. The pipe corresponding to endpoint 0 is called the default pipe. The USB host controls peripherals by sending "peripheral requests" to the default channel connected to the peripherals.