Skip to content

Commit d9a9bab

Browse files
committed
Merge branch 'docs/translate_dwc_otg' into 'master'
docs: Provide translation for usb_host_notes_dwc_otg Closes DOC-7944 See merge request espressif/esp-idf!31231
2 parents 4e5b8f9 + f1f1bcf commit d9a9bab

File tree

2 files changed

+235
-35
lines changed

2 files changed

+235
-35
lines changed

docs/en/api-reference/peripherals/usb_host/usb_host_notes_dwc_otg.rst

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
USB Host Maintainers Notes (DWC_OTG Controller)
22
===============================================
33

4+
:link_to_translation:`zh_CN:[中文]`
5+
46
The {IDF_TARGET_NAME} uses a DesignWare USB 2.0 On-the-Go Controller (henceforth referred to as DWC_OTG in this document) as its underlying hardware controller, where the DWC_OTG operates in Host Mode with Scatter/Gather DMA enabled.
57

68
.. note::
79

8-
This section only summarizes the operation of the DWC_OTG operation in Host Mode at a high level. For full details of the DWC_OTG, refer to the DWC_OTG Databook and Programming Guide.
10+
This section only summarizes the operation of the DWC_OTG in Host Mode at a high level. For full details of the DWC_OTG, please refer to the DWC_OTG Databook and Programming Guide.
911

1012
Host Mode Operating Model
1113
-------------------------
@@ -19,26 +21,26 @@ A simplified version of the operating model of the DWC_OTG in Host Mode is illus
1921

2022
.. note::
2123

22-
Refer to Databook section 2.1.4 (Host Architecture) for more details
24+
Refer to the Databook section 2.1.4 (Host Architecture) for more details.
2325

2426
Host Port
2527
^^^^^^^^^
2628

27-
The Host Port represents the single USB port provided by the DWC_OTG (in USB terms, this can be thought a single USB port of the root hub of the bus). The Host Port can only connect to a single device, though more devices can be connected via hub devices.
29+
The Host Port represents the single USB port provided by the DWC_OTG (in USB terms, this can be thought of as a single USB port of the root hub of the bus). The Host Port can only connect to a single device, though more devices can be connected via hub devices.
2830

2931
The Host Port is responsible for:
3032

31-
- detecting direct device connections/disconnections
32-
- detecting the speed of the directly connected device
33-
- issuing various bus signals (such as suspend, resume, reset)
33+
- detecting direct device connections/disconnections.
34+
- detecting the speed of the directly connected device.
35+
- issuing various bus signals (such as suspend, resume, reset).
3436

3537
Host Channels
3638
^^^^^^^^^^^^^
3739

38-
In Host Mode, the DWC_OTG uses channels to communicate with device endpoints, where one channel maps to a particular endpoint (in USB terms, channels are the hardware representation of pipes). For example, a channel will map to EP 1 OUT. Each channel has its own set of CSRs (Control and Status Registers) so that they can independently configured and controlled independently. A channel's CSRs are used to...
40+
In Host Mode, the DWC_OTG uses channels to communicate with device endpoints, where one channel maps to a particular endpoint (in USB terms, channels are the hardware representation of pipes). For example, a channel will map to EP 1 OUT. Each channel has its own set of CSRs (Control and Status Registers) so that they can be configured and controlled independently. A channel's CSRs are used to:
3941

40-
- specify the details of the channel's target endpoint (e.g., device address, EP number, transfer type, direction)
41-
- start a transfer on the channel (e.g., by setting up DMA descriptors)
42+
- specify the details of the channel's target endpoint (e.g., device address, EP number, transfer type, direction).
43+
- start a transfer on the channel (e.g., by setting up DMA descriptors).
4244

4345
When using Scatter/Gather DMA, transfers on Host Channels are completely event driven. Users simply fill out the appropriate DMA descriptors, fill in the channel's CSRs, then enable the channel. The channel will then generate an interrupt when the transfer completes.
4446

@@ -52,9 +54,9 @@ In Host Mode, the DWC_OTG uses multiple FIFOs as a staging area for the data pay
5254

5355
The destination FIFO depends on the direction and transfer type of the channel:
5456

55-
- All IN channel data goes to the RX FIFO
56-
- All non-periodic (i.e., Control and Bulk) OUT channel data goes to the Non-periodic TX (NPTX) FIFO
57-
- All periodic (i.e., Interrupt and Isochronous) OUT channel data goes to the Periodic TX (PTX) FIFO
57+
- All IN channel data goes to the RX FIFO.
58+
- All non-periodic (i.e., Control and Bulk) OUT channel data goes to the Non-periodic TX (NPTX) FIFO.
59+
- All periodic (i.e., Interrupt and Isochronous) OUT channel data goes to the Periodic TX (PTX) FIFO.
5860

5961
.. note::
6062

@@ -75,19 +77,19 @@ The DMA engine is responsible for copying data between the FIFOs and main memory
7577
- A 32-bit Buffer Status Quadlet specifying details of the transfer, and also reports the status of the transfer on completion. The Buffer Status Quadlet has bits to specify whether the QTD should generate an interrupt and/or halt the channel on completion.
7678
- A 32-bit pointer to the data buffer containing the data payload for OUT transfers, or an empty buffer used to store the data payload for IN transfers.
7779

78-
- The data payload of each QTD can be larger than the MPS (Maximum Packet Size) of its target endpoint. The DWC_OTG hardware automatically handles splitting of the transfer into multiple transactions.
79-
- Multiple QTDs can be placed into a single QTD List. A channel will then execute each QTD in the list automatically, and optionally loop back around if configured to do so.
80+
- The data payload of each QTD can be larger than the MPS (Maximum Packet Size) of its target endpoint. The DWC_OTG hardware automatically handles the split of transfer into multiple transactions.
81+
- Multiple QTDs can be placed into a single QTD List. A channel will then execute each QTD in the list automatically, and optionally loop back around via configuration.
8082
- Before a channel starts data transfer, it is configured with a QTD list (and QTD list length). Once the channel is enabled, USB transfers are executed automatically by the hardware.
8183
- A channel can generate interrupts (configurable) on completion of a particular QTD, or an entire QTD list.
8284

8385
.. note::
8486

85-
Refer to Programming Guide section 6.2.1 (Descriptor Memory Structures) for more details
87+
Refer to Programming Guide section 6.2.1 (Descriptor Memory Structures) for more details.
8688

8789
Hardware Configuration
8890
----------------------
8991

90-
The DWC_OTG IP is configurable. The notable Host related configurations of the {IDF_TARGET_NAME}'s DWC_OTG are listed below:
92+
The DWC_OTG IP is configurable. The notable host related configurations of the {IDF_TARGET_NAME}'s DWC_OTG are listed below:
9193

9294
.. list-table:: {IDF_TARGET_NAME}'s DWC_OTG Configuration
9395
:widths: 70 30
@@ -113,10 +115,10 @@ The DWC_OTG IP is configurable. The notable Host related configurations of the {
113115
Scatter/Gather DMA Transfer
114116
---------------------------
115117

116-
The basic operating procedure for Host channels transfers consists of the following steps:
118+
The basic operating procedure for Host Channels' transfers consists of the following steps:
117119

118-
#. Prepare data buffers, QTDs, and QTD list. In particular, which QTDs should halt the channel (and generate an interrupt) on completion.
119-
#. Set channel/endpoint characteristics via CSRs (such as EP address, transfer type, EP MPS etc).
120+
#. Prepare data buffers, QTDs, and a QTD list. In particular, ensure which QTDs should halt the channel and generate an interrupt on completion.
121+
#. Set channel and endpoint characteristics via CSRs (such as EP address, transfer type, EP MPS etc).
120122
#. Set channel's QTD list related CSRs (such as QTD list pointer and QTD list length) and channel interrupt CSRs
121123
#. Enable the channel. Transfers are now handled automatically by hardware using DMA.
122124
#. The Channel generates an interrupt on a channel event (e.g., QTD completion or channel error).
@@ -128,21 +130,21 @@ However, there are some minor differences in channel operation and QTD list usag
128130
Bulk
129131
^^^^
130132

131-
Bulk transfers are a simplest. Each QTD represents a bulk transfer of a particular direction, where the DWC_OTG automatically splits a particular QTD into multiple MPS sized transactions. Thus it is possible to fill a QTD list with multiple bulk transfers, and have the entire list executed automatically (i.e., only interrupt on completion of the last QTD).
133+
Bulk transfers are the simplest transfers. Each QTD represents a bulk transfer of a particular direction, where the DWC_OTG automatically splits a particular QTD into multiple MPS sized transactions. Thus it is possible to fill a QTD list with multiple bulk transfers, and have the entire list executed automatically (i.e., only interrupt on completion of the last QTD).
132134

133135
Control
134136
^^^^^^^
135137

136-
Control transfers are more complicated as they are bi-directional (i.e., each control transfer stage can have a different direction). Thus, a separate QTD is required for each stage, and each QTD must halt the channel on completion. Halting the channel after each QTD allows changing the channel's direction to be changed by reconfiguring the channel's CSRs. Thus a typical control transfer consists of 3 QTDs (one for each stage).
138+
Control transfers are more complicated as they are bi-directional (i.e., each control transfer stage can have a different direction). Thus, a separate QTD is required for each stage, and each QTD must halt the channel on completion. Halting the channel after each QTD allows the channel's direction to be changed by reconfiguring the channel's CSRs. Thus a typical control transfer consists of 3 QTDs (one for each stage).
137139

138140
Interrupt
139141
^^^^^^^^^
140142

141-
In accordance with the USB2.0 specification, interrupt transfers executes transactions at the endpoints specified service period (i.e., ``bInterval``). A particular interrupt endpoint may not execute more than one interrupt transaction within a service period. The service period is specified in number of microframes/frames, thus a particular interrupt endpoint will generally execute one transaction every Nth microframe/frame until the transfer is complete. For interrupt channels, the service period of a particular channel (i.e., ``bInterval``) is specified via the Host Frame List (see section 6.5 of programming guide for more details).
143+
In accordance with the USB 2.0 specification, interrupt transfers executes transactions at the endpoints specified service period (i.e., ``bInterval``). A particular interrupt endpoint may not execute more than one interrupt transaction within a service period. The service period is specified in number of microframes or frames, thus a particular interrupt endpoint will generally execute one transaction every Nth microframe or frame until the transfer is complete. For interrupt channels, the service period of a particular channel (i.e., ``bInterval``) is specified via the Host Frame List (see section 6.5 of Programming Guide for more details).
142144

143145
.. note::
144146

145-
HS USB allows an interrupt endpoint to have 3 interrupt transactions in a single microframe. See USB2.0 specification section 5.7.3 (Interrupt Transfer Packet Size Constraints) for more details.
147+
HS USB allows an interrupt endpoint to have three interrupt transactions in a single microframe. See USB 2.0 specification section 5.7.3 (Interrupt Transfer Packet Size Constraints) for more details.
146148

147149
Thus, interrupt transfers in Host Mode Scatter/Gather DMA have the following peculiarities:
148150

@@ -151,42 +153,42 @@ Thus, interrupt transfers in Host Mode Scatter/Gather DMA have the following pec
151153

152154
- the channel generates an extra channel interrupt even if the transfer's QTD did not set the IOC (interrupt on complete) bit.
153155
- however, the channel is not halted even if this extra channel interrupt is generated.
154-
- software must then use this extra interrupt to manually halt the interrupt channel (thus canceling any remaining QTDs in the QTD list).
156+
- software must then use this extra interrupt to manually halt the interrupt channel, thus canceling any remaining QTDs in the QTD list.
155157

156158

157159
.. note::
158160

159-
Due to the interrupt transfer peculiarities, it may be easier for software allocate a QTD for each transaction instead of an entire transfer.
161+
Due to the interrupt transfer peculiarities, it may be easier for software to allocate a QTD for each transaction instead of an entire transfer.
160162

161163
Isochronous
162164
^^^^^^^^^^^
163165

164-
In accordance with the USB2.0 specification, isochronous transfers executes transactions at the endpoints specified service period (i.e., ``bInterval``) in order to achieve a constant rate of data transfer. A particular isochronous endpoint may not execute more than one isochronous transaction within a service period. The service period is specified in number of microframes/frames, thus a particular isochronous endpoint will generally execute one transaction every Nth microframe/frame until the transfer is complete. For isochronous channels, the service period of a particular channel (i.e., ``bInterval``) is specified via the Host Frame List (see section 6.5 of programming guide for more details).
166+
In accordance with the USB 2.0 specification, isochronous transfers executes transactions at the endpoints specified service period (i.e., ``bInterval``) in order to achieve a constant rate of data transfer. A particular isochronous endpoint may not execute more than one isochronous transaction within a service period. The service period is specified in number of microframes or frames, thus a particular isochronous endpoint will generally execute one transaction every Nth microframe or frame until the transfer is complete. For isochronous channels, the service period of a particular channel (i.e., ``bInterval``) is specified via the Host Frame List (see section 6.5 of programming guide for more details).
165167

166168
However, unlike interrupt transactions, isochronous transactions are not retried on failure (or NAK), due to the need to maintain the constant data rate.
167169

168170
.. note::
169171

170-
HS USB allows an isochronous endpoint to have 3 interrupt transactions in a single microframe. See USB2.0 specification section 5.6.3 (Isochronous Transfer Packet Size Constraints) for more details.
172+
HS USB allows an isochronous endpoint to have three isochronous transactions in a single microframe. See USB 2.0 specification section 5.6.3 (Isochronous Transfer Packet Size Constraints) for more details.
171173

172174
Thus, isochronous transfers in Host Mode Scatter/Gather DMA have the following peculiarities:
173175

174-
- A QTD must be allocated for each microframe/frame. However, non-service service period QTDs should be left blank (i.e., only ever Nth QTD should be filled if the channel's service period is every Nth microframe/frame).
175-
- **Each filled QTD must represent a single transaction instead of a transfer**.
176-
- Because isochronous transactions are not retried on failure, the status each completed QTD must be checked.
176+
- A QTD must be allocated for each microframe or frame. However, non-service period QTDs should be left blank (i.e., only every Nth QTD should be filled if the channel's service period is every Nth microframe or frame).
177+
- **Each filled QTD must represent a single transaction instead of the entire transfer**.
178+
- Because isochronous transactions are not retried on failure, the status of each completed QTD must be checked.
177179

178180
Supplemental Notes
179181
------------------
180182

181-
Some of the DWC_OTG's behaviors are not mentioned in the Databook or Programming Guide. This section describes some of those behaviors that are relevant to the Host stack's implementation.
183+
Some of the DWC_OTG's behaviors are not mentioned in the Databook or Programming Guide. This section describes some of those behaviors that are relevant to the Host Stack's implementation.
182184

183185
Port Errors Do Not Trigger a Channel Interrupt
184186
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
185187

186-
If a port error occurs (such as a sudden disconnection or port over-current) while there are one or more active channels...
188+
If a port error occurs (such as a sudden disconnection or port over-current) while there are one or more active channels,
187189

188-
- The active channels remains active (i.e., ``HCCHAR.ChEna`` remains set) and no channel interrupts are generated.
189-
- Channels could in theory be disabled by setting ``HCCHAR.ChDis``, but this does not work for Isochronous channels as the channel disabled interrupt is never generated.
190+
- the active channels remains active (i.e., ``HCCHAR.ChEna`` remains set) and no channel interrupts are generated.
191+
- channels could in theory be disabled by setting ``HCCHAR.ChDis``, but this does not work for Isochronous channels as the channel disabled interrupt is never generated.
190192

191193
Therefore, on port errors, a controller soft reset should be used to ensure all channels are disabled.
192194

0 commit comments

Comments
 (0)